Можно ли смонтировать диск NTFS по имени?

304
Alex Spicer

Поэтому я в настоящее время использую ntfs-3g /dev/sdb1 /home/mountpoint/для подключения внешнего USB-накопителя.

Но я хочу смонтировать его, используя имя тома, в моей голове это будет выглядеть примерно так ntfs-3g -l /dev/DRIVENAME /home/mountpoint/

Есть ли способ, которым я могу это сделать? Я гуглил вокруг и не нашел никаких следов решений, но, может быть, я настолько глуп, что никто никогда не думал, что это надо гуглить.

заранее спасибо

Алекс Спайсер

0

1 ответ на вопрос

0
Hygrinet

Yes, you can use udev to write a rule which will then create a symbolic link of /dev/sdb1 to /dev/mydiskname1. To do this you need to do the following:

  1. Use udevadm to "walk" down the device tree and find the serial number of your drive.
  2. Create a udev rule which creates your symbolic link when that drive is inserted.

This Page has the most concise description of how to go about this, and if you scroll down to the heading entitled "udevadm info" then all will be revealed. But in a nutshell, your process will be something like this:

  1. Run the following to look at your device tree, where /dev/sdX is your sdX device - not sdX1 the partition, but the sdX, device itself

    udevadm info --name=/dev/sdX --attribute-walk

    udevadm info --name=/dev/sdX

  2. Using what's been gleaned from the above, then write a udev rule in /etc/udev/rules.d/70-myusbdisk.rules which looks something like:

    KERNEL=="sd*", SUBSYSTEM=="block", ENV=="TOSHIBA_DT01ACA100_248UZVBNS", SYMLINK+="mydisk%n"

ENV will be whatever the above command displayed it as, and SYMLINK+ will add symlinks for all your partitions (hence the %n - /dev/sdb1 will be /dev/mydisk1 and so on).

Read the link above but if you get stuck post the output of the two above commands to your original post (as a code block!) and then we can try to help you build a rule.

HTH!

Edit: Of course this superuser post goes into some detail too...