0

Occasionally, unlocking my luks encrypted disk errors with this: https://i.sstatic.net/eTzoz.png (posted link because not enough rep for images) Trying to mount /dev/sda returns mount: /dev/sda: can't find in /etc/fstab.

2 Answers 2

1

You probably forgot to tell mount where to mount your drive.

How to mount a drive

Create a directory that you'll use as the mountpoint for your drive:

mkdir /mnt/mydrive

Mount your drive with this command:

mount /dev/sdb1 /mnt/mydrive

Note: If you don't know your drive's device file, you can run sudo fdisk -l or lsblk

to identify which one is the partition you're looking for.

Now if you run ls /mnt/mydrive, it should list your drive's files.

When you're done, don't forget to unmount your USB drive before removing it from the computer:

umount /dev/sdb1
0

While Fidle's answer is correct, I would like to propose a solution with fstab.

In /etc/fstab you can add static file-systems to your system. Each line contains the following:

<drive> <mountpoint> <filesystem type> <option> <dump> <pass>

Where most of the time only the first three are important. Under <option> you can specify mounting options (as you would using mount -o, like read-only and silimar).

<dump> would specify the need for the file-system to be dumped and <pass> is used to tell fsck the order in which file-systems should be checked on reboot. If you put a 0 there it means no check is necessary. Usually your root system has a 1, meaning it will be checked first, and other file-systems have a value of 2.

Assuming you have an ext4 file-system on /dev/sda that you not want to be dumped or checked, mounted at /mnt/luks-drive and no special options, append the following to /etc/fstab:

/dev/sda    /mnt/luks-drive    ext4    default    0    0

That way a future mount /dev/sda will work and use the entry we just set.

Suggestion: In your case maybe not needed, but usually I strongly discourage the use of sdX names for drives in fstab. Personally, I use the drive's UUID here. To find out your UUIDs:

$ ls -lha /dev/disk/by-uuid

Simply use UUID=<your UUID goes here> instead of /dev/sda in /etc/fstab then.

You must log in to answer this question.