dd is an utility which is primarily used for low-level copying of data from storage devices.

learn more… | top users | synonyms

47
votes
7answers
6k views

dd vs cat — is dd still relevant these days?

I recently realized we can use cat as much as dd, and it's actually faster than dd I know that dd was useful in dealing with tapes where block size actually mattered in correctness, not just ...
38
votes
8answers
17k views

dd: How do I know if it's still working?

I've not used dd all that much, but so far it's not failed me yet. Right now, I've had a dd going for over 12 hours - I'm writing an image back to the disk it came from - and I'm getting a little ...
24
votes
4answers
7k views

Is there a way to determine the optimal value for the bs parameter to dd?

On occasion I've seen comments online along the lines of "make sure you set 'bs=' because the default value will take too long," and my own extremely-unscientific experiences of, "well that seemed to ...
21
votes
4answers
1k views

What's the difference between these two dd commands?

What's the difference between two dd commands that have different bs and count values, as long as they multiply to the same? For example: dd if=/dev/random of=aa bs=1G count=2 dd if=/dev/random ...
20
votes
5answers
12k views

Best way to remove bytes from the start of a file?

Today I had to remove the first 1131 bytes from an 800MB mixed text / binary file, a filtered subversion dump I'm hacking for a new repository. What's the best way to do this? To start with I tried ...
18
votes
2answers
3k views

When is dd suitable for copying data? (or, when are read() and write() partial)

Short version: In what circumstances is dd safe to use for copying data, safe meaning that there is no risk of corruption due to a partial read or write? Long version — preamble: dd is often used to ...
17
votes
3answers
3k views

Why does dd from /dev/random give different file sizes?

I am running the following command on an ubuntu system: dd if=/dev/random of=rand bs=1K count=2 However, every time I run it, I end up with a file of a different size. Why is this? How can I ...
16
votes
3answers
1k views

How can you trim files using the command line?

What is the console equivalent of the following Python code: target = file("disk", "w") # create a file target.seek(2*1024*1024*1024) # skip to 2 GB target.write("\0") target.close() Maybe some ...
16
votes
4answers
5k views

Clone whole partition or hard drive to a sparse file

I like to clone a whole partition or a whole hard drive onto a larger external disk but like to create a sparse file. I often use dd for cloning, but it doesn't support sparse files. As a workaround I ...
14
votes
4answers
4k views

What does dd stand for?

I know very well what the command does, but man dd, info dd tell me: 'Convert and copy a file', as does GNU Coreutils. Google says its an abbreviation of everything between medicine and bad webchat ...
12
votes
3answers
11k views

Is it possible to mount a gzip compressed dd image on the fly?

I like create an image backup for the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the ...
10
votes
3answers
738 views

saving data from a failing drive

An external 3½" HDD seems to be in danger of failing — it's making ticking sounds when idle. I've acquired a replacement drive, and want to know the best strategy to get the data off of the dubious ...
10
votes
3answers
350 views

Read the middle of a large file

I have a 1 TB file. I would like to read from byte 12345678901 to byte 19876543212 and put that on standard output on a machine with 100 MB RAM. I can easily write a perl script that does this. ...
8
votes
1answer
13k views

How do I mount an `img` created with /bin/dd of a hard drive?

I used dd to backup a 80GB drive dd if=/dev/sdb of=~/sdb.img Now I need to access some files on that drive, but I don't want to copy the ".img" back over the drive. mount ~/sdb.img /mnt/sdb ...
8
votes
1answer
179 views

How to re-size partitions in a complete hard drive image?

I have taken a complete image of a hard drive using: dd if=/dev/sda of=/home/user/harddriveimg bs=4M It would seem to me, that I should be able to re-size the partitions within it after suitably ...
7
votes
4answers
257 views

Protecting Devices from dd and fdisk Commands

I'm wondering if there is some way to prevent certain certain devices from becoming the output file of the dd command and the target of the fdisk command. I'm currently using the two operations to set ...
7
votes
3answers
995 views

Create a Random ISO Image Using dd

I would like to create a ISO file for testing optical drives with the method mentioned here. I want to create an ISO file filled with random data, so I can burn it to a CD, read it back and compare ...
7
votes
2answers
2k views

