Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?
share|improve this question
    
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
add comment

3 Answers

up vote 3 down vote accepted

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 to divide new disk to the partitions with the same size as on the old disk and copy via dd only partitions, not whole disk. Then you can use last part of disk as LVM partition and include it to the existing PV.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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