Mounting USB Flash Stick by Hand
Novell Cool Solutions: Trench
By Phillip Hamilton-Wilks
|
Digg This -
Slashdot This
Posted: 12 Nov 2004 |
Applies to: SuSE 9.1
You plug in your usb memory stick as a user but somehow you cannot write to it. Here's the solution.
/My stick is recognised as /dev/sda and I want to access it as phill in the folder /mnt/flash/ phill@localhost:~$ whoami phill phill@localhost:~$ mount /dev/sda mount: can't find /dev/sda in /etc/fstab or /etc/mtab /so nothing has been entered in fstab and you cannot mount it anyway. switch to root and make a folder for the stick if it is not there already./ phill@localhost:~$ su - Password: localhost:~# whoami root localhost:~# mkdir /mnt/flash/ localhost:~# ls -al /mnt total 12 drwxr-xr-x 3 root root 4096 Sep 16 23:16 . drwxr-xr-x 23 root root 4096 Sep 20 20:18 .. drwxr-xr-x 2 root root 4096 Sep 16 23:16 flash /so when nothing is mounted the folder flash as read for everyone. Now mount the stick manually as root./ localhost:~# mount -t vfat /dev/sda /mnt/flash localhost:~# ls -al /mnt total 30 drwxr-xr-x 3 root root 4096 Sep 16 23:16 . drwxr-xr-x 23 root root 4096 Sep 20 20:18 .. drwxr--r-- 7 root root 22016 Jan 1 1970 flash /No, it is only accessable for root. Unmount the stick because we want a normal user to be able to mount it/ localhost:~# umount /mnt/flash localhost:~# ls -al /mnt total 12 drwxr-xr-x 3 root root 4096 Sep 16 23:16 . drwxr-xr-x 23 root root 4096 Sep 20 20:18 .. drwxr-xr-x 2 root root 4096 Sep 16 23:16 flash / all users get read access again. Check it anything is already in /etc/fstab. Hmmmm Nothing./ localhost:~# cat /etc/fstab # /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 /dev/hda5 none swap sw 0 0 /dev/hda3 / ext3 defaults,errors=remount-ro 0 1 /dev/hdc /media/cdrom iso9660 ro,user,noauto 0 0 /dev/fd0 /media/floppy auto rw,user,noauto 0 0 /dev/hdc /cdrom iso9660 ro,user,noauto 0 0 /open /etc/fstab and add a line (the last one here) so otto normal users can mount it. Note: "users" not "user" is entered./ localhost:~# vim /etc/fstab # /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 /dev/hda5 none swap sw 0 0 /dev/hda3 / ext3 defaults,errors=remount-ro 0 1 /dev/hdc /media/cdrom iso9660 ro,user,noauto 0 0 /dev/fd0 /media/floppy auto rw,user,noauto 0 0 /dev/hdc /cdrom iso9660 ro,user,noauto 0 0 /dev/sda /mnt/flash vfat users 0 0 /logout and become otto normal user/ localhost:~# exit logout phill@localhost:~$ whoami phill try to mount phill@localhost:~$ mount /mnt/flash/ /Yippeeeee. Quick check of rights on the mount. Look phill is now the stick owner./ phill@localhost:~$ ls -al /mnt/ insgesamt 30 drwxr-xr-x 3 root root 4096 2004-09-16 23:16 . drwxr-xr-x 23 root root 4096 2004-09-20 20:18 .. drwxr--r-- 7 phill phill 22016 1970-01-01 01:00 flash /attempt to write a file on the stick./ phill@localhost:~$ cd /mnt/flash/ phill@localhost:/mnt/flash$ touch cheesepie.txt phill@localhost:/mnt/flash$ /do not forget to cd out of the flash folder before you unmount it.../
If you have any questions you may contact Phillip at wilks@fischerpanda.de
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