Create file image container

I would like to create a 100GB file to use as a file-system. The file will be stored on an encrypted volume, so the file/file-system itself does not need to be (further) encrypted. Searching has ...
6
votes
4answers
396 views

'seek' argument in command dd

Can some explain me what is happening in the following lines? dd if=/dev/urandom bs=4096 seek=7 count=2 of=file_with_holes especially seek part is not clear Man pages says : seek=BLOCKS ...
6
votes
1answer
2k views

dd: writing '/dev/null': No space left on device

I am reading a 550MB file into /dev/null and I am getting dd: writing '/dev/null': No space left on device I was surprised. I thought /dev/null is a black hole where you can send as much as you ...
6
votes
2answers
3k views

Use `dd` to cut file end part

There is probably simple trick to do this, but I can't figure from man page. How do I cut last 1MB from file with undetermined size for example, by using dd?
6
votes
2answers
5k views

gzip - redirection or piping?

I will be backing up a large (750GB) disk to an external USB disk using dd. Should I be using redirection or piping? Which is more efficient? Or is there a difference? Also, what is the best block ...
6
votes
2answers
542 views

Why did dd create a different uuid?

root@debian:/home/tiger# dd if=/dev/sda of=/dev/sdb bs=10240k 11447+1 records in 11447+1 records out 120034123776 bytes (120 GB) copied, 4729.59 s, 25.4 MB/s root@debian:/home/tiger# blkid ...
5
votes
2answers
2k views

Unpack files and directories from an image created by dd?

I created an image of an NTFS partition using dd. I wonder if I can unload/unpack the files and directories in the image to any partition whose size is larger than the image size, so that I can ...
5
votes
3answers
4k views

How can I make a bootable usb flashdrive?

Can I just dd an Ubuntu 11.04 mini.iso to an usb flashdrive an boot from it? or what am I missing?
5
votes
5answers
4k views

How do I suppress dd output?

I have a bash script that creates some file using dd. The problem is dd throws a great amount of output that is going to mess with the output of my script. Searching around I've found a solution: dd ...
5
votes
1answer
66 views

Writing raw images safely to USB sticks

Trying lots of different linux, on all kinds of hardware I find my self typing commands like this quite often: sudo dd if=xubuntu-13.10-desktop-amd64.iso of=/dev/sdc bs=10240 Needless to say, ...
5
votes
1answer
103 views

Deploying filesystem images onto a partition of arbitrary size

