红联Linux门户
Linux帮助

Linux修复记

发布时间:2008-01-13 10:45:46来源:红联作者:Kttlon
昨天从实验室搬电脑回来,在宿舍经过一天乱搞,勉强又可以回到linux下了。

在试了ntloader不行下,在别人的机试下,确实可以,这里注意复制MBR是sda,不是sda1,还有,我的机确实是坏道了。MBR那里坏道了。

引用:
cd /mnt

mkdir c

mount /dev/sda1 /mnt/c

grub

grub>root (hd0,6)

grub>setup (hd0)

grub>quit

dd if=/dev/sda of=/mnt/c/linux.boot bs=512 count=1


把linux.boot拷到C盘下,在boot.ini下加入一行

C: \linux.boot="help,,help!!!"

重启,结果可以在grub和ntloader下转来转去,呵呵。可惜在我的机上却不行,因为MBR坏道了,哎碍。

这里,C盘是FAT格式,如果没有,就用U盘。

走到这里,想重装了,我的分区是

引用:
Disk /dev/sda: 81.9 GB, 81964302336 bytes

255 heads, 63 sectors/track, 9964 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Device Boot Start End Blocks Id System

/dev/sda1 * 1 1049 8426061 c W95 FAT32 (LBA)

/dev/sda2 1050 9964 71609737+ f W95 Ext'd (LBA)

/dev/sda5 1050 2354 10482381 7 HPFS/NTFS

/dev/sda6 2355 4965 20972826 7 HPFS/NTFS

/dev/sda7 4966 4981 128488+ 83 Linux

/dev/sda8 4982 6548 12586896 83 Linux

/dev/sda9 6549 7201 5245191 83 Linux

/dev/sda10 7202 7332 1052226 82 Linux swap / Solaris

/dev/sda11 7333 9964 21141508+ 8e Linux LVM


在装的过程中,选择update,结果在一半时硬盘又“嗒嗒”响了,没有立即关机,这样响了好久,提示安装不下去,估计在这里坏道又扩大了,最后导致sd8的12G的分区用不了。

重装时重装了/和/boot分区,即sda7和sda9,再加swap分区sda10,选择引导程序装在linux处,不是MBR,重装一切顺利。

重装以后,分别拷sda7和sda9前512B,结果还是没用,到了这里,真是郁闷!

在liveCD或rescure下grub重装在(hd0)即MBR中,还是没用,error 18,郁闷!

fdisk /mbr后,试图setup (hd0,6)或(hd0,8)即/和/boot分区中,却提示安装failed,走到这里,好像无路可走了,好在csdn有人提示我用grub4dos,好在还有路啧!

用wingrub,却不会怎样用,放弃了

下载了gurb4dos,按提示操作,进入到GRUB提示符下了,真是谢天谢地,我知道有救了

引用:
GRUB>root (hd0,6)

GRUB>kernel /v(tab键)

GRUB>kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL/1

GRUB>initrd /ini(tab键)

GRUB>initrd /initrd-2.6.21-1.3194.fc7.img

GRUB>boot


启动了,哈哈,终于进到linux了,哈哈。

还有新问题,就是根分区sda9共5G,在要安装比较多的软件情况下,是不够用的,于是就想把/usr分出来,因为那里都有3G了,80G硬盘没有新分区了,sda7又用不了,一挂载硬盘就“嗒嗒”响了,window下格掉也不行,死机了,看样子sda7确实不能用了,好在sda11是lvm啊,lvm就是方便,20G除了/dev/mian/lvmedia和/dev/main/lvmhome共10G外,还有10G,这样新建了一个lvmusr,也是5G

在rescure或init 1模式下进行以下操作:

引用:
#vgdisplay

#lvdisplay

#lvcreate --help

#lvcreate -L5g -nlvmusr main

#lvdisplay

#ls /sbin/mkfs.*

#/sbin/mkfs.ext3 /dev/main/lvmusr

#cd /mnt

#mkdir lvmusr

#mount /dev/main/lvmusr /mnt/lvmusr


以上在模式5或3都可以进行,为了复制的完全性,下面在init 1或rescure中操作

#cp -axv /usr/* /mnt/lvmusr/

复制完后

引用:
#mv -r /usr /usr.bat

#mkdir /usr

#vim /etc/fstab


添加一行

/dev/main/lvmusr /usr ext3 defaults 1 1

