[Gllug] Splitting files at 2GB barrier
Christian Smith
csmith at thewrongchristian.org.uk
Mon Jan 29 14:09:48 UTC 2007
Late to the party, but...
Richard Cottrill uttered:
> Hi guys,
>
> I'm trying to backup a disk image to a device that cuts files at 2GB. In
> this case I've booted to a Live CD, so /dev/hda is not mounted. My first try
> was:
>
> for i in 1 2 3 4 5 6 7 8 9 ; do
> gzip --best | dd of=<mounted smb share>/image.part${i}.gz obs=1000000
> count=2000 ;
> done < cat /dev/hda
Have a look at split(1). It can split stdin (or a named file) into fixed
size chunks, with a generated naming scheme such that the files will
naturally sort lexicraphically(sp?).
Example:
# dd if=/dev/hda bs=1M | gzip --best | split -b 2048m /smbshare/hda.image.
Will split /dev/hda into files of the form:
/smbshare/hda.image.aa
/smbshare/hda.image.ab
/smbshare/hda.image.ac
... etc.
These files can then be simply cat'ed together (reasoable use of cat:) and
uncompressed to form the original disk image. You may be able to use zcat
with multiple files directly, but I'm not sure.
# cat /smbshare/hda.image.* | zcat | dd of=/dev/hda bs=1M
>
> Then re-imaging:
>
> zcat =<mounted smb share>/image.part1.gz <mounted smb share>/image.part2.gz
> ... (depending on the number of non-empty gz files) | dd of=/dev/hda
>
> cat seemed to be essential... I know it's not good form. In general though,
> this didn't work. Aside from creating a number of junk/pseudo-empty files
> when it runs out of data, the image doesn't seem consistent. In addition, it
> seems to cut the files at 1GB, rather than 2GB (I could just fiddle the
> numbers - but it's odd). Please lets not argue about MiB vs. MB...
>
> There are plenty of problems here, and I'm hoping that this can turn into on
> of those handy discussions on shell scripting that make Google so handy :)
> In addition, if I can figure out how to backup whole disk images to my Slug
> (the otherwise handy device in question) then I'd be very appreciative.
Try an updated firmware, this may have been fixed.
>
> I looked at GNU tar's tape splitting options, but I couldn't figure out how
> to get it to accept all the options needed at once (I may very well be
> stupid).
Just pipe the output of tar to split, replacing the dd/gzip example above.
>
> Thanks,
>
> Richard
>
--
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST MS ATTACHMENTS
/ \
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list