2

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?

  • Clonezilla should also allow you to clone partitions and not only whole disks. I am not sure, but also GParted should allow you to copy partitions to unallocated space. dd should be possible, but if you are not very carefully, you can make a mess out of both of your disks. Better use Clonezilla or maybe GParted. – Byte Commander Jun 16 '15 at 12:19
  • How would I do this with Clonezilla? Using the partition-local partition option, I am not able to target the new drive. I think it's because the new drive is completely unallocated and has no partitions set up. – errolflynn Jun 16 '15 at 14:50
2

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

  • Would /dev/sdc1 or /media/usb be the mount point? – errolflynn Jun 16 '15 at 14:49
  • /dev/sdc1 would be the target partition on the device. /media/usb could very well be the mount point, though usually you will find /media/<username>/<volumename> The mount command (with no parameters) will tell you if it has been mounted automatically. – ALAN WARD Jun 16 '15 at 15:19
1

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.

  • SSHD is a hybrid drive. A normal HDD with rotating disks plus a flash technology (SSD-like) cache memory. Read wikipedia: en.wikipedia.org/wiki/Hybrid_drive – Byte Commander Jun 17 '15 at 11:29
  • Model: ATA WDC WD5000BPKT-7 (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/4096B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 41.1MB 41.1MB primary fat16 diag 2 41.9MB 830MB 789MB primary ntfs 3 830MB 454GB 453GB primary ntfs boot 4 460GB 500GB 40.5GB extended 5 460GB 494GB 34.2GB logical ext4 Model: ASMT 2105 (scsi) Disk /dev/sdb: 1000GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags – errolflynn Jun 17 '15 at 23:58
  • That's messy. I have no rep, so I can't post a screen shot. There are 5 partitions on the disk at /dev/sda of msdos partition table type. I only want to copy partition 5, which is contained within partition 4. The disk at /dev/sdb connected by USB is completely empty sans an msdos partition table. – errolflynn Jun 18 '15 at 0:03
  • To clone only 1 partition, I would use gparted. That is a Linux GUI tool. You'll need to manually create the target partition on the new disk. – JohnP Nov 22 '17 at 2:40

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.