重启,结果重启不了,很多都是failed,failed,failed,failed,估计原因是/usr分区分出来好像不行,以前我试过/home是可以的,或是硬盘不行,总之不行,重新操作了一遍,还是不行

/usr/share有2G左右,再建多一个lv,lvmshare,3G,重样的操作,结果可以了,为/分区减少了2G的空间。

引用:
df -lh如下:

[root@localhost /]# df -lh

文件系统 容量 已用 可用 已用% 挂载点

/dev/sda9 4.9G 2.3G 2.4G 50% /

/dev/sda7 122M 12M 104M 11% /boot

tmpfs 217M 0 217M 0% /dev/shm

/dev/sda1 8.1G 5.3G 2.8G 66% /mnt/winc

/dev/sda5 10G 7.0G 3.1G 70% /mnt/wind

/dev/sda6 21G 13G 7.2G 65% /mnt/wine

/dev/mapper/main-lvmhome

4.9G 1.7G 3.0G 36% /home

/dev/mapper/main-lvmedia

5.0G 1.7G 3.0G 37% /media

/dev/mapper/main-lvmshare

3.0G 1.7G 1.2G 60% /usr/share



fdisk -l如下:

[root@localhost /]# fdisk -l



Disk /dev/sda: 81.9 GB, 81964302336 bytes

255 heads, 63 sectors/track, 9964 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Device Boot Start End Blocks Id System

/dev/sda1 * 1 1049 8426061 c W95 FAT32 (LBA)

/dev/sda2 1050 9964 71609737+ f W95 Ext'd (LBA)

/dev/sda5 1050 2354 10482381 7 HPFS/NTFS

/dev/sda6 2355 4965 20972826 7 HPFS/NTFS

/dev/sda7 4966 4981 128488+ 83 Linux

/dev/sda8 4982 6548 12586896 6 FAT16

/dev/sda9 6549 7201 5245191 83 Linux

/dev/sda10 7202 7332 1052226 82 Linux swap / Solaris

/dev/sda11 7333 9964 21141508+ 8e Linux LVM



Disk /dev/dm-0: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Disk /dev/dm-0 doesn't contain a valid partition table



Disk /dev/dm-1: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Disk /dev/dm-1 doesn't contain a valid partition table



Disk /dev/dm-2: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Disk /dev/dm-2 doesn't contain a valid partition table



Disk /dev/dm-3: 3221 MB, 3221225472 bytes

255 heads, 63 sectors/track, 391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



Disk /dev/dm-3 doesn't contain a valid partition table



#vgdisplay,如下:

[root@localhost /]# vgdisplay

--- Volume group ---

VG Name main

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 5

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 4

Open LV 3

Max PV 0

Cur PV 1

Act PV 1

VG Size 20.16 GB

PE Size 32.00 MB

Total PE 645

Alloc PE / Size 576 / 18.00 GB

Free PE / Size 69 / 2.16 GB

VG UUID AojRlY-Hxzm-VCdc-dmoj-fC9g-5FzW-mG7dFx



#lvdisplay,如下:

[root@localhost /]# lvdisplay

--- Logical volume ---

LV Name /dev/main/lvmhome

VG Name main

LV UUID DFyXSW-ZZk4-wpRr-scj3-nvdG-1HuX-QaNx0Z

LV Write Access read/write

LV Status available

# open 1

LV Size 5.00 GB

Current LE 160

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:0



--- Logical volume ---

LV Name /dev/main/lvmedia

VG Name main

LV UUID STE4Gt-5roo-z1W9-O7PM-lQuv-Re6B-FFdpMc

LV Write Access read/write

LV Status available

# open 1

LV Size 5.00 GB

Current LE 160

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:1



--- Logical volume ---

LV Name /dev/main/lvmusr

VG Name main

LV UUID RhOc0l-daKM-dO1r-TW2a-NAbZ-ZMbU-dlJJo4

LV Write Access read/write

LV Status available

# open 0

LV Size 5.00 GB

Current LE 160

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:2



--- Logical volume ---

LV Name /dev/main/lvmshare

VG Name main

LV UUID wXULW5-YsFz-KD1B-pdpJ-lGFF-Z4T0-ocCXla

LV Write Access read/write

LV Status available

# open 1

LV Size 3.00 GB

Current LE 96

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:3
文章评论

共有 0 条评论