i want to mount all drives automatically to mount them in a script.
Do you now how a script can test the format?
With this script i can mount all drives but the ntfs drives are then read only!
Code: Select all
!/bin/bash -a
# Sort out swap and mounted partitions
blkid | egrep '(hd|sd)' | egrep -v "/dev/loop*" | egrep -v "swap" | cut -f 1 -d ':' | sed 's/\/dev\///'>/tmp/list_of_drives
for drive in `cat /tmp/list_of_drives` ; do
mkdir -p /mnt/$drive
mount /dev/$drive /mnt/$drive
echo $drive
done
exit 0
Code: Select all
mount -t ntfs /dev/$drive /mnt/$drive
Code: Select all
blkid | egrep '(hd|sd)' | egrep -v "/dev/loop*" | egrep -v "swap" | cut -f 1 -d ':' | sed 's/\/dev\///'>/tmp/list_of_drives
for drive in `cat /tmp/list_of_drives` ; do
mkdir -p /mnt/$drive
if [ "`blkid /dev/$drive | grep -o "TYPE=.*" | cut -f2 -d '"'`" = "ntfs" ]; then
mount -t ntfs /dev/$drive /mnt/$drive
else
mount /dev/$drive /mnt/$drive
fi
echo $drive
done
Greetings
Wolfgang