Author Topic: mount fat32 usb drive as read/write [solved --see page 3)]  (Read 3755 times)

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
mount fat32 usb drive as read/write [solved --see page 3)]
« on: July 19, 2012, 08:02:37 AM »
I have a USB fat32 drive that I have been using for years as read/write from my user account.  Now the whole USB drive mounts as read-only.  I went to the device notifier and told it to automount this drive, but there is no way to specify permissions.  When I use the root account, I still cannot write to the drive and I cannot change the permissions.  The USB drive is sdb, and it is not mentioned in \etc\fstab.  The partition I want to access is sdb1, which is the entire drive, Type: W95 FAT32 (LBA) (0xc).

Can someone guide me on changing the permissions or mounting so I can read/write this fat32 drive as a regular user?  

Here is \etc\fstab:

Code: [Select]
# Entry for /dev/sda5 :
UUID=4e39cdfa-a252-43f5-9f3b-12d873a6c7e5 / ext4 relatime 1 1
# Entry for /dev/sda7 :
UUID=7c5c22a9-b93b-43cc-9453-a4779326f711 /data ext2 defaults 1 2
none /dev/pts devpts defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
# Entry for /dev/sda6 :
UUID=b7f155f1-8f2f-4185-bd89-dedac49cb84c /home ext4 relatime,user_xattr 1 2
/dev/sr1 /media/cdrom auto umask=0,user,iocharset=utf8,noauto 0 0
/dev/sr0 /media/cdrom2 auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
# Entry for /dev/sda1 :
UUID=03646ff5-8618-4d22-b952-6ef7c83923a7 swap swap defaults 0 0

Thank you,

Jan
« Last Edit: July 22, 2012, 03:13:08 PM by Ditzian »

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #1 on: July 19, 2012, 10:05:38 AM »
I read up on fstab, and I would like verificaton that the following line added to fstab would mount the USB drive so I can use it:

Code: [Select]
/dev/sdb1 /media/sdb1 auto auto,user,noexec,rw,sync
I am most uncertain about columns 1 and 2.  /dev/sdb and /dev/sdb1 exist at present.  /media/sdb1 does not exist: /media exists, and  I am assuming that /media/sdb1 will be created by fstab.  I do not know how I would create /media/sdb1, except for simply creating an empty folder before I change fstab.

I realize that I will have to modify fstab as root.

I welcome corrections to the above.

Jan

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11055
  • MLUs Forever!
Re: mount fat32 usb drive as read/write
« Reply #2 on: July 19, 2012, 11:48:31 AM »
Why bother with an fstab entry at all?

