dd

Mounting disk image files and encrypted filesystems/partitions

To dump a disk (or a partition) into a file, you use the following command:

dd if=/dev/hda3 of=file.bin

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:

losetup /dev/loop0 file.bin

Now you can mount the filesystem as usual:

mount -r -t filesystemtype /dev/loop0 /mnt/mountpoint

Apparently, one can combine the last two commands into one:

Execution of dd command via ssh and output redirection to local file

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 "more" command doesn't output to standard out when used via ssh. You need to use "less" to get the file content displayed locally (at least using a RedHat 8 remote machine). With dd you cannot use the "dd if=input of=output" syntax but you need the "dd < input > output" syntax.

Creating and mounting iso images (CD image files) under linux (dd)

Creating and mounting iso images under linux is very easy.
Creating:
dd if=/dev/cdrom of=filename.isoMounting:
sudo mount -o loop -t iso9660 filename.iso /mnt/isoThe 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 bchunk. 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.

Pages