1

I am trying to move elementary OS from primary HDD to external HDD. So, I can boot elementary OS from external HDD and install Windows 10 on primary HDD.

Hewbot on super user stackexchange suggested me to use this command:

$ dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync

However, after a quite long time of copying the command fails. Saying no space left. I guess its like cloning the disk to another disk even the free space.

My Primary HDD is larger and external HDD is smaller but the data is very less on Primary HDD.

Sda

enter image description here

2 Answers2

-1

dd just copies its input to its output. If the input is a disk image, the output is a disk image of the same size. You can't copy a disk to a smaller disk. Instead, you need to create smaller partitions on the target disk, create smaller filesystems on those partitions, and copy the files.

Here the simplest method would be to shrink the /home filesystem, then shrink the partition that contains it, so that everything you want to copy fits within the target disk. I think GParted can do that. If it can't, or if you prefer a command line solution, first run resize2fs to shrink the filesystem on /dev/sda3 (it must be unmounted), then shrink the partition /dev/sda3 with parted or fdisk. Be very careful when resizing the partition: if you accidentally make it smaller than the filesystem, the filesystem is likely to become unusable.

Once all the partitions fit in the size of the target disk, you can do a straight copy (cat /dev/sda >/dev/sdb — don't use dd, it's slower and error-prone).

-2

Your command is trying to copy the entire disk (if=/dev/sdX) to the external drive. I would guess that your Linux install is on a separate partition from your Windows installation. Therefore you need to specify that partition. For example if=/dev/sda1. You likely do not need to specify a partition for your external disk so of=/dev/sdY should be ok.

To find out the partition you can boot to your Linux OS and df -h or (as root) fdisk -l will give you partition information.

JohnK
  • 51
  • no I don't have windows installed. I will install that later. Right now I have only Elementary OS installed on sda and I want sda cloned to sdc(external hdd of smaller size). Its very tough to clone to a smaller hard drive. Primary is 500GB and external is 220GB. However i have 16 GB filled space in primary – abhimanyuaryan May 06 '16 at 20:42
  • Copying one partition to the disk is a bad idea. It means you can't install a bootloader on the target disk, for example. The partition should be cloned to a partition. – Gilles 'SO- stop being evil' May 07 '16 at 18:33
  • @Gilles I cloned it didn't copied with dd command. I used clone zilla – abhimanyuaryan May 07 '16 at 18:39