32-bit Limits in 'dd' Utility (QNX 6.3.2)

I’ve bumped up against an issue in using ‘dd’ to capture an image from a 4 gigabyte Compact Flash to hard drive. This is needed to allow production reproduction of a QNX “base loaded” CF onto which a customer application is installed. This has been our approach with 128M, 256M, 512M, 1024M, and 2048M CFs, as the availability of the smaller devices has been eliminated.

What I’m doing is:

dd if=/dev/hd1 of=/cf_tools/IMAGES/base_cf4.image

It captures a ‘base_cf4.image’ file 2,147,483,647 (‘7FFFFFF’ hex) bytes long, and stops. Error message indicates “Value too large to be stored in datatype”.

Is there a fixed version of ‘dd’? A workaround? Some other utility that would provide a similar functionality?


The bug is not with dd but 2G is the maximum file size supported by the QNX4 fs. 6.4.0 has a new filesystem that doesn’t have that limitation!

You could try something like: cat /dev/hd1 | gzip -9 >base_cf4.image. That should work if the destination file is smaller then 4Gig. You could also try bzip2 which is slower but has better compression ratio then gzip.

Personally that is not how we setup storage devices, the reason is that the device must be EXACTLY the same size or you could run into all sort of problem. Instead I use a scripts that will setup the device (fdisk/dinit) and copy all the required files. It’s also MUCH faster because flash disk a much slower then HD and when writing 4Gig can take a long time, which a waste if you only have 50Megs of files ( that my case ).

Jmass has ask for the script I use, for the benefit of everybody here is the revalent part of the script:

print “creating partition /dev/$(DISK)”

clear the partition table

dd if=/dev/zero of=/dev/$(DISK) count=10
/sbin/fdisk /dev/$(DISK) delete -a

#create 3 partition
/sbin/fdisk /dev/$(DISK) add -s1 -t79 -p 15 -b
/sbin/fdisk /dev/$(DISK) add -s2 -t78 -p 20
/sbin/fdisk /dev/$(DISK) add -s3 -t77
/sbin/fdisk /dev/$(DISK) loader
print “mounting partition /dev/$(DISK)t79”
/bin/mount -e /dev/$(DISK)

print “Initialising filesystem”

for QNX6

on -w /dev/$(DISK)t79 -W 30 /sbin/dinit -qh /dev/$(DISK)t79

for firmware

on -w /dev/$(DISK)t78 -W 30 /sbin/dinit -qh /dev/$(DISK)t78

for database

on -w /dev/$(DISK)t77 -W 30 /sbin/dinit -qh /dev/$(DISK)t77
print “mouting /fs/$(DISK)”

on /bin/mount -t qnx4 /dev/$(DISK)t79 /fs/$(DISK).OS
on /bin/mount -t qnx4 /dev/$(DISK)t78 /fs/$(DISK).FIRMWARE
on /bin/mount -t qnx4 /dev/$(DISK)t77 /fs/$(DISK).DATABASE

print “starting copy…”
cp … /fs/$(DISK).OS/
cp … /fs/$(DISK).FIRWMWARE/
cp … /fs/$(DISK).DATABASE/

Thanks a lot mario, some of this will sure also go into my scripts :slight_smile:

Thanks Mario!