Questions tagged [dd]

dd is a traditional utility for binary data copies

Filter by
Sorted by
Tagged with
11
votes
2answers
3k views

bash can't store hexvalue 0x00 in variable

I'm trying to do some tricks with dd. I thought it would be possible to store some hexvalues in a variable called "header" to pipe it into dd. My first step without a variable was this: $ echo -ne ...
11
votes
6answers
11k views

Comparison of raw block devices

Is there a utility (or some shell magic) that allows me to compare two block devices? Details: I have one large (0.5 TB) RAID device that I've backed up to a slightly larger SATA device using dd. ...
11
votes
3answers
44k views

How to fix this I/O error on a SD card?

I tried with gparted, it didn't work. I found a SDFormatter, tool for windows that did the full erase. I have a SD card and want to install Debian onto it. The dd process takes about 45 minutes, ...
11
votes
1answer
13k 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 ...
11
votes
4answers
35k views

Moving /boot and MBR to a new drive

I have a CentOS 6 server with two hard drives in it. My old 3TB drive has been giving me some issues so I'm moving things over to a new drive. Because my / and /home partition are managed by a LVM ...
10
votes
6answers
23k 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. ...
10
votes
2answers
1k views

dd command bs option at end of disk

If I were to use the dd command as follows: dd if=/dev/zero of=/dev/sdX bs=16M What happens at the end of the disk if it is not an exact multiple of 16M? Does that mean the last remaining portion ...
10
votes
1answer
1k views

Different size of file from /dev/zero and /dev/urandom [duplicate]

I am tring to create random 1G test file via dd command. dd status=progress if=/dev/zero of=/tmp/testfile.zer bs=100M count=10 dd status=progress if=/dev/urandom of=/tmp/testfile1.ran bs=100M count=...
10
votes
3answers
15k views

How to check integrity of a dd backup?

I just made a backup of an entire hard drive (50GB) over ssh via: dd if=/dev/hda | buffer -s 64k -S 10m | ssh myuser@myhost "cat > ~/image.img" What's now the best way to check the integrity of ...
10
votes
3answers
21k 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 ...
10
votes
3answers
1k 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 ...
9
votes
2answers
1k views

Is dd if=/dev/urandom of=/dev/mem safe?

What exactly does this do? I don't understand how you could access base memory with this...seems kinda weird. Is it safe? dd if=/dev/urandom of=/dev/mem
9
votes
1answer
13k views

passing dd skip|seek offset as hexadecimal

# dd if=2013-Aug-uptime.csv bs=1 count=1 skip=3 2> /dev/null d # dd if=2013-Aug-uptime.csv bs=1 count=1 skip=0x3 2> /dev/null f Why the second command outputs a different value? Is it possible ...
9
votes
1answer
7k 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 want ...
9
votes
4answers
6k 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 ...
8
votes
4answers
831 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 ...
8
votes
2answers
3k views

How do I refresh the magnetic state on a disks with backups?

I have a couple of large disks with backup/archive material on them. They're ext4. Regarding the ones of those that will be stored for a couple of years without reading the whole disc again I've been ...
8
votes
5answers
8k views

How to use DD to clone a partition off a disk image?

I have a disk image, it's a "whole" disk image, e.g., contains multiple partitions, and I want to clone just one of them (not the first one..) onto a partition on an external drive with multiple ...
8
votes
2answers
8k 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 @ 2....
8
votes
3answers
3k 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 ...
8
votes
1answer
265 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 ...
8
votes
2answers
587 views

Why is fragmentation level so huge in files that contain other filesystems?

I've just found out what sparse files are and wanted to conduct some experiments on them. On wiki you can read that the files can get fragmented easily. I wanted to check how bad that is. I created a ...
7
votes
3answers
1k views

How should I format a USB prior to writing an ISO to it?

I found these Debian EeePC HowToInstallUsingStandardInstaller instructions at the Debian Wiki, stating that I can install an ISO to a USB using this: dd if=debian-*-netinst.iso of=/dev/sdX Do I need ...
7
votes
5answers
10k views

how to use dd to fill drive with 1's

