Clone single partition to empty disk

338

Solution 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.

Solution 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

Share:
338

Related videos on Youtube

Jeevan Reddy G
Author by

Jeevan Reddy G

Updated on September 18, 2022

Comments

  • Jeevan Reddy G
    Jeevan Reddy G over 1 year

    I have a model where it contains field, title, and order index. I would like to load the columns based on the order index in the kendo grid (not in the sequence of the array). Data and fields are added dynamically.

    fields: [{field:"ProductName", Title: "Product Name", orderIndex: 0}, {field:"Amount", Title: "Amount", orderIndex: 1}]

    Data: [{ "ProductName":"Laptop-1", "Amount": 1000 }, { "ProductName":"Laptop-2", "Amount": 1500 }]

    Using <kendo-grid-column *ngFor="let column of columns" [field]="column.field" [title]="column.title"> and (columnReorder)="columnReorder($event)"

    I have tried the columnReorder event but not working as expected. Is there any way to show columns based on orderIdex?

    • Byte Commander
      Byte Commander almost 9 years
      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.
    • errolflynn
      errolflynn almost 9 years
      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
    errolflynn almost 9 years
    Would /dev/sdc1 or /media/usb be the mount point?
  • ALAN WARD
    ALAN WARD almost 9 years
    /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.
  • Byte Commander
    Byte Commander almost 9 years
    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
  • errolflynn
    errolflynn almost 9 years
    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
    errolflynn almost 9 years
    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.
  • JohnP
    JohnP over 6 years
    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.