[BusyBox] another bb dd problem!

Glenn McGrath bug1 at optushome.com.au
Sun Sep 10 09:51:17 UTC 2000


robotti at metconnect.com wrote:
> 
> dd if=/dev/zero of=image bs=1M count=10
> 
> mke2fs -F image
> 
> ext2resize image 5m
> 
> You can do this with the gnu dd to reduce
> the 10m image to 5m, but the bb dd doesn't
> do anything.
> 
> dd if=/dev/zero of=image bs=1M seek=5 count=0
> 


It looks like GNU dd truncates the file at the end of its write.

Whats an easy way to truncate a file in c at a specific spot without
lossing earlier data?

It could be done by copying it to a new file, but there is no point
doing that in code it can be done with
dd if=image of=newimage bs=1M count=5. This would be ugly anyway cause
you would need the extra filespace to shrink the file.

Maybe im overlooking something simple, can anyone help me out ?

I might just put a note in the code a leave it for a rainy day.


Glenn





More information about the busybox mailing list