DD 4G size files

Posted on 2007-09-28
Medium Priority
Last Modified: 2013-12-27
I am trying to dd a drive tha is 73GB to a fat32 external USB drive. Unfortunately, I am forced to use fat32 and must split the image files into <4GB files. Can you provide syntax on creating the drive image files and also for combining them into a single file that willl be placed on an ext3 partition later?
I know there are other options such flash archive, etc, but I'm limited to using a single usb drive for making the transfer of the dd image from the usb drive to another system. The file needs to be a single dd file on the other system.
On Sun system with FAT32 USB drive mounted:
dd if=/dev/rdsk/c0t0d0s2 of=/mnt/usb/imagefile.dd bs=4096

On separate system with ext3 filesystem, I want to combine the file:
cat /mnt/usb/imagefile.dd.* | dd of=/mnt/usb/imagefile-combined.dd

Question by:finallydidit99
LVL 46

Assisted Solution

by:Kent Olsen
Kent Olsen earned 75 total points
ID: 19981504
Hi finallydidit99,

You can use the unix/linux split command and then just copy the files to the device.

  split -b 2000 m myfile.txt newfile

copy newfile* /dev/{name}

You can later recreate the file copy cat-ing them together on the new device.

Good Luck,

Assisted Solution

mzalfres earned 105 total points
ID: 19981529
Best it would be to have some space to make 'initial' dd and compress it on the fly like this:

dd if=/dev/some_device | gzip > image.tgz

then you could use 'split' tool to do your job.

If it is not possible, then run dd with count option, then you need to count blocks you can handle at once. Usually - 1 block is 512B, but in your example 1 block = 4kB so make it apriopriate to your need.

The command will be like this:

dd if=/dev/some_device of=your_file count=number_of_block bs=block_size

You can also try to combine this with previous method, if you are able to predict the compression ratio for your data. But I'd rather not try :)

Author Comment

ID: 19981955
I think both of you have good ideas. I don't really understand how to keep track of the count number mzalfres. I think split does that automatically with the -d option.
Please help me with the syntax--

dd if=/dev/rdsk/c0t0d0s2 | split -d -b 4096m - of=/mnt/usb/imagefile.dd bs=4096
--this doesn't seem to work- i think there's something with the syntax

And then to put the files back together,
cat /mnt/usb/imagefile.dd.* | dd of=/mnt/usb/imagefile-combined.dd
I pulled the cat command from the internet somewhere, is the * the correct syntax?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 20009596
Any comments?
LVL 16

Accepted Solution

Hanno P.S. earned 195 total points
ID: 20019999

Copy three 2GB pieces (262144 blocks of 8KB):
# dd if=/dev/rdsk/c0t0d0s2 of=/mnt/usb/imagefile.01 bs=8k count=262144
# dd if=/dev/rdsk/c0t0d0s2 of=/mnt/usb/imagefile.02 bs=8k skip=262144 count=262144
# dd if=/dev/rdsk/c0t0d0s2 of=/mnt/usb/imagefile.03 bs=8k skip=524288 count=262144
If there are less than the requested number of blocks (262144), dd will stop earlier.

Recreate one piece of these parts:
# cat /mnt/usb/imagefile.0? > /mnt/usb/imagefile

Why do you want to use dd? Wouldn't it be more sutiable to use ufsdump or something like?

Author Comment

ID: 20037944
Thanks for the input. The final answer was a good solution  since it contained the syntax. I actually used different syntax, but thanks to everyone for your help.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question