I need to clone a CentOS installation from a 1TB disk partitioned with LVM, to several identical machines. The disk is mostly empty since only the operating system and some software are installed and configured.
Without LVM I would copy the entire partition table, and then I would clone the partitions one by one using partclone:
sfdisk -d /dev/sda | sed -e 's/sda/sdb/' | sfdisk /dev/sdb partclone.ext4 -c -s /dev/sda# -o - | partclone.ext4 -r -s - -o /dev/sdb#
However I think it will not work with LVM.
Of course I could just use
dd to clone the whole disk:
dd if=/dev/sda of=/dev/sdb
but it takes too much time compared to partclone.
Is there a way to clone the LVM partitions faster? I think one possible solution is to clone the LVM partitions to regular partitions in another disk using dd, and then clone the new disk to the other machines using partclone. But I do not know if something like this will work:
dd if=/dev/mapper/vg_node07-lv_root of=/dev/sdb1
Can it work? Can you tell me other solutions?