0

I have a headless Ubuntu (18.04) server with 3 hard drives each partitioned to a single lvm volume group for a combined size of 6Tb. I recently purchased a new hard drive that is 8Tb and I want to get everything copied onto the new hard drive. I've partitioned the new 8Tb drive and set up an ext4 file system on it (I don't want to use logical volumes if I don't have to).

I've found many posts about copying from one logical volume to another, but I can't find anything about going from a logical volume to a purely physical volume so I'm wondering if this is something that anyone has done before or would know how to do?

Would it be possible to use something like dd if=/dev/lvm/root of=/dev/sdd1 or will that not work? Will I perhaps have to go through and manually copy the parts of the LVM filesystem onto my newly partitioned HDD?

  • 2
    cp -a src dest – jordanm Jan 16 at 21:48
1

but I can't find anything about going from a logical volume to a purely physical volume so I'm wondering if this is something that anyone has done before or would know how to do?

That's because that is not possible to do. What you should do is backup your data, with copy commands. Use the combination of tar and pipe to do that. You would keep the same rights.

Here are a few options:

cp -a /lvm_partition_a /physical_partition_a

cd /lvm_partition_a; tar cf - . | (cd /physical_partition_a; tar xf -)
  • Thanks, I was afraid this was going to be what I would have to do, which is why I kicked off a cp -a yesterday right after posting this question ;) I was just hoping there would be some single command that wouldn't require me to manually copy everything around, drive by drive or folder by folder. – Ponyboy47 Jan 17 at 14:44
1

As suggested by @jordanm, the simplest option is to cp -a src dst or rsync --progress -av /src/ /dst your source filesystems to the new disk filesystem.

But in case you reconsider your willing to get rid of lvm, you can do the migration online, without copying any file, using the pvmove /dev/sdb /dev/sdd command (first pvcreate /dev/sdd on the new disk, and then for each physical volume corresponding to old disks, run a pvmove)

  • Thanks. I don't know why I didn't think of rsync. I use it all the time at work (I prefer it over scp).Unfortunately I will not be reconsidering lvm at this time. I currently have a single root (/) partition using lvm and will instead be using the 3 hard drives (and the new 4th one) for a split filesystem setup. I ran into issues with lvm when I was wanting to shrink the lvm partition since I didn't have any storage media large enough to back everything up. I'll now be using one drive for /home, another for a Nextcloud instance, one for Plex, and then everything else on the last one. – Ponyboy47 Jan 17 at 14:41

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.