SDB:Repairing a Crypto File System

Şuraya atla: kullan, ara


Version: 7.2 -

Concern

You want to repair your damaged crypto file system.

Procedure

First, load the kernel module for the encryption algorithm, e.g. with:

modprobe loop_fish2

The twofish encryption is used in this example. Be sure to use the correct encryption method. If you use the wrong encryption method, the partition or crypto file will be reencrypted, resulting in a total loss of data.

Associate your encrypted partition or crypto file with a loop device. Use the following syntax

losetup -e <encryption> /dev/loop0 <crypto partition or crypto file>

Example:

losetup -e twofish /dev/loop0 /home/crypto.img

Make sure that "/dev/loop0" is not in use. If it is, use a different loop device. An overview of the available loop devices can be listed with the following command:

losetup -a

After associating the loop device and the encryption, check if you can mount the device, e.g. with the following command:

mount /dev/loop0 /mnt

Even if the "mount" command results in an error message, this does not necessarily mean that the file system is damaged. For instance, the encryption method or the password may have been entered incorrectly. To check this, release the loop device with the following command:

losetup -d /dev/loop0

Then try again with the "losetup -e" command indicated above.

If you are sure you entered the password and encryption method correctly, the next step is a file system check. The following example shows how this can be done for the ext3 file system:

 # fsck.ext3 /dev/loop0
 e2fsck 1.34 (25-Jul-2003)
 /dev/loop0 has been mounted 309 times without being checked, check forced.
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 /dev/loop0: 17732/83328 files (3.0% non-contiguous), 151325/166400 blocks
 

Finally, mount the crypto file system:

mount -t <fs-type> /dev/loop0 <mountpoint>

<keyword>cryptofilesystem,cryptofs,encryption,crypto,filesystem</keyword>