dd is a traditional utility for binary data copies

learn more… | top users | synonyms

28
votes
3answers
5k views
+250

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 ...
0
votes
1answer
16 views

How to image certain portions of hard drive only

I have a failed hard drive which I need to extract data from. My dd kung fu is failing me right now. I know that the drive is failing at sector 60515007 to 60517093 (512b per sector), and multiple ...
4
votes
4answers
326 views

How to fill a file with a stream from /dev/urandom with a specified number of lines ?

I am trying to fill a file with a sequence of random 0 and 1s with a user-defined number of lines and number of characters per line. the first step is to get a random stream of 0 and 1s: cat ...
17
votes
4answers
5k 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 ...
2
votes
4answers
1k views

Why is writing SLOW on raw device, and FAST on filesystem (USB key)?

I have a USB key (PQI U822V-Speedy 32G) that I am trying to benchmark quick'n'dirty on Linux. I'm testing write bandwith. dd on raw partition I created a partition starting at sector 2048, then did ...
6
votes
3answers
1k 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 ...
1
vote
1answer
31 views

How can I cross compile the dd linux tool for arm?

I need to cross-compile a full version of dd because my device only has a busybox one that doesn't support many options. Where do I get the source for it? I've been looking on the kernel repo online ...
8
votes
5answers
538 views

Why specify block size when copying devices of a finite size?

In online tutorials it is often suggested to use the following command to copy a CDROM to an iso image: $ dd if=/dev/dvd of=foobar.iso bs=2048 Why must the byte size be specified? I notice that in ...
0
votes
1answer
153 views

extract number of bytes out of a file

Is it possible to extract a few number of bytes out of a file using dd ? The file is located on a secondary drive. I apologize if this is a simple question however I'm no pro at command line.
1
vote
1answer
47 views

dd'ing SDD, decreasing write speed

My hard drive is a SanDisk SSD. The drive is new. I've booted into ArchLinux Live System, with the intention of preparing the hard drive for full disk encryption. I've noticed a significant drop of ...
2
votes
2answers
3k views

Copy MBR and boot partition to a smaller disk

I'm using a 32GB SD card for my raspberry pi. I have successfully transferred the operating system (Archlinux ARM) to a usb harddrive. Which means that I only need the boot partition on the SD card. ...
4
votes
2answers
95 views

How to delete part of a binary file without copying

I need to delete the first 2 bytes of a 6MB file. However, this is an embedded Linux with only 32 Mbytes RAM and less than 1 MB free flash memory. I tried using dd, as: 1 - # dd bs=1 skip=2 ...
30
votes
7answers
20k 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 ...
3
votes
0answers
39 views

Have I destroyed data on drive?

I stupidly ran the following command on an external ext4 USB disk, typing /dev/sdb instead of /dev/sda which was the new disk I was setting up: dd if=/dev/zero of=/dev/sda bs=512 count=100 These ...
4
votes
2answers
218 views

How to parallelize dd?

I'm currently having trouble with dd invoked with a sparse file as input (if) and a file as output (of) with conv=sparse. dd seems to be using one core of the CPU (Intel(R) Core(TM) i7-3632QM CPU @ ...
-1
votes
2answers
35 views

How to create a new partitioning table on SD card from the command line ? [closed]

I have tried to mount a SD card on Linux Mint, I have found the right device file and tried: mount -t vfat /dev/sdb /mnt/zauberportal ,but it failed and I tried some variations like different types of ...
1
vote
2answers
20 views

MBR and data on pendrive

