You are not logged in.
Hi folks,
I've been experiencing some troubles lately, related to LVM. Since I don't really need to use LVM - I just tried it for fun - I'd like to switch back to a "traditional" partition management on the same disk (maybe GPT given that I only have Linux partitions) and keep my current Arch installation.
I thought that I could use dd to clone my Arch partitions and a quick research on the web tends to confirm it. I just want to make sure that I'm not gonna mess up with my partitions. So here is how I was thinking to proceed :
Use dd to backup my logical volumes on an intermediate drive
dd if=/dev/vg/lv of=/mnt/drive/lv.img
Wipe my existing partition table
Recreate a new partition table, using the same filesystems as my former logical volumes used, and format the new partitions
Use dd to restore my former logical volumes on the new partitions
dd if=/mnt/drive/lv.img of=/dev/sdaX
Change former UUIDs in /etc/fstab for those of the new partitions
Chroot in my "new" installation and reinstall GRUB
Optionally : remove the lvm hook from /etc/mkinitcpio.conf and generate a new initrd
Thus, I have 2 questions :
Is it ok to use dd like I plan to for making a backup of my existing logical volumes and then restore them on the new partitions ?
Do I forget something in order to make my "new" system working ?
Thanks for your advice !
Last edited by sclarckone (2013-02-28 13:39:04)
Offline
i think that in theory it should work.
check this page
http://m.techrepublic.com/blog/opensour … th-dd/1771
instead of creating IMG files you could use your backup to test if it worked by booting from your backup drive, and change the necessary things if it hás any problems.
Only after seeing if it works, then you can safelly recreate your system with dd
Last edited by s1ln7m4s7r (2013-02-28 15:34:40)
Offline
Steps:
Example:
System with lvm volumes:
lvm-root / - 20g
lvm-user /home - 20g
lvm-boot /boot - 512m
Backup Drive:
create partitions
sdx1 /boot - 512m
sdx2 / - 20g
sdx3 /home -20g
dd if=/dev/volume_group_name of=/dev/sdx bs=446 count=1
dd if=/dev/volume_group_name/lvm-boot/ of=/dev/sdx1
dd if=/dev/volume_group_name/lvm-root/ of=/dev/sdx2
dd if=/dev/volume_group_name/lvm-user/ of=/dev/sdx3
i dont know if you need to mount your backup drive partitions before.
then change the necessary things by chroot your backup drive.
then see if it boots from it, when it is funcional you can do the same things, to your system drive, by using your backup system
Note: you chould post your fstab for a more complete help.
Last edited by s1ln7m4s7r (2013-02-28 15:36:45)
Offline
i think that in theory it should work.
check this page
http://m.techrepublic.com/blog/opensour … th-dd/1771
instead of creating IMG files you could use your backup to test if it worked by booting from your backup drive, and change the necessary things if it hás any problems.
Only after seeing if it works, then you can safelly recreate your system with dd
Thanks for you answer.
It would be great to test the system from my backup drive but I don't have any empty backup drive so I won't be able to create a new partition table on it. Hence the idea of dumping my current logical volumes to IMG files.
Unless I can get my hands on an empty drive I guess I'll have to do it straight, without the possibility of testing it on the backup drive.
And just out of curiosity, in your second post you suggest to :
create partitions
sdx1 /boot - 512m
sdx2 / - 20g
sdx3 /home -20gdd if=/dev/volume_group_name of=/dev/sdx bs=446 count=1
But the latter command would overwrite the partition table you've just created before, no ?
And are you sure about the /dev/volume_group_name of=/dev/sdx ? I don't know how LVM works "inside" but a VG can contain more than one PV - i.e more than one physical partition - so I'm not sure that would work. And I don't even know where the "LV table" is located inside a VG...
Last edited by sclarckone (2013-02-28 16:15:34)
Offline
s1ln7m4s7r wrote:i think that in theory it should work.
check this page
http://m.techrepublic.com/blog/opensour … th-dd/1771
instead of creating IMG files you could use your backup to test if it worked by booting from your backup drive, and change the necessary things if it hás any problems.
Only after seeing if it works, then you can safelly recreate your system with dd
Thanks for you answer.
It would be great to test the system from my backup drive but I don't have any empty backup drive so I won't be able to create a new partition table on it. Hence the idea of dumping my current logical volumes to IMG files.
Unless I can get my hands on an empty drive I guess I'll have to do it straight, without the possibility of testing it on the backup drive.
Remenber you need at least the same available space for backup equal to the space of your system drives, because dd also copies empty data.
Also i guess that you wont be doing any changes in the drive that will maintain the backup. So you could resize your current space (it is possível without loosing data), and create the other partitions on that disk and use it as your testing drive, in the end you can resize it to is normal States, instead of risking to messup you system.
And just out of curiosity, in your second post you suggest to :
s1ln7m4s7r wrote:create partitions
sdx1 /boot - 512m
sdx2 / - 20g
sdx3 /home -20gdd if=/dev/volume_group_name of=/dev/sdx bs=446 count=1
But the latter command would overwrite the partition table you've just created before, no ?
And are you sure about the /dev/volume_group_name of=/dev/sdx ? I don't know how LVM works "inside" but a VG can contain more than one PV - i.e more than one physical partition - so I'm not sure that would work. And I don't even know where the "LV table" is located inside a VG...
Actually i dont really know if this would work on lvm, in the link ive posted its said that the first dd call copies the MBR from the first disk to the second. This will allow the second disk to be booted, when it replaces the first. The first 446 bytes are copied with this command; that is the boot code we need.
You can always mannually reinstall mbr instead of doing that, maybe it would be safest.
Last edited by s1ln7m4s7r (2013-02-28 19:14:51)
Offline