Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [dd]

dd is a traditional utility for binary data copies

Filter by
Sorted by
Tagged with
3
votes
0answers
173 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 ...
3
votes
0answers
113 views

Is this a correct way to back up one big drive to two smaller ones?

I have a pre-fail drive, and while I'm waiting for replacement I am trying to do full back up to two smaller drives. Given that drive is 3TG and ones I have are 1.5 and 2TB, is this a correct way to ...
3
votes
1answer
393 views

Equivalent of memmove on files: copy a range of bytes to an earlier position

What is an equivalent of memmove on files with the same input and output file, which works with large files? dd works when I move the file contents towards the right, but not if I move the contents ...
2
votes
3answers
1k views

dd crashing - what to do about it

I have dd crashing after running a few hours. Typically with a message like Input/output error 68424+1 records in 68424+1 records out 342124883968 bytes (342 GB) copied, 5114.68 s, 66.9 MB/s Is ...
2
votes
3answers
811 views

Duplicating a hard disk

I'd like to simply duplicate a hard disk drive to another hard disk drive of the same size. I know I can simply do: dd if=/dev/sda of=/dev/sdb (or whatever the names of the drives are in /dev). ...
2
votes
2answers
807 views

compressing and decompressing dd image - zstd instead of gzip

Earlier I was using fsarchiver to create compressed partition image. Due to some weird behavior I am choosing to replace it with dd. However, I like how fsarchiver compressed with zstd. So, I ...
2
votes
3answers
2k views

What's the POSIX way to read an exact number of bytes from a file?

Just hit this problem, and learned a lot from the chosen answer: Create random data with dd and get "partial read warning". Is the data after the warning now really random? Unfortunately ...
2
votes
1answer
1k views

Can't run dd from /dev/zero to new added hard disk /dev/sdb on CentOS 7

