Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a 500gb encrypted (LUKS) hdd with linux installed (only 50gb used) and I want to migrate to a 250gb ssd. Installing from scratch to the new drive is something that I want to avoid since I have many configurations that I prefer not to do again...

Since the disk is encrypted I thought of using some software with sector to sector cloning. Now I have two questions:

  1. Is it possible at all to do a sector to sector copy from a bigger to a smaller disk? What if I reduce the size of my partitions on my hdd in order to fit the ssd size? Will the backup software care or it will just copy the whole disk again?
  2. Will I face other problems after the backup? Drive letters, UUIDs... I don't know what else...

Of course if you have a better (simpler) recommendation for what I want to do, feel free.

share|improve this question
    
You will have to shrink the larger partition so it the same size. That is the simplest way to migrate from a larger disk to a smaller disk. Please remove your request for a product recomendation since thats not on topic –  Ramhound May 12 at 14:20
    
You might find this thread useful. The reason for copying was different but circumstances similar. –  smc May 12 at 14:32

2 Answers 2

I believe since your system hdd is encrypted you can follow the guide here, then simply dd each of the partitions (including the mbr or UEFI, whichever you use) and then clone them onto the ssd. http://help.ubuntu.com/community/ResizeEncryptedPartitions. You would also need to ensure that the partitions are aligned for optimal performance for the ssd.

However another easier method is to simply backup the configuration files, install the OS on the ssd and restore them.

share|improve this answer

In general, the easiest way to migrate an already installed Linux-based OS from one storage device to another is probably to:

  1. Create a new file system on the target device. In your case, this would include creating a LUKS container, unless you want to migrate to unencrypted as well. Because you are creating a new file system, you don't have to worry about file system UUID collisions and similar.
  2. Copy all files from the source to the target device. Do this from a live-CD environment or similar, not from a running system, to ensure that nothing is changed during the process. rsync has several useful options here. Make sure to mount all relevant file systems before starting the copying process.
  3. Adjust the target's /etc/fstab and boot loader configuration to match the new reality. If you're still using /dev/sdXY names for partitions, this would be a good time to migrate to something else (UUIDs, labels, WWN IDs, whatever suits your fancy, just something stable). Then you don't have to worry when you unplug or rearrange the disks so the target device becomes the first one in the eyes of the BIOS.
  4. Still running in the live-CD environment, chroot into the target device root directory, mount all file systems (mount -a), and reinstall the boot loader to the target device.
  5. Reboot, and observe that your system boots from the target device just fine.

Really. I've done something very similar to what's described above a handful of times, and it isn't much more involved than that. You do have to take care while copying files and reinstalling the boot loader, but there's no real magic to it.

share|improve this answer

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.