mount

mount by using UUID to get around the problem of drive assignments moving after a boot.

findfs - Find a filesystem by label or UUID

findfs UUID=61bd904a-2131-40f3-a0dd-58cad77f8620

to find the UUID use

ls -l /dev/disk/by-id
ls -l /dev/disk/by-uuid

Script

#!/bin/bash

# usage
# mount-by-uuid.sh 61bd904a-2131-40f3-a0dd-58cad77f8620
# mount-by-uuid.sh 61bd904a-2131-40f3-a0dd-58cad77f8620 umount
#
# 61bd904a-2131-40f3-a0dd-58cad77f8620 is UUID od 1TB drive

# Mount a drive on whatever device the system has chosen using UUID
# 1st arg the disk UUID
# 2nd arg umount

uuid=$1

# FIND uuid and /dev/sdxx et. al
# ll /dev/disk/by-id
# ll /dev/disk/by-uuid

# 1TB Drive get /dev/sdxx
dev=`/sbin/findfs UUID=$uuid`
echo "$dev uuid=$uuid"

# mount or umount? if >= 2 args we umount
if [ $# -ge 2 ]; then
/bin/umount $dev
else
/usr/bin/gnome-mount -d $dev -m $uuid
fi




Custom Search