14

I'm using (L)Ubuntu 16.04. I would like to backup my files on an external hard drive (sdd) with LUKS. There was no partition (sdd1, etc.) before the cryptsetup command.

#sudo cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 2000 --use-random --verify-passphrase luksFormat /dev/sdd

Passphrase ok. It worked. But then :

#sudo mount /dev/sdd /mnt/
mount: unknown filesystem type 'crypto_LUKS'

How can it be unknown filesystem, as I used it just before ?

Thanks

aldaron
  • 493
  • 2
  • 5
  • 7

2 Answers2

15

To be able to access your files you have to decrypt them first

cryptsetup open /dev/sda1 backup

where sda1 is the encrypted partition and backup is the name of your partition (that is a very basic command, you can fix it according to your needs). Then type your password, and proceed to mount that unencrypted using

mount /dev/mapper/backup /mnt

Done! now visit the mounted partition

cd /mnt/backup
Joe
  • 663
  • 5
  • 10
  • I have to say my HDD has no name. So, I arbitrarily call it "backup" below, and it works. And it has zero partition : there is no "sdb1" or "sdb2", there is only "sdb". `~$ sudo cryptsetup open /dev/sdb backup Enter passphrase for /dev/sdb: ~$ sudo mount /dev/mapper/backup /mnt mount: wrong fs type, bad option, bad superblock on /dev/mapper/backup, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.` – aldaron Oct 13 '16 at 11:24
  • you might have a bad Superblock. Check this https://ubuntuforums.org/showthread.php?t=1245536&p=7822694#post7822694 and come back – Joe Oct 26 '16 at 00:32
  • You're right : ~$ e2fsck -f /dev/sdd1 e2fsck 1.42.13 (17-May-2015) ext2fs_open2: Bad magic number in super-block e2fsck: Superblock invalid, trying backup blocks... Resize inode not valid. Recreate? yes Pass 1: Checking inodes, blocks, and sizes […]Inode 14028290, i_size is 2529966949950002624, should be 0. Fix? yes Inode 14028290, i_blocks is 74937487465024, should be 0. Fix? yes Inode 14028302 has illegal block(s). Clear? yes Illegal block #0 (1002589455) in inode 14028302. CLEARED. […] ad nauseam... I tried it with another hdd. Is it a LUKS bug ? – aldaron Oct 26 '16 at 17:32
  • Don't think so. I guess your HDD is beginning to fail. Save your data and move it you other HDD. Let me know if you were able to fix the issue so I can update the answer so then you can accept it. – Joe Oct 28 '16 at 05:07
  • I tried with another HDD again. Same problem. Note : I can encrypt my HDD with gnome-disks, but this is not a solution : I want sha512. – aldaron Nov 01 '16 at 13:05
  • Were you able to solve the issue? – Joe May 11 '18 at 01:23
0

I have not enough rep to comment on @Joe's succinct answer.

For me, something that took too long to work out was that the first command in Joe's answer resulted in the mapping /dev/mapper/backup to be created, and that is what needs to be mounted, hence mount /dev/mapper/backup /mnt

I had troubles as the drive was already mounted, but I wanted to remount it, so for unmounting I did not know the mapping name, I could have found it in the /dev/mappings directory

I finally managed to work out how to unmount with this command umount /dev/mapper/FALCON_1 (FALCON_1 being the peculiar name of where my HDD was mapped)

Hope it helps someone.