Linked Questions

6
votes
1answer
665 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
4
votes
2answers
517 views

Is `dd` really necessary to clone a disk? [duplicate]

Almost any tutorial will tell you that to clone a disk on the command line (say, to clone /dev/sda to /dev/sdb) you can use: dd if=/dev/sda of=/dev/sdb ...and some block size options... This reads ...
2
votes
0answers
27 views

Is there a reason to use dd if I don't use any extra parameters? [duplicate]

I often use dd when I for example want to copy an image to a usb drive. I only do dd if=infile of=/dev/sdb. Is there any advantage to this over < infile > /dev/sdb? And is this the exact same as ...
54
votes
11answers
19k views

Is there a way to modify a file in-place?

I have a fairly large file (35Gb), and I would like to filter this file in situ (i.e. I don't have enough disk space for another file), specifically I want to grep and ignore some patterns — is there ...
70
votes
5answers
45k 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 ...
35
votes
7answers
63k views

How do I correlate /dev/sd devices to the hardware they represent?

A drive is beginning to fail and I only know the device by its /dev/sdb device file designation. What are the ways that I can use to correlate that device file to an actual hardware device to know ...
34
votes
5answers
123k views

Full DD copy from hdd to hdd

ORIGINAL QUESTION: If I have 2 identical hard drives with the following characteristics: SATA 6.0 Gb/s 5400 rpm 3TB How long should a full dd copy take to complete? So far it's been running for 5 ...
17
votes
5answers
7k views

How can I edit a large file in place?

I have a few files sized > 1 GB each. I need to remove last few bytes from the files. How can I do it? I prefer to edit file in place to save disk space. I am on HP-UX.
14
votes
6answers
14k 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 ...
59
votes
2answers
13k 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 ...
18
votes
3answers
3k 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 ...
8
votes
3answers
6k views

Resume interrupted copying process

How to resume securely and reliably process of copying file $A into backup location $B done with pv "$A" > "$B" or cat "$A" > "$B" ? (let's assume file $A is very big, e.g. LVM2 snapshot file) ...
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' (...
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 ...
6
votes
3answers
6k views

Can I share a device from under /dev across hosts?

Here's the situation. I have a video device /dev/video0 on a VMware Server and I want to access this device from within a virtual machine. However for whatever reason I can't connect the device ...

15 30 50 per page