I would like to establish a deployment process for Ubuntu machines based on root FS images. I would like to restore the image onto a simply-formatted hard drive (I can completely erase the disk during ...
5
votes
1answer
1k views

Are there alternatives for `dd`?

What other tools should I use to read and write files with truncation, seeking and skipping. dd's command line options seem inconvenient and foreign and I don't like choosing between slow, but precise ...
5
votes
2answers
559 views

Linux/GParted can see partition table but dd bs=512 count=1 can't

I have an MBR formatted sd card and when connect to a Linux machine (xubuntu 12.04) it can mount a partition and parse the file system (as can GParted). However, when I try to read the MBR from the ...
5
votes
2answers
1k views

Red Hat cannot boot after clone with dd

I used dd to clone a x4100 server with Linux Red Hat. The hardware is identical for old and new servers. Disks are sda, sdb and sdc(sdc1 and sdc2). But newly restored server gives following errors and ...
5
votes
1answer
75 views

Partitions same size but different block

I tried to backup my partition using dd on another disk and I created a partition of the same size. When I finished the copy I had problems mounting the partition since I got bad geometry: block ...
4
votes
2answers
3k views

How to check progress when cloning a disk using `dd`? [duplicate]

Possible Duplicate: dd: How do I know if it's still working? I'm using dd to clone a disk to an image file, and compress it on the fly: dd if=/dev/sda | gzip > /mnt/image_file How ...
4
votes
1answer
2k views

What's faster, dd 1.5TB or rsync 500GB?

I need to save data from a failing hard drive. Sounds like ddrescue or myrescue (or maybe clonezilla?) will be my best friends here, but I'm just wondering what will likely be faster: using ...
4
votes
1answer
96 views

Error(?) in output of the dd command

When I run the following command: dd if=/dev/sda of=output bs=512 count=1 In the middle of the output, I see this text: GRUB ^@Geom^@Hard Disk^@Read^@ Error^M What does it mean?
4
votes
2answers
302 views

How to take sha-1, sha-256 or MD5 of CDs / DVDs?

I just tried burning both a Debian CD and a Debian DVD from their .iso files and I've got a weird behavior: the checksum of the CD is correct but the one of the DVD ain't. Here's what working: ...
4
votes
1answer
999 views

How do I create a USB image with a partition table?

I want to create an image of some directory tree that is writable directly to an USB drive, just like the images of many linux distributions. For example, with openSUSE you can download an ISO image ...
4
votes
2answers
513 views

Help with unzipping a .dd.gz, possibly corrupted

I recieved this file that I was told was a copy of a hard drive (or disk). The file is "sheeva-mem.dd.gz". I tried to unzip the file in a linux Fedora machine. This yielded "unexpected end of file". ...
4
votes
1answer
30 views

Backup of a ubi file system with dd?

A have a root file system (file system - image containinf folder structure and content) on a flash drive. The flash drive uses UBI as the underlying file system file system - the way the data blocks ...
4
votes
2answers
2k views

Benchmark ssd on linux: How to measure the same things as crystaldiskmark does in windows

I want to benchmark a ssd (possibly with encrypted filesystems) and compare it to benchmarks done by crystaldiskmark on windows. So how can I measure approximately the same things as ...
4
votes
1answer
208 views

Why can't I simply dd an installation iso to a bootable partition on an USB flash drive?

I have a copy of the Slackware 64 bit dvd installation iso. I've burned this image to a dvd and used it to properly install the distro. I wanted to try also having this image available on a usb flash ...
3
votes
2answers
493 views

How to write file into another

I have an empty file (only zeroes are in it) of size 9,0KB and I need to write another file (with size 1,1KB) to it, but the first file must not lose its size or the rest of its contents. So if the ...
3
votes
2answers
664 views

If I dd a CDROM, then I always get the exact copy of the CDROM?

If I: dd if=/dev/cdrom of=cdrom.iso then I will always get the exact same, bit-by-bitly same image that is the same as the original CDROM? Or are there any methods that prevents copying all the ...
3
votes
2answers
1k views

Sending the output from 'dd' to awk/sed/grep

I'm trying to approximate the computer's write speed using dd: dd if=/dev/urandom of=/dev/null bs=1K count=10000 which gives the following output 10000+0 records in 10000+0 records out 10240000 ...
3
votes
5answers
998 views

How to write repeated free-form strings to a file, as fast as 'dd'?

dd can write repeating \0 bytes to a file very fast, but it can't write repeating arbitary strings. Is there a bash-shell method to write repeating arbitary strings equally as fast as 'dd' (including ...
3
votes
2answers
3k views

Why can't I copy my DVD with dd?

I tried dd, dd_rescue and ddrescue, all failed. I thought these tools bypass the filesystem and make a bitwise copy. dd is fooled, it finishes but just produces a small file and states it's finished. ...
3
votes
2answers
74 views

Create random data with dd and get “partial read warning”. Is the data after the warning now really random?

I create a 1TB file with random data with dd if=/dev/urandom of=file bs=1M count=1000000. Now I check with kill -SIGUSR1 <PID> the progress and get the following: 691581+0 Datensätze ein ...
3
votes
3answers
1k views

Force dd not to cache or not to read from cache

I'm working on an embedded system with the busybox version of dd. I'm trying to test an erase to the drive from some outside utility, however dd does not read from the disc again after the erase, but ...
3
votes
1answer
169 views

How to enlarge existing file to specific size

I have hdd.img file, which I user as HDD for my virtual machine, but it's size is too small, how can I enlarge it? There is one method, something like: dd if=/dev/zero ds=10GB count=8 >> ...
3
votes
3answers
326 views

Some basic questions about dd

I'm working on a system of how to back up partitions using dd and have been reading a lot about it. I have a few questions and assumptions that I would like to ask. These may seem a little noob-ish, ...