It is my second day on Linux. I am having difficulties mounting an USB drive. It shows this error:
mount: can't find /dev/sdb1/mnt in /etc/fstab or /etc/mtab
How can I get rid of this error?
You probably forgot to tell
mount where to mount your drive.
Linux uses device files (
/dev/sdb1, etc.). And unlike Windows drives (
D:, etc.), you cannot access them directly (
cd /dev/sdb1 will inevitably fail, telling you that it is not a directory but a file). If you want to open a drive with
mount, you need to provide a mountpoint. A mountpoint is a directory wherein your USB drive will be opened and where you will be able to access your files.
Create a directory that you will use as the mountpoint for your drive:
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 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:
/etc/fstab is a file in which you can associate a partition with a mountpoint, allowing you to run
mount <device> instead of
mount <device> <mountpoint>. This is why you get this confusing error.
fstab has many more uses like mounting a partition at boot time, etc. More information about fstab on the Arch Linux wiki
To know your device name use
sudo fdisk. Your device can be recognized by its size, and probably looks like
x could be any letter from a to z. (Usually a is assigned to your first internal hard-drive)
To mount a usb drive
sudo mount <Your Device Name> <Mount Position>, for example:
sudo mount /dev/sdb /mnt
To access what you have just mounted use the position where you have mounted. In the above example I have used
/mnt, so I would type:
maybe this has been answered, I've been trying to figure it out and finally got my virtual drive mounted back into wsl after a rebuild of Windows.
i move into the directory with the "ext4.vhdx" file, and my distro was set to default. Then this command, fixed it right up.
wsl mount --source c: --target /mnt/c .\ext4.vhdx -a