<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dd on Michael’s Domain</title><link>https://jeltsch.org/en/tags/dd/</link><description>Recent content in Dd on Michael’s Domain</description><generator>Hugo</generator><language>en-us</language><copyright>Copyright © 2002 - 2026 Michael Jeltsch.</copyright><lastBuildDate>Fri, 24 Jul 2026 00:18:18 +0300</lastBuildDate><atom:link href="https://jeltsch.org/en/tags/dd/index.xml" rel="self" type="application/rss+xml"/><item><title>Mounting individual partitions from disk dumps</title><link>https://jeltsch.org/en/mounting_individual_partitions_from_disk_dumps/</link><pubDate>Thu, 26 Dec 2013 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/mounting_individual_partitions_from_disk_dumps/</guid><description>&lt;p&gt;You can make disk dumps from individual partitions or from a hard drive that contains more than one partition. The ladder has the advantage that you can restore the computer by dumping back the image onto the same or another hard drive. But if you want to access an individual partition from a hard drive image, you need to know where the partition boundaries are. You can note them down from the output of fdisk. However, fdisk -l gives the partition boundaries, but the unit is sectors. You need to multiply this number by the logical sector size to get the partition boundaries in bytes.Alternatively you can use 
 &lt;a href="http://www.gnu.org/software/parted/" target="_blank" rel="noopener noreferrer nofollow"&gt;parted&amp;nbsp;






 
 
 
 &lt;svg class="svg-inline--fa fas fa-up-right-from-square fa-2xs" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 512 512" overflow="visible"&gt;&lt;use href="#fas-up-right-from-square"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/a&gt;
 (after invoking parted, execute commands unit, B, print in that order) to display the partition boundaries in byte. parted can be also used on a disk dump, e.g. parted /home/backups/diskdump.img to determine the partition boundaries.&lt;code&gt;jeltsch@Michael:~$ sudo parted /home/backup/diskdump.img GNU Parted 2.3Using /home/backup/diskdump.imgWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) unit Unit? [compact]? B (parted) print Model: (file)Disk /home/backup/diskdump.img: 160041885696BSector size (logical/physical): 512B/512BPartition Table: msdosNumber Start End Size Type File system Flags 1 1048576B 524287999B 523239424B primary ntfs boot 2 524288000B 80282124287B 79757836288B primary ntfs 3 80283171840B 160041009151B 79757837312B extended 5 80283172864B 122626684415B 42343511552B logical ext4 7 122626768896B 157924769279B 35298000384B logical ext4 6 157932322816B 160041009151B 2108686336B logical linux-swap(v1)(parted)&lt;/code&gt;Then you just mount the image as a loop device with the additional parameter offset using the start boundary of the partition you want to mount:&lt;code&gt;sudo mount -o loop,ro,offset=524288000 /home/backup/diskdump.img /mnt&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Disk dumps (dd) and copying over the network (netcat)</title><link>https://jeltsch.org/en/disk_dumps_dd_and_copying_over_the_network_netcat/</link><pubDate>Tue, 16 Feb 2010 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/disk_dumps_dd_and_copying_over_the_network_netcat/</guid><description>&lt;p&gt;On the receiving machine (disk sda MUST be unmounted, e.g. by booting from a live CD or USB stick):&lt;code&gt;netcat -l -p 4778 | dd of=/dev/sda&lt;/code&gt;On the sending machine (disk sdb MUST be unmounted, e.g. by booting from a live CD or USB stick):&lt;code&gt;dd if=/dev/sdb | netcat 192.168.0.4 4778&lt;/code&gt;(-l listen; -p port)To copy a directory over the network, enter the directory and execute on the sending machine:&lt;code&gt;tar -cz . | nc -q 10 -l -p 45454&lt;/code&gt;On the receiving machine, create the directory, enter it and execute:&lt;code&gt;nc -w 10 192.168.0.11 45454 | tar -xz&lt;/code&gt;BTW: If you want to see the progress of a disk dump (how much was already copied in what time at what average speed), you can use (in newer versions of dd) the status option. I guess this might not work for network copying, but I have not tried… &lt;code&gt;dd if=/dev/sdb of=/target status=progress&lt;/code&gt;&lt;/p&gt;</description></item><item><title>How to erase hard drives (shred, dd)</title><link>https://jeltsch.org/en/how_to_erase_hard_drives_shred_dd/</link><pubDate>Sun, 25 Jan 2009 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/how_to_erase_hard_drives_shred_dd/</guid><description>&lt;p&gt;You could write zeros to the whole hard drive&lt;code&gt;dd if=/dev/zero of=/dev/hda&lt;/code&gt;For newer versions of dd, you can monitor the progress:&lt;code&gt;dd if=/dev/zero of=/dev/hda status=progress&lt;/code&gt;However, it has been recommended to write a few passes of random noise (n = 3 is the default). If the writing process entirely got rid of the magnetic history and your source of randomness was perfect, a single pass would ALWAYS be enough. In reality, you only need n&amp;gt;1 if you are dealing with the state secrets since recovering anything after an n=1 erase requires special equipment which you cannot buy in any store. &lt;code&gt;shred -vfz -n3 /dev/hda&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Mounting disk image files and encrypted filesystems/partitions</title><link>https://jeltsch.org/en/mounting_disk_image_files_and_encrypted_filesystems_partitions/</link><pubDate>Sat, 26 May 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/mounting_disk_image_files_and_encrypted_filesystems_partitions/</guid><description>&lt;p&gt;To dump a disk (or a partition) into a file, you use the following command:&lt;code&gt;dd if=/dev/hda3 of=file.bin&lt;/code&gt;This command writes the complete data on the hda3 partition into the file file.bin.To mount the filesystem that is in the file, you need to create a loopback device:&lt;code&gt;losetup /dev/loop0 file.bin&lt;/code&gt;Now you can mount the filesystem as usual:&lt;code&gt;mount -r -t filesystemtype /dev/loop0 /mnt/mountpoint&lt;/code&gt;Apparently, one can combine the last two commands into one:&lt;code&gt;mount -t filesystemtype -o loop ./file.bin /mnt/mountpoint&lt;/code&gt;If you want to encrypt the data on a file, that contains a whole filesystem, it is getting a bit more complicated:&lt;code&gt;sudo mkdir /mnt/secure (create mount point for the filesystem)dd if=/dev/zero of=path/to/file bs=1k count=409600 (create an empty file with 400 MB size) sudo /sbin/losetup -e xor /dev/loop0 path/to/file/sbin/mkfs -t ext2 /dev/loop0 409600 (format the device as ext2)sudo mount -t ext2 /dev/loop0 /mnt/secure (mount the device file)cd /mnt/securechown username . (change the owner of the top level directory of the filesystem)&lt;/code&gt;If you want to unmount the filesystem:&lt;code&gt;sudo umount /dev/loop0&lt;/code&gt;If you want to get rid of the filesystem, you have to un-associate it from the loop device 0: &lt;code&gt;/sbin/losetup -d /dev/loop0&lt;/code&gt;For some reason RedHat 9 doesn&amp;rsquo;t come with DES support, so for the time being (until I patch the kernel or move to Suse Linux) I am using the faster, but much weaker xor encryption.Suse 9 comes with inbuilt strong encryption and offers already during the installation the possibility to create an encrypted partition. Suse 9 asks during booting for the passphrase to mount the encrypted filesystem. The boot process stops and waits for 2 minutes before continuing if you don&amp;rsquo;t type in the password. In order to reduce this time, you can edit the file /etc/init.d/boot.crypto. Change in the following line 120 to e.g. 10:&lt;code&gt;:${TIMEOUT:=120}&lt;/code&gt;If you have missed your chance to type in the passphrase during boot time, you can mount the encrypted partition as follows:&lt;code&gt;/sbin/losetup -e twofish /dev/loop0 /dev/hda7 mount /dev/loop0 /media/conf&lt;/code&gt;BTW: The information about encrypted filesystems resides in /etc/cryptotab.&lt;/p&gt;</description></item><item><title>Execution of dd command via ssh and output redirection to local file</title><link>https://jeltsch.org/en/execution_of_dd_command_via_ssh_and_output_redirection_to_local_file/</link><pubDate>Wed, 04 Apr 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/execution_of_dd_command_via_ssh_and_output_redirection_to_local_file/</guid><description>&lt;p&gt;I wanted to copy a whole encrypted partition over the network into a file. You can execute many commands via ssh, but occasionally there are problems to direct the output where you want it. E.g. the &amp;ldquo;more&amp;rdquo; command doesn&amp;rsquo;t output to standard out when used via ssh. You need to use &amp;ldquo;less&amp;rdquo; to get the file content displayed locally (at least using a RedHat 8 remote machine). With dd you cannot use the &amp;ldquo;dd if=input of=output&amp;rdquo; syntax but you need the &amp;ldquo;dd output&amp;rdquo; syntax. The command I finally managed with is &lt;code&gt;ssh -l root remote-machine 'dd hda1.bin&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Creating and mounting iso images (CD image files) under linux (dd)</title><link>https://jeltsch.org/en/creating_and_mounting_iso_images_cd_image_files_under_linux_dd/</link><pubDate>Sat, 23 Dec 2006 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/creating_and_mounting_iso_images_cd_image_files_under_linux_dd/</guid><description>&lt;p&gt;Creating and mounting iso images under linux is very easy.Creating:&lt;code&gt;dd if=/dev/cdrom of=filename.iso&lt;/code&gt;Mounting:&lt;code&gt;sudo mount -o loop -t iso9660 filename.iso /mnt/iso&lt;/code&gt;The file endings iso, raw and cdr denote all iso files. Image files with the bin/cue ending, however, are not iso files. You can convert them into iso files with 
 &lt;a href="http://he.fi/bchunk/" target="_blank" rel="noopener noreferrer nofollow"&gt;bchunk&amp;nbsp;






 
 
 
 &lt;svg class="svg-inline--fa fas fa-up-right-from-square fa-2xs" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 512 512" overflow="visible"&gt;&lt;use href="#fas-up-right-from-square"&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/a&gt;
. bchunk needs the cue file to do this! Allthough some non-Linux burning applications (e.g. Toast Titanium for MacOS) can handle (burn and convert) the bin file without the cue file.&lt;/p&gt;</description></item></channel></rss>