gpart restore is different to gpart backup

Chris Whitehouse cwhiteh at onetel.com
Tue Feb 4 17:48:31 UTC 2014


Hi,

I have two disks, one with a Windows 7 installation which includes a 
recovery partition. I saved the recovery partition with Clonezilla and 
then attempted to duplicate the partition scheme with gpart backup and 
restore.

The original Win7 disk is 160gb, the replacement is 120gb.

Booting from FreeBSD 10 usb flash drive I did

# gpart backup ada0 > /mnt/gpart_backup_ada0.txt

Next I created gpart_restore_ada0.txt from gpart_backup_ada0.txt with 
the size of the last partition reduced to allow for the size difference 
between the disks.

I swapped disks and did the following

Script started on Tue Feb  4 17:03:38 2014
root@:~ # gpart show ada0
gpart: No such geom: ada0.
root@:~ # cat /mnt/gpart_show_ada0.txt  ## this is the Win7 setup.
=>       63  312581745  ada0  MBR  (149G)
          63       1985        - free -  (993K)
        2048   25165824     1  !39  (12G)
    25167872     204800     2  ntfs  [active]  (100M)
    25372672  287205376     3  ntfs  (137G)
   312578048       3760        - free -  (1.8M)

root@:~ # cat /mnt/gpart_restore_ada0.txt
MBR 4
1  !39      2048  25165824
2 ntfs  25167872    204800   [active]
3 ntfs  25372672 209068913
root@:~ # gpart restore ada0 < /mnt/gpart_restore_ada0.txt
root@:~ # gpart show ada0              ## this is the restored setup.
=>       63  234441585  ada0  MBR  (112G)
          63       2016        - free -  (1.0M)
        2079   25165791     1  !39  (12G)
    25167870         63        - free -  (32K)
    25167933     204687     2  ntfs  [active]  (100M)
    25372620         63        - free -  (32K)
    25372683  209068902     3  ntfs  (100G)
   234441585         63        - free -  (32K)

root@:~ # exit

Script done on Tue Feb  4 17:04:39 2014

This is the backup file from the Win7 disk.
chrisw at chaos:~ % cat mnt/gpart_backup_ada0.txt
MBR 4
1  !39      2048  25165824
2 ntfs  25167872    204800   [active]
3 ntfs  25372672 287205376

The resulting partition scheme has the partitions in different locations 
and different sizes. Why is this? How do I recreate the partition scheme 
with the same size and locations except for the last partition being 
smaller?

There's a further issue that on trying to restore Clonezilla thinks the 
12G partition is 2885MB.

Thanks for any insight.

Chris



More information about the freebsd-questions mailing list