How to move from one drive to another that's a different size?
I've run into this scenario a few time: I need to replace a drive because I need more space, it's having problems, moving to a new box, etc.
What's the best way to copy data from one partition size to another (presuming the target has enough space)?
What about if it's a different file system (such as ReiserFS to ext4)?
If it's just a new drive on an existing system, how do I ensure I don't need to reinstall to get everything working?
Update - many of the options are highly viable, and I've changed this question to community wiki because I don't think there's a "right" answer.
Clone the drive using CloneZilla, then use gparted to resize it. Keep your old one in case if goes wrong :-)
By the way, this way is free.
The solution I've used in the past is tar
. If the partitions are the exact same size and type, you can use dd
.
Here's my answer to the quandary:
- boot using a live cd distro such as Slax
- verify the partitions you want are on the new drive
- make sure both the old and new drives are mounted, for example
/tmp/driveold
and /tmp/drivenew' -
run from a terminal the following
tar
command:(tar cp --xattrs /tmp/driveold/path) | (tar x /tmp/drivenew/path)
repeat for each partition you need to copy
This works for every partition I've ever tried it on (excluding /boot
, for which I ensure the partitions are identical, and use dd
).