I have a pendrive (/dev/sdd). I ran fdisk -l and that shows me the drive and its partitions. After that I did: dd if=/dev/zero of=/dev/sdd bs=512 count=1 I deleted the MBR (so the partitions ...
0
votes
2answers
29 views

Cloning a drive larger than your own

I made this nice backup system to turn drives into vdi's and put them on our network share. Then the next day my boss walks in with 20 new machines to replace our old ones, they have 2TB drives. How ...
1
vote
0answers
60 views

RedHat machine will not boot when video card is removed

I "inherited" RH 6.4 on a computer with an nVidia video card. I took the image and dd'd it to another computer that has the same hardware. By design, the second computer will be headless. This ...
0
votes
1answer
34 views

HD clone using LZ4 and DD fails

I've been cloning complete HDD images to restore OS crashes using DD and GZIP for a while now using dd if=/dev/sda | gzip > img.gz and gzip img.gz | dd of=/dev/sda This always working fine, but ...
3
votes
1answer
115 views

Why is dd so slow with a bs of 100M [closed]

I just tried to overwrite a fast ssd using dd. Using the ubuntu boot image I typed in: dd if=/dev/zero of=/dev/sda bs=100M error writing '/dev/sda': No space left on device blah blah 256 GB copied, ...
3
votes
3answers
3k 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 ...
60
votes
10answers
37k views

How do I know if dd is 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 ...
5
votes
2answers
344 views

dd writes to CF with delay

I have an old 64MB CF card which I use in my laptop(kernel 2.6.38) with CardBus adapter. If I write a 64MB image to this CF card, then the write speed is more than 200MB/s: T42 ~ # fdisk -lu Disk ...
2
votes
2answers
120 views

Multiple passes of wiping disk with `dd`

I want to use dd to overwrite a disk multiple times to destroy data beyond recovery. I know I could use dd if=/dev/zero/ of=/dev/sdx/ to do a pass with zeros, or dd if=/dev/null/ of=/dev/sdx/ to ...
1
vote
1answer
32 views

Can the BS option cause data inconsistency with dd?

I have a laptop partition (truecrypt) backed up with dd since it's impossible to back it up with anything else but do a raw bit by bit copy like: dd if=/dev/sda of=imagefile.img I can of course ...
3
votes
3answers
71 views

Resuming a DD of an entire disk

I'm overwriting my hard drive with random data using the good old dd: dd if=/dev/urandom of=/dev/disk/by-uuid/etc bs=512 It's a 2TB array and my MacBook (running Linux, ok?) can only write data at ...
12
votes
2answers
502 views

Why does dd from /dev/urandom stops early? [duplicate]

On my current linux system (debian jessie amd64), I am getting different behavior for dd using /dev/urandom (/dev/random behavior is properly documented). If I naively want 1G of random data: $ dd ...
7
votes
2answers
8k views

How to use SSH to make a dd copy of disk A from host B and save on disk B?

I want to make remote backups from disk A at will using SSH from computer B. I want to save the backups to disk B. How can I do this? I've tried using $ ssh hostname@my.ip.add.ress "sudo dd ...
3
votes
3answers
141 views

How to inspect the contents of /dev/sdt?

I have what I hope is not a huge problem, but could end up being a very large problem. For some context, I mistakenly ran this command on my 27'' iMac: sudo dd if=ubuntu-rescue.img of=/dev/sdt ...
24
votes
5answers
21k 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 ...
8
votes
2answers
6k 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 ...
3
votes
4answers
3k views

Fast Way to Randomize HD?

I've read about how to make hard drives secure for encryption, and one of the steps is to write random bits to the drive, in order to make the encrypted data indistinguishable from the rest of the ...
0
votes
0answers
40 views

Why dd reads from output device?

While dding a CentOS 7 x86_64 DVD image to a USB drive (sdb), I monitored the progress with iostat. It kept alternating between mostly writing to the USB drive: Device: tps kB_read/s ...
0
votes
1answer
63 views

What does “dd” stand for? [duplicate]

What does dd stand for? I've always referred to it colloquially as "Disk Destroyer", but what are the "official" words that make up the acronym/command? According to this link and this link it could ...
0
votes
1answer
87 views

Delete labelled partition non interactively with one command

I know about fdisk and parted, but I was not able to figure out an non interactive way to delete a labelled partition. I imagine something like <command> <action> /dev/disk/by-label/LABEL ...
1
vote
0answers
41 views

From a sparse file to a block device

I have a system image sparse file which actual size is only a few MBs but the "apparent size" is about 1GB. I'm trying to write it to a block device efficiently (without the holes). Here are some ...
3
votes
1answer
170 views

losetup /dev/loop0 disappears after some time

at the moment I do some tests with loop devices on Linux/Ubuntu. In a small test script I have the following commands: #!/bin/sh rm testfile.x dd if=/dev/zero of=testfile.x bs=1M count=1200 losetup ...
8
votes
3answers
144 views

How can `dd` be used to right-shift data blocks?

Consider a 100MB raw block device as a simple example. That is 204800 blocks of 512 bytes each for a total of 102760448 bytes. The challenge is to shift the first 98MB (200704 blocks) so there is a ...
1
vote
1answer
78 views

Can I use dd to quickly resilver a ZFS mirror disk?

My ZFS pool consists of two mirrored disks. I have two more disks which I plan to use for rotating offsite backups. The first backup disk was added to the zpool and has nearly completed resilvering. ...
0
votes
0answers
82 views

how to write dd command to replace backup image of root partition?

I have installed rhel6.5 in my pc. After that I have changed some configurations in file system. now I have taken backup image of /dev/sda1 which is a root partition of 15gb in size using the command ...
3
votes
0answers
55 views

Hard Drive reporting all 1's after parted

So I have a 3TB hard drive /dev/sdc that I am trying to create a partition on. Before this point, I had the issues described below, I transfered the drive to a Windows 7 computer and created a GPT on ...
1
vote
3answers
63 views

Software RAID10 setup writes small files extremely slowly, is this normal?

I have a software RAID-10 setup on Linux 3.16.6-203.fc20.x86_64, with 1.2 metadata and the default chunk size (512K): $ cat /proc/mdstat md0 : active raid10 sdc1[4] sdb1[0] sdd1[2] sde1[3] ...
1
vote
1answer
81 views

mounting partition images made with dd

is there a way to mount and access a single partition on any mountpoint in my filesystem or must I use disk images and mount with offset? I made a partiton image with dd bs=4M if=/dev/sdb1 ...
1
vote
0answers
52 views

dd over smb to reformat ntfs as ext3

I've been told it's possible to use dd to reformat a portion of a Windows share drive from NTFS to ext3. I'd like to do this to be able to preserve permissions when using rsync for backups, but I ...
1
vote
3answers
67 views

Can I backup a 1TB drive onto a 750GB drive?

I want to backup a larger harddrive (1000GB), but sadly, I only have a smaller harddrive (750GB) available. In this particular case, I do not want to copy over the files, I want to backup the ...
3
votes
0answers
178 views

Write the same file multiple times to one file using dd

I am trying to create large dummy files on a drive using dd. I am currently doing this: #!/bin/bash writeFile(){ #$1 - destination directory/filename, $2 - source filepath $3 - blocksize, $4 - ...
1
vote
2answers
47 views

How can I see processes being run by another instance of root on my Beaglebone

I am installing a Raspbian Linux image onto an sd card inserted into my BeagleBone Black. I will use this later in my Raspberry Pi. To do this, I am using the dd command from my MacBook Pro (via ...
1
vote
1answer
56 views

hexedit: change number of columns (bytes per line)

I am using hexedit to show/edit disk MBR (512 Bytes, copied with dd). When I open the file, hexedit displays the file as 9 columns, 4 bytes per column (36 bytes per line). That is very unfortunate. I ...
1
vote
1answer
787 views

What does the command pkill -USR1 -n -x dd mean exactly?

I am using dd to do a network transfer of a disk image to an sd card on my BeagleBone. Using pkill -USR1 -n -x dd in an ssh connection to this BeagleBone gives me a status update of the transfer ...