Flash drive - How to mount without restarting
Posts: 165
Hi,
I just added a thumb drive to my Linux computer. It mounts fine if it is connected before I boot the computer. Since I use it to transfer data between Mepis and my Macintosh, is there a way to get it to mount if I plug it in while the computer is running?
Thanks,
Don
Insert your thumb drive
Posts: 205
Insert your thumb drive after you system is running and if it is not detected, open a terminal session and type the following command:
dmesg
That should tell you what the issue is.
David
error message
Posts: 165
OK, I tried that and got a whole long list. Here are the last few lines:
scsi0 (0:0): rejecting I/O to dead device
FAT: Directory bread(block 538) failed
scsi0 (0:0): rejecting I/O to dead device
FAT: Directory bread(block 539) failed
scsi0 (0:0): rejecting I/O to dead device
FAT: Directory bread(block 540) failed
Does this mean anything? It is not a SCSI device, it is USB.
Thanks for your help.
Don
I don't have a "mount" option
Posts: 165
I tried this. Right clicking on the sda1 folder does not give me a "mount" option. I get all the standard things for a folder, like rename, move, actions (no mount here either).
I using KDE, if that makes a difference.
Thank you for your time.
don
Hi Don. Open Konqueror and
Posts: 14
Hi Don. Open Konqueror and on the menu bar, click on "GO" and scroll down to devices. You should see all your drives there. Click on the icon that represents your flash drive. You can also right click on the icon and choose mount.
Re: Flash drive - How to mount without restarting
Posts: 519
I just added a thumb drive to my Linux computer. It mounts fine if it is connected before I boot the computer. Since I use it to transfer data between Mepis and my Macintosh, is there a way to get it to mount if I plug it in while the computer is running?
Hi Don,
I have the same problem on my new Gateway M675 PRR laptop, but a relative who owns the same model for 14 months does not have the problem. His will mount a SanDisk automatically and mine won't unless I have it plugged in when I boot up. So the problem even varies from series to series within the same model.
However, there is a way to work around it.
First, find out what scsi drive it is seen as:
dmesg | grep "SCSI device"
You will see something in the output like "sdx", where x is "a" or "b" or "c" or "d" ... etc.
Assume it is sdb.
Then, in a console box as root, do
fdisk -l /dev/sdb
This command always has to be used.
Say the drive is sdb1. Then issue
mount -t vfat -o users /dev/sdb1 /mnt/flashdrive
assuming the directory flashdrive exists under /mnt. If not use mkdir to make it.
Almost immediately a drive icon will appear on your desktop.
Close your root console box.
You can click on it, which will open Konqueror, and then you can browse.
To unmount it just right click on the desktop icon and choose 'umount'. It will unmount
You can put these bash lines in a bash script called, say, "mountthumb", for example:
<br /> #!/bin/bash<br /> fdisk -l /dev/sdb<br /> mount -t vfat -o users /dev/sdb1 /mnt/flashdrive<br />
and store it in /etc. Don't forget to mark it executable.
Then you can create a desktop icon to it.
==
GreyGeek
flash usb and fstab chaos
Posts: 13
I have tried the same and now I have a bit fstab chaos.
Fact 1.: my usb flash was before /dev/sda - it does not matter in which distro - redhat or mepis
Fact 2.: now mepis has in /etc/fstab this:
/dev/sda1 /mnt/flash .....
Why this? if I try to mount, it screams - sda1 is not a valid block device...
with mount /dev/sda /mnt/flash is all ok
This almost works
Posts: 165
Hi GreyGeek,
I appreciate the detailed instructions. They were very easy to follow.
This worked perfectly to mount the drive. However, when I do this I do not have premission to read or write to the drive. I tried changing the permissions and the message says I can't change permissions for a device.
I started as a user, but it asked me to su to root before it would accept the line "mount -t ....
I tried unmounting and remounting in Konqueror and that idid not help.
Thanks you very much,
Don
This partly works
Posts: 165
Hi, f_favila,
If I boot without the drive, I still don't see it in Konqueror and can't click it to mount. But if I boot with it, I can mount and unmount it forever after that, so this will help me for the time being.
Thank you very much,
Don

