[Gllug] Splitting files at 2GB barrier
Chris Jones
cmsj at tenshu.net
Fri Jan 26 15:08:55 UTC 2007
Hi
Richard Cottrill wrote:
> 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
tbh I'd skip the gzipping, if only because it makes this much easier on
the eye:
for i in $(seq 0 9) ; do
dd if=test.bin of=out${i}.bin bs=1MB skip=${i} count=1
done
(perhaps doing of=- and then piping it into "gzip --best
>out${i}.bin.gz" if you really want to do the compression)
things to note here:
* I set bs to 1MB (1000x1000 in dd) where you want 2GB
* the loop must start at 0 rather than 1 so skip= works
then to restore it you'd just do:
for i in $(seq 0 9) ; do
cat out${i}.bin >>restore.bin
done
I'm wondering if you could get away with:
cd /mnt/smb ; split --bytes=2000000000 /dev/hda out
but I'm not sure if split is safe on binary files and I trust dd :)
Cheers,
--
Chris Jones
cmsj at tenshu.net
www.tenshu.net
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list