0

How can I dd a partition while keeping its device structure?

Source device:

[root@cal-7-3 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 37.3G  0 disk 
└─sda1   8:1    0 1000M  0 part /

Expected output when mounting image:

loop0                      7:3    0     1G  0 loop  
└─loop0p1 (dm-3)         253:3    0     1G  0 part  /temp

If if=/dev/sda the image is too large (37.5G).

If if=/dev/sda1 the structure is lost.

1 Answer 1

0
[root@cal-7-3 ~]# sudo sfdisk -luS /dev/sda
   Device  Boot  Start      End  #sectors  Id  System
/dev/sda1     *   2048  2050047   2048000  83  Linux

dd up to the last sector, rounded up for simplicity.

dd if=/dev/sda bs=512 count=2100000 | gzip | ssh 192.168.1.254 'gzip -d | dd of=/root/my-image'

Source: http://ubuntuforums.org/showthread.php?t=1840320#post_11234165

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .