You are not logged in.
Goal: Automatically mount my external usb drive to /g and share one folder from it with NFS.
Problems: Can't seem to get autofs to use the UUID or PARTUUID.
This is a USB 3.0 drive connected via a PCI-x addon card. When I unplug->plug in the usb cable, the drive can be found under /dev but after reboot, it is missing.
When the drive is present, it doesn't get a consistent drive letter. Once it was /dev/sdb and now it is /dev/sdg. If I use the current letter in an autofs map, I can get it to mount to /g but I haven't been able to get it to work with an ID, UUID, or PARTUUID.
Current auto.master http://pastebin.com/TAXzXwaB
Current auto.template http://pastebin.com/aGBgSTpr
Edit: Nevermind, I found that I can set a static name using a udev rule. I'll make a new thread about the detection problem.
Last edited by x79 (2016-08-22 20:52:37)
Offline
..... When the drive is present, it doesn't get a consistent drive letter.....
I wrote a script for my Ubuntu box to back-up my desktop to a USB external drive and then rsync this drive with a second backup. To get around the problem of inconsistent drive letters I used the uuid. The script first tests if the drive is mounted, if not, it uses udisksctl to mount the drive using the uuid identifier.
Here is the relevant code snippet:
#!/bin/bash
# Define path to disks
Backup1="/media/memyself/Backup1"
Backup2="/media/memyself/Backup2"
......
......
# Note uuid is a permanent way of identifying the disks and is found using "ls -al /dev/disk/by-uuid/"
# Check Backup1 is mounted (The HD)
if mount|grep $Backup1; then
echo "Backup1 already mounted"
else
udisksctl mount --block-device /dev/disk/by-uuid/232726ed-e565-4492-ac69-c350cb63a075
fi
# Check Backup2 is mounted (The SSD)
if mount|grep $Backup2; then
echo "Backup2 already mounted"
else
udisksctl mount --block-device /dev/disk/by-uuid/6e36624a-d91c-4bd0-86d0-45bfa22fc172
fi
Basically,
Give the drive a label
Find the uuid
Write a bash which uses udisksctl and the uuid to mount the device
Once mounted, you just refer to it by the label, (ie in the normal fashion)
I hope this helps,
Irvine
Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!
Offline
I wrote a script for my Ubuntu box to back-up my desktop to a USB external drive and then rsync this drive with a second backup. To get around the problem of inconsistent drive letters I used the uuid. The script first tests if the drive is mounted, if not, it uses udisksctl to mount the drive using the uuid identifier.
Here is the relevant code snippet:
#!/bin/bash # Define path to disks Backup1="/media/memyself/Backup1" Backup2="/media/memyself/Backup2" ...... ...... # Note uuid is a permanent way of identifying the disks and is found using "ls -al /dev/disk/by-uuid/" # Check Backup1 is mounted (The HD) if mount|grep $Backup1; then echo "Backup1 already mounted" else udisksctl mount --block-device /dev/disk/by-uuid/232726ed-e565-4492-ac69-c350cb63a075 fi # Check Backup2 is mounted (The SSD) if mount|grep $Backup2; then echo "Backup2 already mounted" else udisksctl mount --block-device /dev/disk/by-uuid/6e36624a-d91c-4bd0-86d0-45bfa22fc172 fi
Please forgive if I missed something simple, but I don't understand how I could use this and still use the drive as removeable.
Offline
Unlike the drive letter, the uuid number never changes. It is a unique device identifier.
Edit
More precisely, it never changes until you do something like a secure erase with hdparm, (I hope I spelled that right?)
Last edited by IrvineHimself (2016-08-22 18:40:46)
Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!
Offline
Before I created this thread, I tried both these entries in my autofs map
/g -fstype=auto,async,nodev,nosuid,umask=000 :/dev/disk/by-id/usb-Hitachi_HDS5C3030BLE-0:0-part1
/g -fstype=auto,async,nodev,nosuid,umask=000 PARTUUID="92df2442-d5d0-46b8-9276-aa3d099bcfd3"
Neither entry worked for me. This is the output of 'mount' when I use either of those definitions
/etc/autofs/auto.template on /g type autofs (rw,relatime,fd=18,pgrp=931,timeout=300,minproto=5,maxproto=5,direct)
I tried the same thing with UUID with the same effect.
Edit: Edited first post with links to config files
Last edited by x79 (2016-08-22 20:32:11)
Offline
Did you try mounting using the uuid number with udisksctl?
ie
udisksctl mount --block-device /dev/disk/by-uuid/92df2442-d5d0-46b8-9276-aa3d099bcfd3
I'm still new to Arch, so you may have to install the udisksctl utility(?)
Irvine
Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!
Offline
Did you try mounting using the uuid number with udisksctl?
ie
udisksctl mount --block-device /dev/disk/by-uuid/92df2442-d5d0-46b8-9276-aa3d099bcfd3
I'm still new to Arch, so you may have to install the udisksctl utility(?)
Irvine
I can use mount with the UUID or fstab with the UUID. What I couldn't get to work was using the UUID with autofs. What I'm going to do is write a udev rule to always give the drive a certain name (e.g. /dev/usb-g) and use autofs to automount it to /g. I've marked this thread as solved. Thank you for trying to help though.
Offline