Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Linux in General => Linux Development & Programming => Topic started by: Ricky on November 25, 2003, 11:01:16 AM
-
Hi guys... i m here with a script which can mount your Fat partitions (windows partition) automatically....
I have tested it.. but i m inviting outher people to test it and if it has any problem please correct that or tell me.
#!/bin/bash
label[1]="C"
label[2]="D"
label[3]="E"
label[4]="F"
label[5]="G"
label[6]="H"
label[7]="I"
label[8]="J"
label[9]="K"
label[10]="L"
fdisk -l | grep Win95 | grep -v Extended | grep -v "Ext'd" | cut -f 1 -d" " > /tmp/scriptdump
echo "Checking FAT partitions...."
i="1"
suffix=""
found="false"
working="true"
while read device
do
if [ $working = "true" ]
then
echo "#The Partition Found by Script" >> /etc/fstab
echo -e "Found Windows FAT partition(s). \nMounting them ..."
working="false"
fi
found="true"
echo "$device /mnt/${label[$i]}$suffix"" vfat defaults 0 0" >> /etc/fstab
mkdir /mnt/${label[$i]}$suffix""
done < /tmp/scriptdump
if [ $found = "true" ]
then
echo "# Partition mounted by script" >> /etc/fstab
mount -a -t vfat
echo -e "\nSuccessfully mounted Windows partitions"
else
echo -e "\nNo Windows (FAT) partitions found\n"
fi
rm -f /tmp/scriptdump
Copy this script to a file name :: "mountfat" and then chmod this file to 755 and then execute this script...
You should be login as root to run this script..
-
hey ricky
why donot we put the partitions to mount in fstab it will mount at startup and also unmount at shutdown.
-
Hmm.. that script needs to be run only once.. it will autmatically give make the entries in your fstab so that you get your fat partitions mounted automatically every time you boots..
-
how do i mount an NTFS partition
-
Your question is already answered here..
http://www.linuxsolved.com/forums/viewtopic.php?t=118 in first reply there
-
I have four windows partitions ,c , d ,e ,f .use this script ,only mount partion c,can't mount other parttiions.why?
-
:( Hi ricky, i copied ur script on how mount fat partitions and i tried it. it works alright but it mounts only one fat partition a time. i have 3 fat partitions and when i restart linux it sometimes mount either of the 3 but not all and when i type df at the terminal i have duplicated drives mounted. how do i solve this problem. am kind of a newbie thanks. u've got the brain ricky.
-
I dont think we have to write such a long script.
we can edit the gile /etc/fstab and put enteries of partitions to be mounted automatically.
They will be mounted during booting.
:lol:
-
hello again guys...i tried typing the script then saving it to mountfat then typing chmod automount 755 but it just won''t work...do i have to save the script with a .txt extension or another? i'm kinda' lost...i also tried tinkering with the /etc/fstab but i really don't know how to add my fat partition...my fat partitions are hd8 and hd7...help please...