I have a 80 GB hard drive which contains a copy of Ubuntu and a total of about 20 GB of data. I would like to transfer this data over to a SSD that is 60 GB in capacity.

I've looked at tools such as dd and clonezilla, however these have all had one major limitation: The source drive must be smaller in capacity than the destination drive.

Now I'm not sure if this is an inherent limitation with all cloning methods, but is there a way to copy all the data over, so that the SSD can be booted from and operation of the system can be resumed seamlessly?

EDIT: I should probably also mention that I would prefer not messing with the source drive's partitions if at all possible. I'm rather reluctant to make any changes to it because the contents have been rather...temperamental.

EDIT2: Alright, I took a risk and resized the source partition. Managed to do so without issues. So I booted to a live USB and used gparted to create a swap and ext4 on the target drive. Partitions are sda1 and sda2 respectively.

I then performed dd successfully on the resized ext4 partition and sent it to sda2. Since sda1 is swap, I left that one alone.

Next, I did mkswap /dev/sda1 and then mounted sda2 to /media/target so I could edit /etc/fstab in sda2, changing the appropriate lines to the appropriate partitions.

Now to where I'm stuck. From what I understand, I need to run grub-install, but I have no idea how to use it properly. Tried grub-install /dev/sda, but I got an error asking if /dev was mounted. Tried mount /media/target/dev and then repeating grub-install /dev/sda but I get the following: https://imgur.com/a/qpvmy

  • Do you have several partitions on the 80 GB hard drive? If everything is in one big partition you will not be able to transfer all data with tools like dd as your data are scattered over the 80 GB and dd doesn't consider file system structures. If you have several partitions you could use dd for some of them. But if you copy the system you'll have to edit some files like /etc/fstab anyway, as well as the grub configuration. – muclux Feb 6 '18 at 7:20
  • You are on the right track, dd is not the way to go for storage of dissimilar capacities. Partition the new device with filesystems you want (root and swap is the minimum requirement) and allowing space for boot. Then build the filesystems mkfs. Then mount the new filesystem(s) and use cpio to copy the data. Then install grub on the new device to make it bootable. You will have to edit some files as mcclux mentioned, that has references to the device you are coping from. – stumblebee Feb 6 '18 at 7:57
  • See EDIT2 above. I decided to take a risk on the data and I got lucky, but I'm stuck on what is hopefully the final part. – hg2 Feb 6 '18 at 9:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.