<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Loopback Fielsystem on Michael’s Domain</title><link>https://jeltsch.org/en/tags/loopback-fielsystem/</link><description>Recent content in Loopback Fielsystem 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/loopback-fielsystem/index.xml" rel="self" type="application/rss+xml"/><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></channel></rss>