Skip to content

Clone to smaller disk not working. #7

Open
@mkomarsr

Description

@mkomarsr

I'm running the latest clonepi (1.7.4) on the latest debian (10.0).

I narrowed part of the problem down to 'sed' not matching on the sfdisk output.

I made this change to move past that:
MBR=sfdisk -d $DEST_DISK
to
MBR=sfdisk -d $DEST_DISK|tr -s \

I don't have an old machine handy, but I suspect that the sfdisk output changed recently adding some spaces. Unsure if my approach was the best, but for testing purposes, it improved things.

What I'm running into now, is:
/dev/sda6: Start sector 204800 out of range.
Failed to add #6 partition: Numerical result out of range

Manually creating the same partition sizes results in a different starting sector.

My knowledge of file system partitioning leaves me short of a best solution here.

Any input is welcome. I'm happy to submit a PR but would like some input on what direction to go toward a resolution.

Thanks!

For reference:

root@tvpi:~# sfdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 59.5 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa8a452f2

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 137215 129024 63M e W95 FAT16 (LBA)
/dev/mmcblk0p2 137216 124735487 124598272 59.4G 5 Extended
/dev/mmcblk0p5 139264 204797 65534 32M 83 Linux
/dev/mmcblk0p6 204800 729085 524286 256M c W95 FAT32 (LBA)
/dev/mmcblk0p7 729088 124735487 124006400 59.1G 83 Linux

and

root@tvpi:~# sfdisk -l /dev/sda
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa8a452f2

Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 137215 129024 63M e W95 FAT16 (LBA)
/dev/sda2 137216 62333951 62196736 29.7G 5 Extended
/dev/sda5 139264 204799 65536 32M 83 Linux
/dev/sda6 206848 731135 524288 256M c W95 FAT32 (LBA)
/dev/sda7 733184 62333951 61600768 29.4G 83 Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions