Server관련/Sever(OS)

[linux] LVM in rescue mode (복원)

saltdoll 2008. 9. 16. 11:38
반응형

LVM in rescue mode

I've had to deal with LVM in rescue mode a few times lately, which has given me some new insight into this stuff:

e2fsck:

  • Boot into rescue mode (in RHEL/Fedora this means putting in CD 1 and typing "linux rescue" at the boot prompt -- but it's essentially any minimal live CD). Rescue mode does not do anything with LVM by defualt: to activiate the volume groups, you need to issue these:

    #lvm vgscan
    #lvm vgchange -ay
    #lvm lvs

  • lvs will simply display your volume group and logical volume names, use this output to issue the e2fsck command: e2fsck /dev/volumegroupname/logicalvolumename. Of course, pass what ever options ot e2fsck you normally would (like -y or -c).
Re-name the / volume group:

  • I never thought I'd have a legitimate reason to do this, until I found myself wanting to back up data from one disc (from a dead system) on to another system. I always choose the default names for VGs and LVs, so when I put my extra disc into my live system it choked finding two volume groups named "VolumeGroup00".


    Take out that second disc, then boot into rescue mode (do not mount anything and do not run the lvm commands from the previous example):

    #vgrename VolumeGroup00 newname

    Where VolumeGroup00 is the old name, and "newname" is the newname. If this was not the root filesystem we would be done and could happily reboot as normal. But, since this IS the root file system, we need to remake the initial ramdisk first (if you don't have one of those, you're off the hook):


    #mount /dev/newname/LogVol00 /mnt/sysimage
    #mount /dev/sda1 /mnt/sysimage/boot
    #chroot /mnt/sysimage
    #cp /boot/initrd-kernelversion.img /boot/kernelversion.img.old
    #mkinitrd -v -f /boot/initrd-kernelversion.img kernelversion

    Don't forget to change all references to the old VG name. Typically this would be in grub.conf and fstab. After that, reboot with that second disc added and you should be fine


  • 참고:  드라이브 확인 명령
    #fdisk -l
     

    출처 :
    반응형
    도움이 되셨다면 하트모양의 "♡ 공감"을 눌러주시면 큰 격려가 됩니다.
    (로그인하지 않으셔도 가능)