Menu

#11 Problem restoring logical partitions on MSDOS partition table

v1.0_(example)
open
nobody
None
1
2019-07-30
2019-07-30
No

I'm creating a user friendly front end for partclone (effectively a replacement for redo which is now abandonware). Target audience - 'newbies' to linux who find clonezilla too intimidating/confusing.

Restore from image file to primary partitions on either GPT or MSDOS partition table drives ok, the problem is with logical partitions in an extended partition on an MSDOS drive. This problem has been found in testing.

Scenario:
MSDOS part table, 3 primary partitions, extended partition with 2 logical partitions. Win10 in sda1 and sda2, linux (root - ferens OS) in sda3, /home and swap in logical partitions, sda5 and sda6 in the extended partion (sda4). Partclone is being run from a separate drive (sdc) in a separate linux distro (linux mint 19.0).

Wipe sda4, 5, 6 using gparted and then restore from images. As part of the backup, my software copies the partition table using sfdisk and then uses sfdisk again to restore the partition table. When this is done it uses partclone to restore the partitions.

Restore command (using compression):
cat /media/Ultrabay/testmbr2/20190729.sda5.img.gz | unpigz -c | sudo partclone.ext4 -r -s - -O /dev/sda5
Partclone output:

Partclone v0.3.11 http://partclone.org
Starting to restore image (-) to device (/dev/sda5)
device (/dev/sda5) is mounted at 
error exit

sda5 is NOT mounted, my software checks to see if it is mounted and un-mounts it if necessary.

Add in the --force command to partclone:
cat /media/Ultrabay/testmbr2/20190729.sda5.img.gz | unpigz -c | sudo partclone.ext4 -r -F -s - -O /dev/sda5
Partclone output:

Partclone v0.3.11 http://partclone.org
Starting to restore image (-) to device (/dev/sda5)
Calculating bitmap... Please wait...
Target partition size(0 MB) is smaller than source(20972 MB). Use option -C to disable size checking(Dangerous).
done!
File system:  EXTFS
Device size:   21.0 GB = 5120000 Blocks
Space in use:   4.8 GB = 1183977 Blocks
Free Space:    16.1 GB = 3936023 Blocks
Block size:   4096 Byte

Outcome - the restore proceeds and completes successfully, but the partition is unmountable, linux (ferens) won't boot because it can't find /home. Checking the partition table AFTER restoring it with sfdisk but BEFORE running partclone:

sudo sfdisk --dump /dev/sda
label: dos
label-id: 0x74418ee4
device: /dev/sda
unit: sectors

/dev/sda1 : start=        2048, size=     1185792, type=7
/dev/sda2 : start=     1187840, size=   160487424, type=7
/dev/sda3 : start=   161675264, size=    40960000, type=83, bootable
/dev/sda4 : start=   202635264, size=   266242048, type=5
/dev/sda5 : start=   202637312, size=    40960000, type=83
/dev/sda6 : start=   243599360, size=    16384000, type=82

sda5 is NOT shown as zero length.

This can be fixed by re-running partclone, after the second restore everything works. No idea why?

I haven't tried the -C option to disable size checking but I'm not sure it would make any difference as I am already using the -F option.

I can fix it by getting my software to run partclone a second time if it detects an error. Not the ideal solution and I'd like to know why partclone is giving problems.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB