Clone single partition to empty disk

I would like to clone a single partition off of my current HDD to a newer, larger SSHD. The partition that I would like to clone is running Linux Mint 17.1. Using a bootable Clonezilla USB, I have been able to clone the entire old disk to a new disk, but the Mint partition is preceded by a large, messy Windows 8.1 partition. The Windows 8.1 partition is failing on the HDD, however, so I only want to keep the Mint partition.

Could I do this with Clonezilla, GParted, dd, or some combination?


Solution 1:

You will need to have both partitions mounted, for instance on /old and /new. Then use the rsync utility:

rsync -aruv /old/* /new/

If the old partition is your root system, you will want not to copy over the contents of some directories. Just exclude them, such as:

rsync -aruv /* /new/ --exclude=/dev/* --exclude=/proc/* --exclude=/run/* --exclude=/sys/* --exclude=/tmp/* --exclude=/new

Do not forget that last one! (Been there, done that. ;-) ).

HTH

Solution 2:

Don't know what an sshd is (related to storage) ... did you mean SSD?

There are 50+ different ways to do this.

  • dd
  • ddrescue
  • partimage
  • clonezilla
  • fsarchiver
  • gparted
  • rsync
  • any normal backup/recovery too

So the best answer for you will depend on your skillz with any of the above commands AND how good you are in correcting the /etc/fstab after the restore to a new disk is completed. If you know fstab, grub-install, update-grub and blkid well, any of these tools are trivial.

Anyway, the man pages for any of those tools explains how to use them. Also, don't forget to create the partitions on the target disk for swap too. It would be smart to use GPT (not MBR) formating if your situation allows that. If there isn't any Windows involved on the new system, go for it - use GPT and be happy. Windows only allows GPT if UEFI boot AND a 64-bit OS.

Of course, we are having to make hundreds of assumptions about your setup here - if you use LVM, encryption, or anything strange like booting off xfs or zfs partitions, then all bets are off.

To get more exact suggestions, post the output from sudo parted -l please. Have both disks connected when running it.

The general steps are:

  • Boot off a liveCD (disto or Rescue Disk)
  • Create the partition table on the new disk (GPT recommended)
  • Create the desired partitions on the disk

    • /boot
    • /
    • /home
    • others .... /var /opt, ....
    • swap
  • Size each as desired, but be smart. Also, it is smart to leave some leftover space that can be added later to partitions that need it.
  • use the listed tools to copy over the data ... I'd probably use ddrescue. sudo ddrescue source target Use the partition device for both sides. Something like /dev/sda20 /dev/sdb34 (those are NOT correct for your situation)
  • mount the new disk to a temp location - /mnt is good
  • edit the /mnt/etc/fstab to point partitions to the correct place using either the path to the partition or a LABEL or a UUID
  • install grub onto the new disk - lots of howtos for that (should include a chroot cmd and may include multiple mount commands)
  • reboot - disconnect the liveCD before the 2nd boot happens Be happy.

Again, if you want better help with more details, post the output from the requested cmd.

BTW - you can safely delete the Windows partitions, assuming the old disk will be left in the computer. That isn't clear.