Filling a drive with /dev/urandom seems to be very slow, so I created a file filled with FF: dd if=/dev/zero ibs=1k count=1000 | tr "\000" "\377" >ff.bin I'd like to fill the drive with copies of ...
7
votes
2answers
19k 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 ...
7
votes
2answers
10k 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 can I ...
7
votes
1answer
3k views

“Cannot allocate memory” when reading from SCSI tape

I am experimenting with some old SCSI tape drives, and I have successfully written some data to a tape, but I am struggling trying to read it back again. # tar tvf /dev/st0 tar: /dev/st0: Cannot ...
7
votes
1answer
3k views

Writing raw images safely to USB sticks

Trying lots of different Linux distributions on all kinds of hardware, I find myself typing commands like this quite often: sudo dd if=xubuntu-13.10-desktop-amd64.iso of=/dev/sdc bs=10240 Needless ...
7
votes
3answers
3k 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
1answer
1k views

How does cat 'know' the optimum block size to use?

From reading this, it seems that when copying data to a different hard drive, cat automatically uses the optimum block size (or very near it). I wonder how it determines the optimum block size, and ...
7
votes
6answers
7k views

Change only one bit in a file

I have to test a hash function and I want to change only a single bit of a specific file. I tried with the dd command. That works, but I can only change a whole byte and not just a bit. sudo dd if=/...
7
votes
2answers
1k 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 /dev/...
7
votes
4answers
5k 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

Why is dd not protected against writing on the active disk ?

I use dd a lot. I live in a contant fear of making a mistake one day, for example writing on sda (computer disk) instead of sdb (USB disk) and then erasing everything I have on my computer. I know dd ...
6
votes
2answers
3k 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 ...
6
votes
3answers
4k views

Does dd copy everything, including all metadata and all “empty” blocks

Suddenly something was messed up with my partitions, or just one partition. I have a default Ubuntu installation, on a Kingston SSD, with the root file system encrypted with LUKS, (using AES I think). ...
6
votes
1answer
658 views

What's the difference in these commands - cat piped to dd and just cat? [duplicate]

I'm curious to know the difference between these two commands in Linux: $ cat ./boot.bin ./kernel.bin /dev/zero | dd bs=512 count=2880 of=devos.img and $ cat ./boot.bin ./kernel.bin > devos.img
6
votes
2answers
846 views

dd with obs and seek makes file of unexpected size

I'm learning to use dd by experimentally playing with its arguments. I would like to create a 10-byte file. I thought the following would work: dd if=/dev/zero of=./foo count=1 bs=1 obs=9 seek=1 ......
6
votes
3answers
7k 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?
6
votes
4answers
9k 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 ...
6
votes
4answers
2k views

How to create a file system as a non root user?

I'd like to create a filesystem image as a non-root user, the problem I'm facing is that the way I'm currently doing it, it needs a mount and as a non-root can't do a mount. This is what I'm now ...
6
votes
1answer
6k 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 dd/...
6
votes
8answers
4k 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 arbitrary strings. Is there a bash-shell method to write repeating arbitrary strings equally as fast as 'dd' (...
6
votes
2answers
2k views

Understanding sparse files, dd, seek, inode block structure

At work we use sparse files as part of out Oracle VM environment for the guest disk images. After some questions from a colleague (which have since been answered) I am left with more questions about ...
6
votes
2answers
3k 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: ...
6
votes
3answers
19k views

Interpreting dd Input/Output error

I tried to copy /dev/Storage/Storage (an LV under LVM) to an image file using a dd | pv | dd pipeline. dd reported an error, and I want to know whether dd finished copying my disk or stopped due to ...
6
votes
3answers
11k views

Using dd to clone a disk while mounted - risks?

I want to clone a hard disk using dd. Because I want to keep a process on the machine alive continuously, I would like to do this while the filesystem is still mounted. I understand this is not the "...
6
votes
1answer
1k views

dd, seek with one block size, write with another block size

Background Info: Copying some .bin files to an SD card (to be read by an embedded device, no filesystem) Commissioning the card requires some segments to be wiped (i.e. zero'd), and others to have ...
6
votes
1answer
376 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
3answers
23k views

what is the difference between seek and skip in dd command?

I am trying to read from the disk and wanted to dd command to issue every request random and check for the latency of the disk for the read operation I have used seek and skip both will that work ? ...