Assign external USB drives to folder?

Out of curiosity, does this have a Linux equivalent?

You can assign each USB drive to a folder, and every time you connect the drive, it will become available in the same folder (Windows 10). See http://www.ghacks.net/2008/03/28/assign-usb-drives-to-a-folder/

So, can Linux somehow do this too?

does this have a Linux equivalent

Oh boy, you’re in for a treat!

This is a Unix feature that is so useful, Windows implimented it partially.

Mounting makes filesystems on physical devices available to the operating system.

The default type of mount is nested into the directory structure (which is the ‘assigned to a folder’ thing this article covers). The lettered drives are a Windows original concept.

You can mount and unmount filesystems arbitrarily, manually or automatically at boot time. There are next-generation features in Linux that makes use of this ability and filesystem snapshots to make upgrades and configuration changes revertable and version controlled.

The command lsblk will be handy to see available filesystems and associated mount points. Graphical distros will usually ship with a GUI tool for managing filesystems as well.

1 Like

Hmmm, it does not sound like what is described in the article at a very specific point:

What the Windows thing does is this. You insert a USB drive, say named “drive01”. You assign a folder to it, let’s say D:\Drive01. You repeat this for all 12 drives you have, for folders Drive01 to Drive12.

Every time you attach the drive to the PC, the USB drive will automatically be ‘mounted’ to the same folder you assigned it to the first time. No need to unmount and mount again, just eject the drive and plug it in again, everything is there. Note that I do suspect it may not be tied to the name of the drive but rather a specific unique ID for the drive. Just guessing, I could be wrong. I tried it with two drives (not at the same time attached, but same name) and they did not interfere with each other. I.e. only the drive I assigned to a folder actually re-connected to said folder.

If I understand the Linux ‘mount’ command correctly, you have to umount the USB drive each time you eject it (probably this gets done automatically when you eject it in the GUI like under Windows) but you need to create the mount point again each time you plug it back in?

I should get me a VM with Linux to try this out. So all I do is attach the USB drive, open terminal window, and mount the drive to a folder. If I then eject it using the GUI, and plug it back in, would it auto mount again to that folder? From the wikipedia page you linked, I think it would require some automount utility?

IMO using mount is a low level, slightly expert method.

Most distros will mount a USB semi-automatically in /media/$USER/label.

A simple approach is to make a sym link to the /media mount.

The desktop environments have tools for this; in KDE plasma it’s system settings, removable storage.

Symlinks won’t do the job?

Create a symlink that will be your folder and it will really point to the place where the usb drive is mounted.

ln -s /there/where/is/my/usb/ /there/where/i_want/have/my/folder

Instead of assigning a usb device to a folder, we do the opposite, assigning a folder/link to the location of the device that has already been mounted.

Aha, seems like that might do it. I’ll study up on symlinks and give it a go on a Linux VM, see if I can get it to work like in Windows (i.e. automatically link every different drive to a different location).

Thanks to all three of you for the guidance!