Centos – how to mount a luks-encrypted file

centosdmcryptluks

I had a good-working system. Cent OS 6. But after I made a reboot luks-partition has been unmounted. And our system administrator have a weekends now 🙁

Please help me to mount a luks partition again.

I know the path to encrypted file and password.

System administrator's records says: "Encrypted file located at /path/file and mount to /crypt. Password is xxxxx" That's all.

Before reboot the server I made a records of 'mount' command, the related partition was:

/dev/mapper/crypt_fun /crypt ext4 rw,relatime,barrier=1,data=ordered 0
0

Now I try this commands:

cryptsetup luksOpen /dev/loop0 /path/file

type a password

mount /path/file /crypt

But nothing works good 🙁 Please help me.

Best Answer

Given the above, my guess is that you would need to do something like this.

  • First make your file accessible via a loopback device
    • losetup /dev/loop/0 /path/file
  • Open the loopback device to crypt_fun
    • cryptsetup luksOpen /dev/loop/0 crypt_fun
  • Mount it
    • mount /dev/mapper/crypt_fun /crypt