Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bootable USB. It runs Linux. The size of USB pen is 8Gb, and linux partitions take less than 200Mb.

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *240.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS ZigguratSSD             238.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.1 GB     disk2
   1:                      Linux                         16.4 MB    disk2s1
   2:                      Linux                         98.7 MB    disk2s2

I would like to make a backup image of this pen.

$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
$ sudo dd of=bckup.img if=/dev/disk2 bs=512
15769600+0 records in
15769600+0 records out
8074035200 bytes transferred in 1132.003040 secs (7132521 bytes/sec)

This way I get 8Gb backup file. Is there a way to reduce size of the image?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Compress the image as a .zip or .tar. Alternatively, if you use OS X's disk utilities to image it as a .dmg, that format includes compression.


If you're wanting to image just the partitions (and not raw, unpartitioned space at the end of the drive), then you might be able to simply limit how much dd copies by using the count parameter. Look at the end sector for the 2nd partition, and use bs=<sector size> and count=<end sector>

share|improve this answer
    
Captain Obvious :) –  Antonio May 7 '13 at 18:41
    
I'm looking for a way to truncate unneeded data. –  Antonio May 7 '13 at 18:41
1  
If the partitions are located at the front of the disk and the remainder of the disk is raw, unformatted, unpartitioned space, you might be able to simply limit how much dd copies by using the count parameter. Look at the end sector for the 2nd partition, and use bs=<sector size> and count=<end sector> –  Darth Android May 7 '13 at 19:24
    
Here is the command that worked for me: $ sudo dd of=bckup.img if=/dev/disk2 bs=512 count=248320. @Darth Android, Could you please send this a separate answer? I'd like to grant it to you. –  Antonio May 8 '13 at 8:35
    
@Antonio I just added it to this answer. –  Darth Android May 8 '13 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.