Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a question concerning the creation of an drive image with dd.

Normally i would simply type: "dd if=/dev/foo of=/dev/bar". But in this case i only have a fat32 formatted drive at hand, which should be used for the output. Fat32 only allows files up to 2GB (Or was that 4GB?). Anyway the image would be too big.

My question is, is it possible to create the image in a bunch of smaller files? And how would one restore the splitted image? I'm really not good at bash commands and would be happy for any suggestions. By the way, is there a good book concerning shell scripts, or are there some good tutorials you would recommend?

share|improve this question
    
Are you copying the image between two different-size drives? Smaller to larger or larger to smaller? It is not clear! –  Khaled Nov 24 '10 at 16:31
    
I can't copy it. I would like to shove the image with dd over "on the fly". My problem is, that i want to backup my an laptop hd to an external drive. Maybe the easiest solution would be to resize the external drive. But i fear the data loss. The external drive is 2TB without any backups... –  Darokthar Nov 24 '10 at 21:58
1  
I think i found the right commands thanks to google and the split hint from whitequark. It should be dd if=/dev/foo | gzip -9 | split -b 4000m > /mnt/bar I'll post tomorrow, if that worked. –  Darokthar Nov 24 '10 at 22:31

5 Answers 5

up vote 3 down vote accepted

how about

http://michi-bs.blogspot.com/2008/06/hdd-or-partition-backup-with-dd.html

# dd if=/dev/hda1 | gzip -c | split -b 2000m - /mnt/hdc1/backup.img.gz.
share|improve this answer

You cannot create a file greater than 4GiB (2^32-1 bytes) on FAT32 partition, period. So if you want to use that image file with some VM software, you are probably out of luck, as I known no VMs which can work around limitations of braindead filesystems.

But if you are just trying to store the image there temporarily, you can create it with dd by 4GiB chunks, or split an existing one with a command like this:

split -b 4095M /source/file /target/files

Note that I've used 4095M and not 4096M/4G, as the maximal size of file is one byte less.

This is a guide I learned bash with. (And manpages for everything other, of course. Bash manpage looks like it was deliberately obfuscated.)

share|improve this answer

Look into using the 'split' command to split the files. I'm not sure if you are writing directly to the device (dd if=/dev/foo of=/dev/bar) or writing to an image on a mounted filesystem.

share|improve this answer

My advice here would be to use gparted or similar partitioning or disk management software to resize the fat32 partition and create the space freed up as an ext2 or ntfs formatted partition. Get the best of both worlds.

share|improve this answer

If the drive is empty ... reformat that drive to ext3! Unless you have other plans, just my 2pence

share|improve this answer

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.