How to migrate data from one Hard Drive to a new one
Hello Linux LVM list,
I apologize if my question has been already answered.The search engines didn't answer to an issue I'm dealing with...
My actual Hard Drives configuration is the following (FS is ext3 for both ones - I'm running Red Hat 9):
Disk /dev/hda: 6448 MB, 6448619520 bytes
255 heads, 63 sectors/track, 784 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 77 514080 8e Linux LVM /dev/hda3 78 784 5678977+ 8e Linux LVM
for my first disk, where I've also installed LILO, and
Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hdb1 1 2550 20482843+ 8e Linux LVM /dev/hdb2 2551 3700 9237375 8e Linux LVM /dev/hdb3 * 3701 4865 9357862+ 39 Plan 9
for the second one.
I finally decided to upgrade my old 6.5G HD to a new 120G HD; is the procedure described in
http://www.tldp.org/HOWTO/LVM-HOWTO/removeadisk.html a safe way to migrate all my data from the former to the 120G? I mean, my case is slightly different from the one described because of /boot partition and LILO in the MBR...
I've found that some programs would easily upgrade HDs. Does anyone know how they work with LVM and how safe would be the upgrade with those kind of tools?
Thanks in advance for your help and apologize if this question does not fit into this mailing list.
Rgds,
Luca
Signature · 1 line
Luca Da Col <[email protected]>
Luca Da Col wrote:
[cut]
Quoted 2 lines
I finally decided to upgrade my old 6.5G HD to a new 120G HD; is the procedure described in
http://www.tldp.org/HOWTO/LVM-HOWTO/removeadisk.html a safe way to migrate all my data from the former to the 120G? I mean, my case is slightly different from the one described because of /boot partition and LILO in the MBR...
yes, but if you are worried, you can do it like this:
mount the new "partition" (real or LV) to /mnt cd /the_source, eg. /usr /var /home ...
find -xdev | cpio -pm /mnt
umount /mnt
repeat for the next source.
The process is described in the software raid howto. Remember to edit the new /etc/fstab and new /etc/lilo.conf, and run lilo with lilo -r /mnt
JonB
Hello LVM mailing list,
thank you very much for your reply. I could be able to upgrade to a new 120G HD. My second goal was to create 2 new partitions and extend my /home directory:
Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 77 514080 8e Linux LVM /dev/hda3 78 784 5678977+ 8e Linux LVM
New partitions:
/dev/hda4 785 14593 110920792+ 5 Extended /dev/hda5 785 13500 102141238+ 8e Linux LVM /dev/hda6 13501 14593 8779491 86 NTFS volume set
Filesystem 1K-blocks Used Available Use% Mounted on/dev/Volume00/LogVol00
6047492 4196432 1543860 74% /
/dev/hda1 101089 27212 68658 29% /boot
/dev/Volume00/LogVol02
28759040 24646092 2652112 91% /homenone 386184 0 386184 0% /dev/shm
I then performed:
1) pvcreate /dev/hda5
2) vgextend Volume00 /dev/hda5
3) lvextend --size +97.4g /dev/Volume00/LogVol02 /dev/hda5
but my /home is still 28G
I was wondering if it's a file system issue, because /dev/hda5 has not been formatted and mke2fs. By the way, I cannot make2fs /dev/Volume00/LogVol02 because I would destroy all my /home.
Any idea?
Thanks
Rgds,
Luca
Quoted 30 lines · Jon Bendtsen
Luca Da Col wrote:
[cut]
Quoted 4 lines
I finally decided to upgrade my old 6.5G HD to a new 120G HD; is the procedure described in
http://www.tldp.org/HOWTO/LVM-HOWTO/removeadisk.html a safe way to migrate all my data from the former to the 120G? I mean, my case is slightly different from the one described because of /boot partition and LILO in the MBR...yes, but if you are worried, you can do it like this:
mount the new "partition" (real or LV) to /mnt cd /the_source, eg. /usr /var /home ...
find -xdev | cpio -pm /mnt
umount /mnt
repeat for the next source.The process is described in the software raid howto. Remember to edit the new
/etc/fstaband new/etc/lilo.conf, and run lilo with lilo -r /mntJonB
_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Signature · 1 line
Luca Da Col <[email protected]>
[root@candido lvmgui-0.4]# vgdisplay -v
--- Volume group ---
VG Name Volume00 VG Access read/write VG Status available/resizable VG # 0 MAX LV 256 Cur LV 3 Open LV 3 MAX LV Size 255.99 GB Max PV 256 Cur PV 5 Act PV 5 VG Size 131.63 GB PE Size 4 MB Total PE 33697 Alloc PE / Size 33693 / 131.61 GB Free PE / Size 4 / 16 MB VG UUID iS2cXG-EbA3-PfjC-MFLO-39iZ-fhkz-Id9jMF
--- Logical volume ---
LV Name /dev/Volume00/LogVol00 VG Name Volume00 LV Write Access read/write LV Status available LV # 1 # open 1 LV Size 5.86 GB Current LE 1500 Allocated LE 1500 Allocation next free Read ahead sectors 1024 Block device 58:0
--- Logical volume ---
LV Name /dev/Volume00/LogVol02 VG Name Volume00 LV Write Access read/write LV Status available LV # 2 # open 1 LV Size 125.27 GB Current LE 32068 Allocated LE 32068 Allocation next free Read ahead sectors 1024 Block device 58:1
--- Logical volume ---
LV Name /dev/Volume00/LogVol01 VG Name Volume00 LV Write Access read/write LV Status available LV # 3 # open 1 LV Size 500 MB Current LE 125 Allocated LE 125 Allocation next free Read ahead sectors 1024 Block device 58:2
--- Physical volumes ---
PV Name (#) /dev/hda2 (1) PV Status available / allocatable Total PE / Free PE 124 / 0
PV Name (#) /dev/hda3 (2) PV Status available / allocatable Total PE / Free PE 1385 / 0
PV Name (#) /dev/hda5 (5) PV Status available / allocatable Total PE / Free PE 24935 / 0
PV Name (#) /dev/hdb1 (3) PV Status available / allocatable Total PE / Free PE 4999 / 0
PV Name (#) /dev/hdb2 (4) PV Status available / allocatable Total PE / Free PE 2254 / 4
[root@candido lvmgui-0.4]# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- ACTIVE PV "/dev/hda2" of VG "Volume00" [496 MB / 0 free] pvscan -- ACTIVE PV "/dev/hda3" of VG "Volume00" [5.41 GB / 0 free] pvscan -- ACTIVE PV "/dev/hda5" of VG "Volume00" [97.40 GB / 0 free] pvscan -- ACTIVE PV "/dev/hdb1" of VG "Volume00" [19.53 GB / 0 free] pvscan -- ACTIVE PV "/dev/hdb2" of VG "Volume00" [8.80 GB / 16 MB free]
pvscan -- total: 5 [131.66 GB] / in use: 5 [131.66 GB] / in no VG: 0 [0]
lvextend -- rounding relative size up to physical extent boundary lvextend -- extending logical volume "/dev/Volume00/LogVol02" to 125.27 GB lvextend -- doing automatic backup of volume group "Volume00" lvextend -- logical volume "/dev/Volume00/LogVol02" successfully extended
Luca Da Col wrote 199 lines:
Quoted 2 lines
1) pvcreate
/dev/hda5
2) vgextend Volume00/dev/hda5
Ok, the Volume Group now has /dev/hda5 added.
Quoted 3 lines
3) lvextend --size +97.4g
/dev/Volume00/LogVol02/dev/hda5but my /home is still 28G
Well, of course!
You have increased the partition (/dev/Volume00/LogVol02). You have *not* increased the filesystem /home.
Instead of lvextend you should have used e2fsadm which runs both lvextend and resize2fs (or ext2resize), and fsck, in the correct order. It's a good idea, generally, to umount /home first.
Please read the manpages of e2fsadm, resize2fs and ext2resize for more information.
-Wolfgang