A
A
Andrew2016-10-22 19:13:41
linux
Andrew, 2016-10-22 19:13:41

How to copy a larger drive to a smaller drive?

There are two drives 128G and 16G. There are two partitions on the disk - boot and data.
How to move one disk to another?
I tried
dd if=/dev/sdBIG of=/dev/sdSMALL bs=64K conv=noerror,sync
But the system, after copying and loading, swears at the corrupted second partition and requires me to fix everything.
# e2fsck -fy /dev/mmcblk0p2
e2fsck 1.43.3 (04-Sep-2016)
The filesystem size (according to the superblock) is 27563520 blocks
The physical size of the device is 845824 blocks
Either the superblock or the partition table is likely to be corrupt!
abortion? yes
if the answer is no then it requires confirmation for each block
Error reading block 1048608 (Invalid argument) while getting next inode from scan. Ignore error? yes
Force rewrite? yes
Error reading block 1048609 (Invalid argument) while getting next inode from scan. Ignore error? yes
Force rewrite? yes
... I
try to resize - it doesn't
work resize2fs -f /dev/mmcblk0p2 845824
resize2fs 1.43.3 (04-Sep-2016)
Resizing the filesystem on /dev/mmcblk0p2 to 845824 (4k) blocks.
resize2fs: Can't read a block bitmap while trying to resize /dev/mmcblk0p2
Please run 'e2fsck -fy /dev/mmcblk0p2' to fix the filesystem
after the aborted resize operation.
What to do?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
1
15432, 2016-10-22
@15432

Acronis True Image can do this for sure (if the partition structure allows)
. target disk is smaller

X
xotkot, 2016-10-23
@xotkot

I tried
dd if=/dev/sdBIG of=/dev/sdSMALL bs=64K conv=noerror,sync
But the system, after copying and loading, swears at the corrupted second partition and requires me to fix everything.

dd copies the entire disk byte by byte and naturally will swear that it cannot fit 128G into 16G.
dd just stupidly transferred the initial 16G from a 128GB disk (sdBIG) to 16G (sdSMALL), so not only will your second partition be damaged (as I understand the first partition is less than 16G), but the data on it will also be damaged.
If the resulting partition is smaller than the original one, then it is better to use rsync instead of dd.
At the beginning, on sdSMALL, create the necessary partitions, taking into account that all the transferred data will fit there. Then you can transfer data from the live system or by mounting the desired partition:
--exclude - folders that are excluded during transfer
As I understand the first section is your root, if so, then the transfer from the live system will look something like this:
and finally, it’s unforgettable to make the root (first) partition bootable and, if necessary, correct the bootloader and fstab

G
GermSerg, 2016-10-22
@GermSerg

Specify - what size are the partitions on a large disk, and what exactly are you trying to transfer? THE ENTIRE disk is 128GB by 16 G? Or do you need to transfer a SECTION from one disk to another? In general, specify)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question