linux - How do you auto mount hot swappable sata drives based on what sata port it is attached to?

07
2014-07
  • user335020

    I'm looking to auto mount hot swappable sata hdd's. There are multiple drives so identifying them via their UUID's is out of the question. I've searched but can't find a suitable option. The partitions on the drives may also be different so I can't make a symlink when sdb1 is entered for example as the mount point may be on a different partition like sdb5 on different HDD's. I've looked at mounting the partition to a label based on when something is plugged in to a specific sata port for example ata1 = "/media/disk1" ata2 = "/media/disk2", which would seem to be an ideal solution but haven't been able to get that to work. I'm using lubuntu 14.04.

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    linux - Auto-mount USB drives read-only
  • BennyInc

    I'm currently setting up a laptop for my grandparents to use. They have never used a computer before, so I'm trying to make this as fool-proof as possible. The system will be setup with Ubuntu 10.10.

    In order to save them the hassle of having to unmount USB drives before disconnecting them, I would like to have all USB drives auto-mounted as read-only (possible use cases for now only include them getting data from people, not them copying anything to the drive).

    I have so far found that gnome-volume-manager is responsible for the handy auto-mount, but I didn't find any way to set options, like always mounting drives read-only.

    Is that possible? If so, how?


  • Related Answers
  • SleighBoy

    At this point I'll assume your system uses Udev and not HAL. So you want to create a rule file in /etc/udev/rules.d/ named, as an example, 25-usb-read-only.rules

    In that file put this:

    KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0555"
    

    Restart udev or reboot and you should be set.

  • Ignacio Vazquez-Abrams

    hal controls the options used when volumes are automounted.