[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

LVM and hard disk upgrade



Hello,

I have a fresh (few days old) installation of Lenny (Debian 5.0,
stable) system. This installation was performed on single disk - used
drive, unfortunately. As S.M.A.R.T is reporting potential disk
failure, I need to move the system to a new HDD. This new drive is
bigger than the current one, so I can't just 'dd' from old one to the
new (and I'm not even sure if this could work - because of UUIDs
different for new disk?).

In LVM-HOWTO I found procedure for removing old drives from volume
group. Just create new PV on new disk, add the new PV to volume group,
move existing data out of old physical volume using 'pvmove old_pv
new_pv', remove old disk from volume group using 'vgreduce' and remove
old drive, rebooting the system.

I guess this could work if only /home (or similar, not important
during bootup filesystems) were on LVM, but default Debian install
leaves only /boot on normal partition, putting all the rest (/, /home,
swap) on LVM logical volumes.

But when / is on LVM, I expect trouble booting system from new disk
(changed UUIDs? wrong root LV label in initramfs?)


What steps do I need to perform to be able to boot system from new
disk?  Had anyone do similar operation?


New disk will be temporairly /dev/hdc, and after upgrade it will be
moved to /dev/hda, in place of current faulty one. Does it influence
PV name (currently /dev/hda2, on new disk it will probably be
/dev/hdc2)?

Simple 'update-grub', after booting from any LiveCD (like GRML) and
chrooting to new disk, would do? Or maybe I have to update initramfs to
point to correct PV (or does it use only LV and initramfs's devmapper
should figure it out, that root is on different PV now)



My system's current layout is:
/etc/fstab (stripped from unimportant data)
/dev/mapper/mongoose--vg01-root   /      ext3
/dev/hda1                         /boot  ext2
/dev/mapper/mongoose--vg01-home   /home  ext3
/dev/mapper/mongoose--vg01-swap_1 none   swap


# fdisk -l /dev/hda
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          31      248976   83  Linux
/dev/hda2              32       24321   195109425   8e  Linux LVM


# vgdisplay 
  --- Volume group ---
  VG Name               mongoose-vg01
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               186,07 GB
  PE Size               4,00 MB
  Total PE              47634
  Alloc PE / Size       47634 / 186,07 GB
  Free  PE / Size       0 / 0   
  VG UUID               NygOpX-FYnl-xCqn-Lp2w-xJ5X-Yshs-cRvNND


# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               mongoose-vg01
  PV Size               186,07 GB / not usable 561,00 KB
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              47634
  Free PE               0
  Allocated PE          47634
  PV UUID               QSWVsg-wAMw-SMA4-ES0N-0bFi-otbn-A3EzXS


# lvdisplay 
  --- Logical volume ---
  LV Name                /dev/mongoose-vg01/root
  VG Name                mongoose-vg01
  LV UUID                AK2MWV-EqId-duJm-5i10-Kche-ktwt-suw12y
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                6,52 GB
  Current LE             1668
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Name                /dev/mongoose-vg01/swap_1
  VG Name                mongoose-vg01
  LV UUID                18unpG-yVB6-lGdP-jIiH-Pcqd-iYv9-VL5uRA
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                732,00 MB
  Current LE             183
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Name                /dev/mongoose-vg01/home
  VG Name                mongoose-vg01
  LV UUID                6NBBNw-Nd3e-K2bp-Ds7p-R9UY-qs1S-JSml9y
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                178,84 GB
  Current LE             45783
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2


and relevant entries from /boot/grub/menu.lst
title           Debian GNU/Linux, kernel 2.6.26-1-686
root            (hd0,0)
kernel          /vmlinuz-2.6.26-1-686
root=/dev/mapper/mongoose--vg01-root ro
initrd          /initrd.img-2.6.26-1-686

title           Debian GNU/Linux, kernel 2.6.26-1-686 (single-user
mode)
root            (hd0,0)
kernel          /vmlinuz-2.6.26-1-686
root=/dev/mapper/mongoose--vg01-root ro single
initrd          /initrd.img-2.6.26-1-686


-- 
Cheers,
Jacek Politowski


Reply to: