ubuntu数据恢复.doc
文本预览下载声明
前些天,调试文件系统时,失手把ubuntu系统的etc目录给删了(慎用rm的-fr选项)。这下悲剧了,还原不回来,好在系统运行还正常。这些天空闲下来了,琢磨着修复这个问题。经过悲剧般的折腾,系统彻底挂了,系统和分区信息都出了问题(至少我这么认为,系统打死都起不来)。放弃之余,忽然意识到修改后的内核还没有备份,而且庞大的工具链也没有备份。重做工具链和内核费工费时,于是决定试着把文件恢复出来。
步骤如下:
介绍过程之前强烈建议使用linux的记得备份etc等文件。
1、
Mounting a Linux LVM volume
You do not mount a partition of type Linux LVM the same way you mount a partition using a standard Linux file system (e.g. ext2, ext3).如果连root都不能写的话,就不是权限的问题。首先确定,hda2是不是ntfs或者什么新型的分区。如果是的话,确实是不能写入的,ntfs可以打开写入功能,但是相当危险,绝对不推荐。如果不是,你只要在挂上以后执行:mount -o remount,rw /mnt/e或者挂载的时候就执行:mount -o rw /dev/hda2 /mnt/e就可以了。# fdisk -l /dev/hdaDisk /dev/hda: 160.0 GB, 160041885696 bytes255 heads, 63 sectors/track, 19457 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/hda1 * 1 13 104391 83 Linux/dev/hda2 14 19457 156183930 8e Linux LVM# mount /dev/hda2 /tmp/mntmount: /dev/hda2 already mounted or /tmp/mnt busyFirst, lets determine the volume group containing the physical volume /dev/hda2.# pvs PV VG Fmt Attr PSize PFree /dev/hda2 VolGroup01 lvm2 a- 148.94G 32.00M /dev/hdb2 VolGroup00 lvm2 a- 114.94G 96.00MNext, lets list the logical volumes in VolGroup01.# lvdisplay /dev/VolGroup01 --- Logical volume --- LV Name /dev/VolGroup01/LogVol00 VG Name VolGroup01 LV UUID zOQogm-G8I7-a4WC-T7KI-AhWe-Ex3Y-JVzFcR LV Write Access read/write LV Status available # open 0 LV Size 146.97 GB Current LE 4703 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:2 --- Logical volume --- LV Name /dev/VolGroup01/LogVol01 VG Name VolGroup01 LV UUID araUBI-4eer-uh5L-Dvnr-3bI6-4gYg-APgYy2 LV Write Access read/wri
显示全部