I suggest you comment out the relevant entry in fstab (put  #  at the beginning of the line)

and try plugging in the USB device and accessing it ......  it should then auto mount under /media/ or mount there when an attempt is made to access it ......  those settings are editable by the user.

MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #3 on: July 19, 2012, 04:33:00 PM »
Why bother with an fstab entry at all?

I suggest you comment out the relevant entry in fstab (put  #  at the beginning of the line)

and try plugging in the USB device and accessing it ......  it should then auto mount under /media/ or mount there when an attempt is made to access it ......  those settings are editable by the user.

I do not see a relevant line in fstab.  I thought that line would deal with sdb. Sda 5, 6, and 7 are partitions on the main hard drive.  I assumed that I was dealing with a situation in which the USB would automount itself, which is what it used to do.  Which line is the relevant entry? 

Jan

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: mount fat32 usb drive as read/write
« Reply #4 on: July 19, 2012, 04:37:26 PM »
plug in your usb drive, open in as usual and then open the terminal, run the following commands and present their output

cat /etc/mtab

tail -n 20 /var/log/syslog
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11055
  • MLUs Forever!
Re: mount fat32 usb drive as read/write
« Reply #5 on: July 19, 2012, 04:39:10 PM »
Sorry ......  the line you quoted I had assumed you put it into the fstab file.



Did you have this drive connected to WIndows? ........  is it possible that it got locked there? .......  maybe not safely removing it could do that .......

MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #6 on: July 19, 2012, 05:15:57 PM »
plug in your usb drive, open in as usual and then open the terminal, run the following commands and present their output

cat /etc/mtab

tail -n 20 /var/log/syslog

I had to sign in as superuser or the tail did not work.  Here is the whole operation:

Code: [Select]
[root@localhost jan]# cat /etc/mtab
/dev/sda5 / ext4 rw,relatime,commit=0 0 0
none /proc proc rw 0 0
none /dev/pts devpts rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sda7 /data ext2 rw 0 0
/dev/sda6 /home ext4 rw,relatime,user_xattr,commit=0 0 0
none /tmp tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
/proc /var/lib/named/proc none rw,bind 0 0
/dev/sdb1 /media/My\040Book vfat rw,nosuid,nodev,uhelper=hal,uid=500,utf8,shortname=mixed,flush 0 0
[root@localhost jan]# tail -n 20 /var/log/syslog
Jul 19 12:13:16 localhost dbus[931]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Jul 19 12:15:46 localhost dbus[931]: [system] Activating service name='org.kde.powerdevil.backlighthelper' (using servicehelper)
Jul 19 12:15:46 localhost org.kde.powerdevil.backlighthelper: QDBusConnection: system D-Bus connection created before QCoreApplication. Application may misbehave.
Jul 19 12:15:46 localhost dbus[931]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Jul 19 12:16:57 localhost smartd[2417]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 114 to 115
Jul 19 12:18:16 localhost dbus[931]: [system] Activating service name='org.kde.powerdevil.backlighthelper' (using servicehelper)
Jul 19 12:18:16 localhost org.kde.powerdevil.backlighthelper: QDBusConnection: system D-Bus connection created before QCoreApplication. Application may misbehave.
Jul 19 12:18:16 localhost dbus[931]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Jul 19 13:31:29 localhost ntpd[3085]: synchronized to 69.36.227.90, stratum 2
Jul 19 14:09:12 localhost ntpd[3085]: synchronized to 67.18.187.111, stratum 2
Jul 19 15:13:20 localhost ntpd[3085]: kernel time sync status change 4001
Jul 19 15:30:23 localhost ntpd[3085]: kernel time sync status change 0001
Jul 19 16:04:32 localhost ntpd[3085]: kernel time sync status change 4001
Jul 19 16:16:57 localhost smartd[2417]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 102 to 103
Jul 19 17:12:49 localhost ntpd[3085]: kernel time sync status change 0001
Jul 19 18:26:38 localhost dbus[931]: [system] Activating service name='org.kde.powerdevil.backlighthelper' (using servicehelper)
Jul 19 18:26:38 localhost org.kde.powerdevil.backlighthelper: QDBusConnection: system D-Bus connection created before QCoreApplication. Application may misbehave.
Jul 19 18:26:38 localhost dbus[931]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Jul 19 19:09:27 localhost drakconf.real[4033]: modified file /etc/mcc.conf
Jul 19 19:10:45 localhost klogd: FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0)
[root@localhost jan]#

Jan

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #7 on: July 19, 2012, 05:18:30 PM »
Sorry ......  the line you quoted I had assumed you put it into the fstab file.



Did you have this drive connected to WIndows? ........  is it possible that it got locked there? .......  maybe not safely removing it could do that .......



It may be my error for using the code window for code that I did not actually run.  I will think about that.  I have not connected the drive to Windows that I remember.  I kept it in fat32 just in case, but I never actually use it in Windows, especially now that thumb drives are a cheap way to transfer large amounts of data.  I have had the drive for quite a few years.

Jan

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: mount fat32 usb drive as read/write
« Reply #8 on: July 19, 2012, 05:25:28 PM »
Sorry ......  the line you quoted I had assumed you put it into the fstab file.



Did you have this drive connected to WIndows? ........  is it possible that it got locked there? .......  maybe not safely removing it could do that .......



It may be my error for using the code window for code that I did not actually run.  I will think about that.  I have not connected the drive to Windows that I remember.  I kept it in fat32 just in case, but I never actually use it in Windows, especially now that thumb drives are a cheap way to transfer large amounts of data.  I have had the drive for quite a few years.

Jan


You have and error message... FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0)

Probably a good idea to run a filesystem check on that partition.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: mount fat32 usb drive as read/write
« Reply #9 on: July 19, 2012, 05:34:30 PM »

make sure the partition is not mounted and then run this command as root to repair the file system

fsck.msdos -aw /dev/sdb1

unplug it, plug it back in, mount it and check if you can now write ti it.

also give the output of

tail -n 10 /var/log/syslog
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #10 on: July 19, 2012, 07:54:01 PM »

make sure the partition is not mounted and then run this command as root to repair the file system

fsck.msdos -aw /dev/sdb1

unplug it, plug it back in, mount it and check if you can now write ti it.

also give the output of

tail -n 10 /var/log/syslog

I unmounted the partition using PCC, then did this:

Code: [Select]
[root@localhost jan]# fsck.msdos -aw /dev/sdb1
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
There are differences between boot sector and its backup.
Differences: (offset:original/backup)
  67:cd/54, 68:61/1f, 69:89/fb, 70:93/16
  Not automatically fixing this.
/mcmusic
  Contains a free cluster (8362624). Assuming EOF.
Unable to create unique name
[root@localhost jan]# tail -n 10 /var/log/syslog
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /dev/shm (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /tmp (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /proc (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /dev/pts (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /dev/shm (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /proc (and parents if necessary)
Jul 19 21:38:04 localhost diskdrake[6819]: created directory /tmp (and parents if necessary)
Jul 19 21:38:12 localhost diskdrake[6819]: calling umount(/dev/sdb1)
Jul 19 21:38:12 localhost diskdrake[6819]: running: umount /dev/sdb1
Jul 19 21:38:12 localhost diskdrake[6819]: modified file /etc/mtab
[root@localhost jan]#
Then I checked the device indicator and it said it could not mount the device.  I then unplugged the USB cable, waited about ten seconds until the disk light went off, and plugged it back in.  Device manager says it still cannot mount the device.

I went to PCC, set the mount point to /user and told it to mount the partition.  Device manager still thinks it is unmounted, and I cannot write to it.  When I go to user I see the contents, but I cannot write to it.  Also, I cannot start a file manager from the device manager, I must start it from the taskbar.

I used PCC to unmount it and then mounted it in /root/dev using PCC.  It says it did this, but I cannot find sdb1 or My_Book (the drive name).

Jan

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: mount fat32 usb drive as read/write
« Reply #11 on: July 19, 2012, 08:05:25 PM »

you were supposed to run the tail command right after you plugged in the device, you did other things first and those logs dont say anything about the drive.

it will be wise to back up all data in the drive .It could be on its way out.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Ditzian

  • Sr. Member
  • ****
  • Posts: 451
Re: mount fat32 usb drive as read/write
« Reply #12 on: July 19, 2012, 08:22:18 PM »
Muungwa,

I just unmounted the drive, unplugged it, plugged it back in,and did the tail:

Code: [Select]
[root@localhost jan]# tail -n 10 /var/log/syslog
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Write Protect is off
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Mode Sense: 21 00 00 00
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] No Caching mode page present
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Assuming drive cache: write through
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] No Caching mode page present
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Assuming drive cache: write through
Jul 19 22:15:45 localhost klogd:  sdb: sdb1
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] No Caching mode page present
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Assuming drive cache: write through
Jul 19 22:15:45 localhost klogd: sd 8:0:0:0: [sdb] Attached SCSI disk

Then I went to PCC and mounted it, and did the tail again:

Code: [Select]
[root@localhost jan]# tail -n 10 /var/log/syslog
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /tmp (and parents if necessary)
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /proc (and parents if necessary)
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /dev/pts (and parents if necessary)
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /dev/shm (and parents if necessary)
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /proc (and parents if necessary)
Jul 19 22:20:38 localhost diskdrake[11169]: created directory /tmp (and parents if necessary)
Jul 19 22:20:56 localhost diskdrake[11169]: mount_part: device=sdb1 mntpoint=/root/usr isMounted= real_mntpoint= device_UUID=9389-61CD
Jul 19 22:20:56 localhost diskdrake[11169]: mounting UUID=9389-61CD on /root/usr as type vfat, options
Jul 19 22:20:56 localhost diskdrake[11169]: created directory /root/usr (and parents if necessary)
Jul 19 22:20:56 localhost diskdrake[11169]: running: mount -t vfat UUID=9389-61CD /root/usr -o check=relaxed
[root@localhost jan]#

I must admit, I have no idea what I am doing or looking for.

Jan

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: mount fat32 usb drive as read/write
« Reply #13 on: July 19, 2012, 08:41:25 PM »

I must admit, I have no idea what I am doing or looking for.

Jan

You arent alone  :D,I only have one promise i made to myself when it comes to linux and the promise is not to mess with partitions and hard drives.

Hopefully somebody else who knows more about file systems and partitions will come along and help you out.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline djohnston

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6224
  • I don't do Windows
Re: mount fat32 usb drive as read/write
« Reply #14 on: July 19, 2012, 11:47:37 PM »
Ditzian,

I am still trying to figure out why you are creating mount points and manually trying to mount the drive. A removable USB drive will automatically mount in the /media directory if the filesystem has no errors. I don't know why you suddenly have problems with the drive, but I suspect it is all due to filesystem errors. As an example, and to duplicate what you have, I reformatted a USB thumb drive as FAT32 with a volume label of MY BOOK. Here is the mtab list, mount list, and permissions on my drive:

Code: [Select]
darrel@AMD64:  55 items 796Kb -> cat /etc/mtab
/dev/sda3 / ext4 rw 0 0
none /proc proc rw 0 0
none /dev/pts devpts rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda2 /boot ext4 rw 0 0
/dev/sda5 /home ext4 rw 0 0
/dev/sdb1 /mnt/Data ext4 rw,noexec,nosuid,nodev 0 0
/dev/sdc1 /mnt/Vault ext4 rw,noexec,nosuid,nodev 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
gvfs-fuse-daemon /home/darrel/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=darrel 0 0
/dev/sdd1 /media/MY\040BOOK vfat rw,nosuid,nodev,noatime,uhelper=hal,shortname=lower,uid=500,flush,utf8 0 0

darrel@AMD64:  55 items 796Kb -> mount
/dev/sda3 on / type ext4 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda2 on /boot type ext4 (rw)
/dev/sda5 on /home type ext4 (rw)
/dev/sdb1 on /mnt/Data type ext4 (rw,noexec,nosuid,nodev)
/dev/sdc1 on /mnt/Vault type ext4 (rw,noexec,nosuid,nodev)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /home/darrel/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=darrel)
/dev/sdd1 on /media/MY BOOK type vfat (rw,nosuid,nodev,noatime,uhelper=hal,shortname=lower,uid=500,flush,utf8)

darrel@AMD64:  55 items 796Kb -> ls -l /media | grep MY
drwxr-xr-x 3 darrel root 8192 Jul 20 00:22 MY BOOK/

darrel@AMD64:  55 items 796Kb ->

udev does all the mounting of the drive automatically as soon as it is inserted. Notice that my drive, /dev/sdd1, was automatically mounted on /media/MY BOOK. It should be the same with yours. You do not need to modify /etc/fstab or manually mount the drive when it is inserted.

I have no problems writing to the drive, or erasing existing files. You say you have never connected the drive to a Windows machine. If you do not intend to connect it to a Windows machine, I would highly recommend you reformat the drive to a journaling filesystem, such as ext3 or ext4. FAT32 does not have journaling capabilities, which can lead to sudden unrecoverable data loss in some situations. Do you have existing files on the drive that you need to recover?

I am 99% sure fsck.vfat should have been run on that drive. If you want to try to repair it again, first use the mount command to be sure that /dev/sdb1 is not mounted. Then run as root:

fsck.vfat -afv

a=automatically repair the file system
f=salvage unused chains to files
v=verbose mode

If you want to see the full list of options before beginning, enter:

fsck.vfat --help
Bare metal                           VBox
AMD Athlon 7750 Dual-Core    Single core
4GiB RAM                              1GiB RAM
nVidia GeForce FX 5200          64MB video
LXDE 32bit                            KDE 64bit

Registered Linux User #416378