Re: Flash drive - How to mount without restarting
Posts: 380
Then, in a console box as root, do
fdisk -l /dev/sdb
This command always has to be used.
Why is the fdisk command needed here?
Re: Flash drive - How to mount without restarting
Posts: 232
Hi,
I just added a thumb drive to my Linux computer. It mounts fine if it is connected before I boot the computer. Since I use it to transfer data between Mepis and my Macintosh, is there a way to get it to mount if I plug it in while the computer is running?Thanks,
Don
You say it works fine if it's connected before boot? Here's what you do, then (if I'm understanding you correctly). Boot it up with the thumb drive plugged in (so that it mounts fine). Then go straight to the etc/fstab file. Open it up as root. Do you see how there's a top section and a bottom section? The top section is static stuff that's always mounted. The bottom section is dynamic stuff that's mounted when it's recognized.
Most likely your cold-plug (plugged in before boot) thumb drive will be in the bottom section. Copy it and put it in the top section. Make sure you delete the part that says users, and change noauto to auto.
Have you tried: chmod 777
Posts: 2
Have you tried:
chmod 777 /dev/whatever_your_USB_drive_is
Or hows your fstab file? You have to add it to the static section to be able to mount it without the boot and reboot. Open that file and copy the line from dinamic to static, and to be able to change its contents you have to watch that line to see if it is something like this one:
/dev/sda1 /mnt/name_of_USB auto user,rw,noauto 0 0
Hope this helps.
Cheers.
Here's what I tried in the
Posts: 165
Here's what I tried in the console:
root@1[dpjungk]# fdisk -l /dev/sda1
mount -t vfat -o users /dev/sda1 /mnt/flashdrive
root@1[dpjungk]# chmod 777 /dev/sda1
At this pont the drive appeared on the desktop,
but I still can't read it.
root@1[dpjungk]# chmod 777 /dev/sda1 /mnt/flashdrive
root@1[dpjungk]#
still can't read it.
Am I using the chmod command incorrectly?
Another Poster here told me about the fstab file. It mounts fine, but also leads to the same place where I don't have permission to read or write.
I am very greatful for the help of all of the people here.
thank you very much,
Don
try this
Posts: 13
as I posted before, try this
1. umount /dev/sda1
2. mount /dev/sda /mnt/your_mount_point
this might works for me, if my usbflash has only one partition. with sda1 is mounting impossible.
I don't think you're using
Posts: 232
I don't think you're using the chmod command correctly. There's usually only one object in the command chmod ### object. /dev/sda1 is the device location. /mnt/flashdrive is where it's mounted. You should pick just /mnt/flashdrive if you're changing permissions.
Any reason you're not just doing it with a right-click on the mount through GUI? Do you prefer the command-line?
By the way, I think only root can change permissions for all files. Make sure you're logged in as root.
It's almost right
Posts: 165
Thank you to all of you for your help. I've tried every suggestion and I can mount the drive three different ways. But, unless the drive is connected at bootup, it will be unreadable. Once booted with the drive, I can mount and unmount as many times as I need, so basically this works. I simply remember to put it on the Linux computer at startup and then I can transfer info between the two computers all day.
Again, I'm very appreciative of all your help.
Don

additional help with this?
Posts: 321
I have succeeded in following the above directions, I get an icon on my desktop for my flashdrive. But only root has RW access. How do I change it so I have access as a user?
Here is my rev. fstab setting (the flashdrive is sda1):
# Static entries below, do not use 'users' option in this area
/dev/hda3 / ext3 defaults,noatime 1 1
/dev/hda2 swap swap sw,pri=1 0 0
/dev/sda1 /mnt/sda1 vfat auto,exec,umask=000 0 0
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
# Dynamic entries below, identified by 'users' option
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro,umask=0222 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,users,dev,ro 0 0
/dev/floppy /mnt/floppy vfat,ext2,hfsplus noauto,users,dev,sync,dirsync 0 0
/dev/cdrom1 /mnt/cdrom1 udf,iso9660 noauto,users,dev,ro 0 0
I believe in my heart it's a simple tweak, thank you for your help
:study:
HW
--
we may come, touch and go, from atoms and ifs, but we're presurely destined to be odds without ends

not quite it
Posts: 321
I tried that, still not getting anywhere.
"Only root can mount /dev/sda1 on /mnt/sda1"
I tried (guessing wildly) typing "chmod 777 /mnt/sda1"
Still no user mount
--
we may come, touch and go, from atoms and ifs, but we're presurely destined to be odds without ends

addenda
Posts: 321
In addition, I don't know how to execute the advice given above, viz.
(quote)
You can put these bash lines in a bash script called, say, "mountthumb", for example:
#!/bin/bash
fdisk -l /dev/sdb
mount -t vfat -o users /dev/sdb1 /mnt/flashdrive
and store it in /etc. Don't forget to mark it executable.
Then you can create a desktop icon to it.
*cut here*
what does "#!/bin/bash" mean? Does that line belong "in the script"? Do I write those three lines (modified for my drive) and save as "thumbmount.bash" in /etc/ ? How do I mark it as executable?
thanks
--
we may come, touch and go, from atoms and ifs, but we're presurely destined to be odds without ends

It's resolved!
Posts: 321
I may not have restarted when I attempted to make the "umake=022" change above.
Be that as it may: here is the fstab line (in the top part! The static part) that works:
/dev/sda1 /mnt/sda1 vfat auto,users,exec,umask=022 0 0
I ran into some instructions elsewhere on the web that say "users" is what indicates access. So even though the static section says "don't put users here", if you want your users to have access to the device to mount/unmount, this must be included.
Though, like I say, maybe it was the "022"...
Thanks for your help!
--
we may come, touch and go, from atoms and ifs, but we're presurely destined to be odds without ends

Shell Command Decryption
Posts: 5513
Hi HW!
I've been following this thread for days and it's great that you all have been able to figure it out. I shall not add anything to the discussion since you've done a bang up job already!
I will, however, try to translate some of the "code"
The "#!/bin/bash" is also affectionatly known as "shebang". The "#!" is really the shebang because "#" is known as "shell" and "!" is "bang" (don't ya love programmers
)
It is not a comment, it is an instruction to the shell you're currently running to inform it that the commands to follow should be run using the shell specified. In other words, you may be using the bash shell, /bin/bash, but you might have a shell script that you want to use the "c" shell, /bin/csh. In that case, you'd start your script with "#!/bin/csh". The most common entries are /bin/sh and /bin/bash.
To make the script executable, once you've filed it, change the permissions to add the "x" flag. You can do that with:
chmod +x filename
That will give all users execute rights.
Jon

Thanks for the info,
Posts: 321
Thanks for the info, Jon
--
we may come, touch and go, from atoms and ifs, but we're presurely destined to be odds without ends
Works for me too
Posts: 165
I'm the original poster of this question. I want to thank all of you who kept this thread alive after I was going to give up and just restart every time.
the line with the umask=022 that worked for hitheringwaters works here too.
thank you,
DJ
Possible solution to mounting USB device
Posts: 6
Rossco
For anybody out there who was having the same problem mounting their usb pendrive carry out the following instructions:
1. Open a konsole and become root
2. cd to /mnt
3. create a directory called "sda"
4. carry out: chmod 777 sda
5. open the file /etc/fstab with kwrite or some other editor
i.e. kwrite /etc/fstab
6. Under this line: /dev/hda6 swap swap sw,pri=1 0 0
enter the following entry:
/dev/sda /mnt/sda vfat users,exec,noauto,umask=000 0 0
I know it there is a comment on the 1st line of the file saying not
to use the "users" option but ignore this!
7. save the newly altered file
8. exit the konsole and reboot your machine
9. login to SimplyMepis 3.3.1
10. plug in usb device
11. right click on the "Hard Disc - sda" desktop icon and choose the
"mount" option.
12. start konqueror and you should be able to access the files on your
usb pendrive
add to static entries of
Posts: 60
add to static entries of /etc/fstab
/dev/sda /mnt/sda vfat users,exec,noauto,umask=000 0 0
Then install gnome-volume-manager
apt-get install gnome-volume-manager
As u put your flash drive into usb port, u acn see the contents of ur flash drive automatically.
Additional information...
Posts: 4
Hi, I just wanted to thank everyone for their comments here. You were a big help. Now I can finally access my drive without rebooting! Thank you so much!
I was having the exact same problem with my IBM e26 (desktop). Only what I have is a laptop HD in an external box which runs entirely off the USB port (I'd rather have 40GB for $50 than 256MB for $20). I have it formatted in two partitions: a 28.5 GB FAT 32 and an 8.6 GB NTFS.
First of all, I found out when I unplugged the drive and plugged it back in, clicking on the sda1 icon on the desktop didn't open the drive. AFTER YOU UNPLUG THE DRIVE, YOU MUST UNMOUNT THE DRIVE. When you plug it back in, you have to remount it and then you can access it. You can unmount by right-clicking on the icon for your drive (it will probably say something like "sda" or "sda1") and click "unmount".
Also, for anyone who has more than one partition, in your fstab file you must add a line for each partition you have. A section of my fstab file now reads:
...
/dev/sda1 /mnt/sda1 fat32 users,exec,noauto,umask=000 0 0
/dev/sda5 /mnt/sda5 ntfs users,exec,noauto,umask=000 0 0
...
NOTE: you have to find out whether your second partition is a primary partition or an extended partition. (It's easy to do this with QTParted) My second partition is a primary partition, so it is sda5. If it were an extended partition, it would be sda2. Hope this helps someone.
K. M.
Install hal. It will mount
Posts: 60
Install hal. It will mount it automatically
#apt-get install hal.

Re: Additional information...
Posts: 4864
AFTER YOU UNPLUG THE DRIVE, YOU MUST UNMOUNT THE DRIVE. When you plug it back in, you have to remount it and then you can access it. You can unmount by right-clicking on the icon for your drive (it will probably say something like "sda" or "sda1") and click "unmount".
K. M.
Sorry, please UNmount, then UNplug.
You may have information only half transferred, and the system won't unmount until ready.
also, about hal - you need a kernel like 2.6.12 to run hal
Enabling flash drive automount with a simple script
Posts: 2
This is how I got it to work with a simple script. 
Create a script usb-storage in /etc/hotplug/usb. Give it execution permision. Copy paste the following;
<br />
#!/bin/bash<br />
BOOT_CONFIG=1<br />
#Sleep a bit until the device get settled. Try increasing this if your machine/driver is slow<br />
sleep 5<br />
#Let's check whether ther is a device and its configuration is 1<br />
CONFIG_PATH=/sys${DEVPATH%/?*}/bConfigurationValue<br />
# Use the system log. So check /var/log/messages for errors and info<br />
log () {<br />
logger -t usb_storage_hotplug $@<br />
}</p>
<p>log "Reading configuration from "${CONFIG_PATH}<br />
if [ 0`cat $CONFIG_PATH` -eq $BOOT_CONFIG ];<br />
then<br />
log "Found a usb device "${DEVICE}<br />
/usr/sbin/meusb ${PRODUCT} ${REMOVER} > /dev/null 2>&1<br />
else<br />
#Problem, looks like there is a device error<br />
log "Unable to mount: Device error on "${DEVICE}<br />
fi<br />
Verify you have meusb in /usr/sbin.
This should work fine for most of you.
I just connect my
Posts: 14
I just connect my thumb/flash/pen drive then go to /mnt folder and it shows up there. I right click on the icon that represents the flash/thumb/pen drive and choose mount. You can also just double click on the icon and it should mount. If all fails try this in a shell(command line).... type(without the quotes) "mount /dev/sda1".