1

Is it possible to clone an OS disk with all its partitions into a smaller disk.

The original disk has a lot of free space and the total used space is much smaller than the capacity of the new disk I am trying to create.

I want to do this without tinkering with the original hard disk

  • what you mean has a lot of free space? unpartitioned one? – Serge Jun 3 '16 at 2:34
  • I mean the largest partition has lots of free space – a curious engineer Jun 3 '16 at 2:43
  • You are looking for "Ghost" utility of windows. symantec.com/products/theme/ghost?id=ghost – SHW Jun 3 '16 at 6:31
  • Unlike windows (which can fail to boot if certain system files are moved around), linux does not care at all where ANY of the files on the disk are located. cp, rsync, tar, and many other commands can be used to copy a filesystem from one partition to another. If you want the disk to be bootable, you'll have to run grub-install. – cas Jun 4 '16 at 4:22
0

You could partition your new disk drive to make enough room for files for each source partition you have. Then boot into single user mode and copy files with tar from original partitions to their 'mirrors' one by one:

cd /source/mount/point; tar --one-file-system cf -|tar -C /mirror/mount/point xf -

add --acls, --selinux and/or --xattrs options to the 'archiving' tar in the command pipe if appropriate. You would need also to set up a boot loader on your new drive and adjust /etc/fstab file to match labels/uuids/device names

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.