Questions tagged [dd]

A low-level command-line tool on Unix-like operating systems to copy and convert files.

Ref

Examples:

  • Clone the drive sda onto drive sdb:

    `$ dd if=/dev/sda of=/dev/sdb`
    
  • Clone the drive hda onto an image file:

    `$ dd if=/dev/hda of=/image.img`
    
  • Copy a CD or DVD disc to a .iso image file, first unmounting the disc: sudo umount /dev/dvd-device

    dd if=/dev/dvd-device of=dvd.iso bs=2048 conv=sync,notrunc

    # dvd-device will typically be dvd for a dvd disc or cdrom for a cdrom disc.

  • Clone a hard drive to a zipped image file in 100Mb blocks:

    $ dd if=/dev/hda bs=100M | gzip -c > /image.img

  • Create a 10 KB file filled with random data (10 x 1K blocks):

    $ dd if=/dev/random of=random.bin bs=1024 count=10

  • Completely wipe the hard drive hdz by overwriting it with random data:

    $ dd if=/dev/urandom of=/dev/hdz

  • Create a boot floppy:

    $ dd if=boot.img of=/dev/fd0 bs=1440

345 questions
5
votes
3 answers

Use DD to write specific file recursively

I have a hard drive that I want to overwrite, not with null bytes, but with a message. 48 69 64 64 65 6e 20 = "Hidden " Here's my command thus far: echo "Hidden " > /myfile dd if=/myfile of=/dev/sdb bs=1M Note: I have also tried an assorment of…
Goodies
  • 4,439
  • 3
  • 31
  • 57
4
votes
5 answers

Low-Level-Writing in C

How can I write to any block on my HDD using the C programming language? There was a question about writing the MBR but it didn't cover the C aspects that much. Since filedescriptors are - as the word says - for files, I guess there is no way to use…
markusschmitz
  • 676
  • 5
  • 18
4
votes
1 answer

Using the Sleuth Kit function tsk_fs_open_img() returns an error that the FS is not a FAT FS

I am writing a program using the Sleuth Kit Library that is designed to printout the File Allocation Table of a FAT32 filesystem. Everything in my program works fine until I call the tsk_fs_open_img() function. At that point the program returns…
4
votes
3 answers

DD img different MD5's?

We have a smart media card with a linux install on it that we need to duplicate. We created an img with DD and then used dd to write the img back to a couple of new smart media cards. We have compared the MD5 checksum of both the original and the…
SpyderDriver
4
votes
3 answers

Laravel 6 DD cannot expand array view on network tabs (Developer tool)

I've try to dump result of an array with dd , my laravel version is Laravel 6 , Any mistakes on my code ? Below is my code : $bills = $bills->with('adminBill.bill'); $bills = $bills->offset($start) ->limit($limit) …
4
votes
4 answers

Mac OS X Bash get /dev/diskNsM size

How could I get device size in bytes? In Mac OS X 10.6 I am using this: $ diskutil information /dev/disk0s2 Device Identifier: disk0s2 Device Node: /dev/disk0s2 Part Of Whole: disk0 Device / Media Name: …
user663896
4
votes
2 answers

Reorder lines near the beginning of a huge text file (>20G)

I am a vim user and can use some basic awk or bash commands. Now I have a text (vcf) file with size more than 20G. What I wanted is to move the line #69 to below line#66: $less huge.vcf ... 66 ##contig=
David Z
  • 6,641
  • 11
  • 50
  • 101
4
votes
4 answers

Reading a sector on the boot disk

This is a continuation of my question about reading the superblock. Let's say I want to target the HFS+ file system in Mac OS X. How could I read sector 2 of the boot disk? As far as I know Unix only provides system calls to read from files, which…
titaniumdecoy
  • 18,900
  • 17
  • 96
  • 133
4
votes
1 answer

Using dd command through Python's subprocess module

Through Python's subprocess module, I'm trying to capture the output of the dd command. Here's the snippet of code: r = subprocess.check_output(['dd', 'if=/Users/jason/Desktop/test.cpp', 'of=/Users/jason/Desktop/test.out']) however, when I do…
jason adams
  • 545
  • 2
  • 15
  • 30
4
votes
1 answer

dd returns permission denied even as root

I'm trying to backup a centos server using dd but I get permission denied even if I'm logged as root. [root@server ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vzfs 90G 58G 33G 64% / none …
Julien B.
  • 3,023
  • 2
  • 18
  • 33
4
votes
3 answers

How to use dd to fill a disk with a specific char?

I know i can fill an entire disk with 0x0 like this: dd if=/dev/zero of=/dev/sda bs=4k conv=notrunc Is there a way to fill the entire disk with a char of my choice?
yonigo
  • 987
  • 1
  • 15
  • 30
4
votes
1 answer

Entity Framework puts all fields in primary key for Firebird tables

I am using a Firebird 2.1 database together with VS2010 (.NET 4.0) and am trying to get it to work properly with the entity framework. The problem is, that when I generate an entity from a database table, the framework detects all columns to be part…
Julian
  • 55
  • 3
4
votes
1 answer

Disk Throughput - new file vs. existing file using dd

I wanted to measure my disk throughput using the following command: dd if=/dev/zero of=/mydir/junkfile bs=4k count=125000 If the junkfile exists, my disk throughput is 6 times smaller than if junkfile does not exist. I have repeated that many times…
Amir
  • 5,996
  • 13
  • 48
  • 61
4
votes
3 answers

Bash: substitute some bytes in a binary file

I have a binary file zero.bin which contains 10 bytes of 0x00, and a data file data.bin which contains 5 bytes of 0x01. I want to substitute the first 5 bytes of the zero.bin with data.bin. I have tried dd if=data.bin of=zero.bin bs=1 count=5 but,…
Dagang
  • 24,586
  • 26
  • 88
  • 133
3
votes
1 answer

any way to run gparted on cygwin?

I am creating bunch of SD-Card images for Android and find myself using dd and GParted a lot Right now I reboot my laptop in PartedMagic from a USB drive I have Cygwin on my Windows computer, which has dd how can I get GParted too?
Kalpesh Soni
  • 6,879
  • 2
  • 56
  • 59
1 2
3
22 23