I'm trying to copy an entire HDD which has IBM PC-style partition table to a larger one by dd on GNU/Linux. The questions are:

  1. Can I use the additional space on the larger disk by changing the partition table?
  2. I was using LVM on the source disk. Does it help, or make complications when I copy it or use the additional space on the larger disk?
  • Is your source disk a single partition/PV or is the structure more complicated than that? Is it your boot disk? – Mat Feb 28 '12 at 11:26
  • As far as I remember the disk has one partition for the boot loader and one for physical volume. – Pteromys Feb 28 '12 at 12:01

You can do this if you have disks with the same type of partition tables: i.e. with the same type addressing mode in BIOS (CHS/LBA/LBA32/GPT). If you are not sure about it I can recommend you divide the new disk into partitions with the same size as on the old disk and copy (via dd) only partitions, not whole disk. Then you can use the last part of the disk as an LVM partition and include it to the existing PV.

| improve this answer | |

Since you are using LVM, you are better off using LVM to move the logical volumes instead of dd. Simply add the new disk as a new PV ( with pvcreate and vgextend ) and then use pvmove to migrate the logical volumes off of the old PV, and then vgreduce to remove the old PV. Then you will need to install your boot loader ( grub? grub2? depends on your distro ) on the new drive.

| improve this answer | |

Yes you can, but after, fdisk and your filesystem will believe your hard disk is smaller than it is. This problem is often encountered when you manage virtual machines and you are asked to extend their hard drives.

Since you use LVM, you'll need to resize it at both LVM & FileSytem levels.

  1. For lvm, you'll need to
    1. pvresize to apply the new size
    2. lvextend to extend your logical volume with those new extents available
  2. For ext*, you have the resize2fs command. See this page for more info about other filesystems.

EDIT : In fact, it depends if you copy your whole original disk or only a logical volume. If you copy a logical volume, it's like a classical disk copy : you'll just need to extend your filesystem after that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.