DD 4G size files

Posted on 2007-09-28
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 45

    Assisted Solution

    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,
    LVL 7

    Assisted Solution

    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

    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?

    Author Comment

    Any comments?
    LVL 16

    Accepted Solution


    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

    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

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
    Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    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.:

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now