Now the hard disk is 10GB. Added new hard disk with 16GB size. dev/zero information: fdisk -l /dev/zero Disk /dev/zero: 0 MB, 0 bytes, 0 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (...
2
votes
3answers
517 views

Update block device with image while writing only the Delta, is it possible?

I use dd extensively as a means of software configuration control. The images are typically deployed on flash disk to update devices. I find I am often making small incremental updates to the image ...
2
votes
2answers
384 views

Overwrite a portion of a file w/o modification to the unmodified content [duplicate]

I'd basically like to create an allocated file lets say 1GB with content. Then hopefully using some command line utility I'd like to overwrite-in-place a portion of the file, lets say the beginning 4 ...
2
votes
3answers
7k views

Using DD to copy only half (part) of removable device

I had a 32GB SD Card with this structure (or very close): luis@Fresoncio:~$ sudo fdisk -l Disk /dev/mmcblk0: 29.2 GiB, 31393316864 bytes, 61315072 sectors Units: sectors of 1 * 512 = 512 bytes Sector ...
2
votes
4answers
2k 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 ...
2
votes
3answers
908 views

Why does this work: “cp image.bin /dev/mapper/loop0p1”?

Why does this work? cp image.bin /dev/mapper/loop0p1 image.bin is a partition image. I have tried it and works, but why? Shouldn't a dd be used?
2
votes
2answers
58 views

dd command to get data of specific range

In the dd command, we can use skip to skip n byte in a file. From nth byte to end of file is copied. But I want to copy binary data from 1228 to 1331 only. How do I achieve this with dd on Linux?
2
votes
2answers
2k views

How To dd or cp Entire Disk On Debian Remote Machine To Local Machine?

I have read this post - How to dd a remote disk using SSH on local machine and save to a local disk However, the following code doesn't work: "dd if=/dev/sda | gzip -1 -" | dd of=image.gz As I do ...
2
votes
2answers
4k views

Hard disk drive disappeared

Yesterday I performed a hard-reset while Linux was booting. This led to a hard issue with the HDD (UNC while recovering journal). I had to use ddrescue instead of dd because dd crashed on I/O error. ...
2
votes
2answers
13k views

How do I resize a disk image device?

I'm trying to reduce the size of a backup drive image. Original disk had these partitions: Model: ST916082 1A (scsi) Disk /dev/sde: 160GB Sector size (logical/physical): 512B/512B Partition Table: ...
2
votes
1answer
2k views

How to create a live USB of FreeBSD 11.1 from Arch Linux?

I'd like to boot a live USB for FreeBSD 11.1 in my UEFI firmware. I tried creating a live USB using: dd if=FreeBSD-11.1-RELEASE-amd64-dvd1.iso of=/dev/sdc bs=4M status=progress && sync Then ...
2
votes
1answer
2k views

How to know when a 'dd' command has been completed?

My system is running the command sudo dd if=/home/vico/file.iso of=/dev/sdb1, it returns control inmediately, but the transfer takes a while. How to know that the whole process has ended?
2
votes
1answer
1k views

How to prevent dd from freezing my system?

I want to fill the free space on my hard drive with a command like that : # dd if=/dev/zero of=z but it causes GNOME to freeze regularly for a few seconds. Even the mouse cursor is affected. How ...
2
votes
1answer
1k views

How can I zero the unused blocks on my filesystem in order to minimize the compressed disk image size? [duplicate]

If I dd my disk and compress the image with lzma or lzo the image is still big. The partition is 10GB used, 90GB available. But the image still around 20GB. I believe that is because I have copied ...
2
votes
2answers
4k views

Can I use dd to make an ISO of a DVD that is only as large as the data on the DVD?

I am starting to make backups of my movie DVDs at home. I am using DD to make ISO images of my DVD as follows: dd if=/dev/dvd of=~/dvd/abc.iso However, even though the content of the DVD is only, ...
2
votes
1answer
404 views

How to dd a local disk unto a remote disk?

I have a local machine that needs be migrated to remote disk. How can I do it with dd? I know local format for command dd if=/dev/sdx of=/dev/sdx count=x bs=x But how to do it via ssh direct from ...
2
votes
3answers
1k views

General question about `dd`, iso images and linux devices

I have an iso image (it's a windows installation disk), but I do not want to burn dvd. I want to create a bootable usb flash drive instead. And I want to use linux tools to accomplish this task. I ...
2
votes
3answers
947 views

Usb size wrong after dd write of a ISO-Image

I have just used dd to place the Kali Linux ISO file onto my USB. I then tried to install Kali Linux via the USB, but I couldn't since the install-image was corrupt. I booted back into my other Linux ...
2
votes
2answers
191 views

Efficient Use of dd (buffer many blocks, process one at a time)

Given a file, I need to search for the number of blocks that matches an input block $templateBlock of certain size $blockSize. What is an efficient way to use dd to accomplish this task? The ...
2
votes
1answer
1k views

dd shows a random number of records in/out [duplicate]

I'm writing some images back to block devices, with dd, and getting very strange output I've never seen before. # xz -dc goren.img.xz | dd bs=1M of=/dev/storage2/goren 35+2475166 records in 35+...
2
votes
2answers
9k views

Is it possible to use dd to clone only the part of the hard drive which is used?

if only 1/3 of a 300GB hard disk is used. Is it possible to use dd to clone the drive (but only the 100GB that is used)? dd if=/dev/sda of=clone.img
2
votes
1answer
106 views

dd command lost partition

When I used to image my USB, I used the dd command and saved that image to my Hard Disk my USB = sdb1 (4 GB) My partation = sda5 (775 GB free space) dd if=/dev/sdb1 of=/dev/sda5 operation completed....
2
votes
1answer
90 views

dd behavior, default writing and partitions

I am confused about the behavior of dd. Say we have some SD card called /dev/foo and this card has partitions /dev/foop0 and /dev/foop1. Using dd, I can set the of argument to /dev/foo and dd won't ...
2
votes
2answers
244 views

Backing up a partition: doesn't reflect the status properly

With an intent to check how backing up files/filesystems works, I created 3 part itions sda9, sda10 and sda11. Please see the structure below. (Please ignore sda10 for now as I have already run ...
2
votes
1answer
3k views

Copying a working Linux instead of installing a new one [duplicate]

It is possible to move an installed Linux from one drive to another or from one disk to another by two methods: dd command which copies sector by sector including boot sector cp command, and then ...
2
votes
2answers
2k views

Writing data on particular sectors or blocks

Not sure if it's better suited for superuser of serverfault boards, let me know. I have a drive which I repartitioned with fdisk. Initially there was only one big partition, now there are a number ...
2
votes
1answer
34 views

How should I go about safely checking if performing dd on /dev/random is going to block?

I'm developing a shell script that only uses /dev/random in the following manner: dd if=/dev/random of=%{outputFile} count=512 bs=1 2>/dev/null I explicitly do not want to use /dev/urandom, even ...
2
votes
1answer
88 views

dd completes implausibly quickly

I'm running dd to copy a 1.8 GB image onto an SD card for a Raspberry Pi. This copies at about ~400MB/s, which is much higher than the write speed the manufacturer says this card can do. I therefore ...
2
votes
2answers
100 views

How can I safely write a disk image to a memory card?

I routinely copy disk images to SD cards for use on a Raspberry Pi. The usual way I do this is by dd if=/tmp/filesystem.img of=/dev/sdb, which is only a minor typo away from over-writing my computer'...
2
votes
1answer
235 views

Separate dd data from output through netcat to parse output

I'm copying dd output through netcat with the following command $dd if=/dev/zero bs=1024K count=1 | nc <IP_ADDR> <PORT> -q 0 1+0 enregistrements lus 1+0 enregistrements écrits 1048576 ...
2
votes
1answer
580 views

How to dd an image and save it to tftp without saving into local machine?

I want dd an image and save it to remote using tftp for example I'm trying to do "dd if=/dev/mtd2" | save it to tftp server. the direction of the file I have used in that code is wrong I'm trying my ...
2
votes
1answer
245 views

ddrescue image differs in size

I have 40gb image split into 10 4gb files, then combined with dm-linear to create single 40gb drive. One file got damaged single 4kb sector. However when I'm copying data unsing either dd or ddrescue ...
2
votes
2answers
709 views

How can I manipulate a partition table file without fdisk checking the validity of it?

I'm creating an image in memory (/tmp is a tmpfs): $ dd if=/dev/zero of=/tmp/sdcard.img bs=512 count=3147775 It's supposed to hold a partition table and the first 3 partitions of a device $ losetup ...
2
votes
1answer
3k views

How to fix BTRFS superblock error after resize/shrink (BTRFS: couldn't get super buffer head for bytenr 274877906944)

BTRFS RAID1 array with 2 500 GB hdds, no errors. This is the root filesystem, so there are 3 partitions on each drive: 1 = /boot (ext4), 2 = / (btrfs), 3 (swap) /boot is ext4 because upgrading the ...
2
votes
2answers
1k views

HDD cloning and non-matching checksums

I've been trying to clone a 1Tb HDD to a 1Tb SSD following the instructions here. I tried cloning it several times with both dd (painfully slow) and cat (far quicker) but when I came to do checksums ...
2
votes
1answer
2k views

DD with a specific pattern

I was watching this Defcon video and around 4:30 he shows a custom pattern of drive wiping — the drive is filled with a constant text pattern. Whether he is joking or not, is this possible? How would ...
2
votes
1answer
908 views

Using dd to cause an error in memory

The command dd if=/dev/mem of=/dev/null seek=16k bs=4k count=1 is used to test erroect injection for edac. Why? As far as I know, dd is simply copying data from those devices to somewhere else. What ...
2
votes
3answers
2k views

How to clone linux installation onto an external harddisk?

I see a lot of dd related questions, but could not find answers to the following. If question/answers already exist, please point to them, then flag to close, delete or merge. Can a working linux ...
2
votes
1answer
65 views

How to reset a flash drive murdered by dd

I have a 64GB flash drive onto which I've previously dd'ed a Debian installation. I'd like to do this again (dd a complete Debian install from my machine onto the flash drive) but I've run into some ...
2
votes
1answer
74 views

dd if=/dev/zero leaves drive contents in-tact? Bad USB stick?

I thought I could nuke all partitions of a drive by using dd if=/dev/zero of=/dev/sdX. In the past this has always worked for me, but in this case it is not working as expected. #check the partitions ...
2
votes
2answers
32 views

Does dd change any data if `if` and `of` already have the same contents

I was gonna copy a partition to another partition using dd (dd if=/dev/arch_data/root of=/dev/sdd3), and it worked. But then I accidentally re-ran the same command again, and it takes a while so I hit ...
2
votes
1answer
485 views

How can I move a single partition to another empty drive?

I've got a partition P1 (which contains my Linux OS) on a drive A. I've just gotten a completely new drive B (that is larger than partition P1 AND the entire drive A). I'd like to copy across the ...
2
votes
2answers
2k views

“dd” an image onto an sd-card from Ubuntu in Windows Subsystem for Linux

I have a bootable disk image file that I'd like to write onto an sd-card. However, I only have a Windows 10 machine available - it has the Windows Subsystem for Linux already installed, Ubuntu runs, ...