I've learned (the hard way..a couple of times now) that a mal-formed
entry in /etc/fstab using ntfs-3g and a device's UUID will hang the
system on boot. E.g., if fstab contains:
Code:
--------------------
# <file system> <mount point> <type> <options> <dump>
<pass>
UUID=E032CB5F32CB38F4 /mnt/media ntfs-3g
rw,defaults,noatime,umask=0000 0 0
--------------------
..but the drive with that UUID has been removed from the system, the
system won't boot. I was reduced to booting using system recovery
media and editing /etc/fstab to remove the offending line.
It would seem that the obvious solution would be to check for the
existence of the ntfs formatted device at boot time with the
/etc/rc.local script, and mount it then. Except, that's a little
cumbersome if squeezeboxserver is setup with its library on the ntfs
drive in question.
Anyone have a bright idea about how to work around this...a way to
prevent the system from hanging on boot?
In the mean time, here is my script for setting the 1st NTFS formatted
device to automount via fstab using the device's UUID:
mount-audiohd.sh:
Code:
--------------------
#!/bin/bash
#-------------------------------------------------------
# Script to set the 1st ntfs formatted device to auto-mount
# via fstab using its UUID
#
MOUNTPOINT=/mnt/media
#-------------------------------------------------------
# Backup fstab...
MOUNTFILE=/etc/fstab
cp -f $MOUNTFILE $MOUNTFILE.bak
#-------------------------------------------------------
# Set up mount point..
if [ ! -d "$MOUNTPOINT" ];
then
echo "Creating $MOUNTPOINT"
mkdir "$MOUNTPOINT"
chmod 777 "$MOUNTPOINT"
fi
#-------------------------------------------------------
# Remove any existing ntfs-3g mount points..
sed -i '/ntfs-3g/d' $MOUNTFILE
#-------------------------------------------------------
# Get the 1st NTFS formatted device..
NTFSDEV=`blkid | grep "ntfs" | sed -e 's/\(^.*\)\:.*$/\1/'`
ISMOUNTED=`mount -l | grep "$NTFSDEV"`
if [ -n "$NTFSDEV" ];
then
if [ -n "$ISMOUNTED" ];
then
echo "Unmounting $NTFSDEV.."
umount "$NTFSDEV"
fi
else
echo 'No NTFS formatted devices found!!'
exit 1
fi
#get the UUID for the device..
HDUUID=`/sbin/blkid -o value -s UUID $NTFSDEV`
if [ -n "$HDUUID" ];
then
echo "Setting $NTFSDEV to automount in $MOUNTFILE using uuid $HDUUID.."
echo "UUID=$HDUUID
/mnt/media ntfs-3g rw,defaults,noatime,umask=0000
0 0" >>$MOUNTFILE
mount -a
echo 'Device mounted:'
mount -l | grep "fuseblk"
else
echo "No UUID for device $NTFSDEV !!!"
exit 1
fi
exit 0
--------------------
Again, because I know just enough bash to be a danger to myself and
others, any commentary / criticism is welcome.
--
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=79161
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix