
Hi All, I recently copied some files onto a USB stick, but now, I cannot delete them from the stick as the fs is readonly. I have tried to chmod, but no luck. I have tried to chmod as roo, still no good. Then I remembered that the fstab sometimes mounts removable devices readonly, but the only drives referenced in fstab are the swap, / and /home partitions. Where would I be able to change the permissions for this drive, please? OpenSuse 13.1 Andrew Greig

Andrew Greig <pushin.linux@gmail.com> wrote:
Hi All,
I recently copied some files onto a USB stick, but now, I cannot delete them from the stick as the fs is readonly. I have tried to chmod, but no luck. I have tried to chmod as roo, still no good. Then I remembered that the fstab sometimes mounts removable devices readonly, but the only drives referenced in fstab are the swap, / and /home partitions. Where would I be able to change the permissions for this drive, please? OpenSuse 13.1
It could be due to file system corruption. Have a look at your kernel logs to see whether there's an error message when you mount the file system. Also, when you run the mount command, do you get any error messages?

On Sun, 2014-05-11 at 18:29 +1000, Jason White wrote:
Andrew Greig <pushin.linux@gmail.com> wrote:
Hi All,
I recently copied some files onto a USB stick, but now, I cannot delete them from the stick as the fs is readonly. I have tried to chmod, but no luck. I have tried to chmod as roo, still no good. Then I remembered that the fstab sometimes mounts removable devices readonly, but the only drives referenced in fstab are the swap, / and /home partitions. Where would I be able to change the permissions for this drive, please? OpenSuse 13.1
It could be due to file system corruption. Have a look at your kernel logs to see whether there's an error message when you mount the file system. Also, when you run the mount command, do you get any error messages?
Hi Jason, Thanks for the reply, here is the tail of dmesg [ 6797.283201] usb 1-1: USB disconnect, device number 2 [ 6916.289618] usb 1-1: new high-speed USB device number 3 using ehci-pci [ 6916.423407] usb 1-1: New USB device found, idVendor=13fe, idProduct=5500 [ 6916.423424] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6916.423433] usb 1-1: Product: USB DISK 3.0 [ 6916.423442] usb 1-1: Manufacturer: [ 6916.423449] usb 1-1: SerialNumber: 90003658B035F027 [ 6916.427618] usb-storage 1-1:1.0: USB Mass Storage device detected [ 6916.427941] scsi3 : usb-storage 1-1:1.0 [ 6917.432272] scsi 3:0:0:0: Direct-Access USB DISK 3.0 PMAP PQ: 0 ANSI: 6 [ 6917.434522] sd 3:0:0:0: Attached scsi generic sg2 type 0 [ 6918.136636] sd 3:0:0:0: [sdb] 31555584 512-byte logical blocks: (16.1 GB/15.0 GiB) [ 6918.137786] sd 3:0:0:0: [sdb] Write Protect is off [ 6918.137803] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00 [ 6918.139522] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.139542] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.145683] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.145702] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.147147] sdb: sdb1 [ 6918.151671] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.151687] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.151700] sd 3:0:0:0: [sdb] Attached SCSI removable disk [ 6931.390696] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [ 6933.198312] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0) [ 6933.198326] FAT-fs (sdb1): Filesystem has been set read-only [ 6964.187889] sdb: detected capacity change from 16156459008 to 0 The last line is a bit disturbing. I have read the man on fsck, but I am struggling with the syntax. linux-sbl1:/home/andrewg # lsusb Bus 001 Device 003: ID 13fe:5500 Kingston Technology Company Inc. Bus 002 Device 002: ID 0c45:6321 Microdia Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub I do not want to run it in parallel with the root filesystem, I tried to nominate /dev/sdb1 and when that didn't work tried /dev/USB0 ... nothing. Could you recommend the syntax, please? Andrew

Is there any chance this drive was inserted into a windows machine and not removed "safely"? If so it may be possible to mount it again in windows and then remove it properly to restore its read/write status. If not you could try using fsck.vfat in linux to try and repair. On 11/05/14 20:02, Andrew Greig wrote:
On Sun, 2014-05-11 at 18:29 +1000, Jason White wrote:
Andrew Greig <pushin.linux@gmail.com> wrote:
Hi All,
I recently copied some files onto a USB stick, but now, I cannot delete them from the stick as the fs is readonly. I have tried to chmod, but no luck. I have tried to chmod as roo, still no good. Then I remembered that the fstab sometimes mounts removable devices readonly, but the only drives referenced in fstab are the swap, / and /home partitions. Where would I be able to change the permissions for this drive, please? OpenSuse 13.1 It could be due to file system corruption. Have a look at your kernel logs to see whether there's an error message when you mount the file system. Also, when you run the mount command, do you get any error messages? Hi Jason, Thanks for the reply, here is the tail of dmesg
[ 6797.283201] usb 1-1: USB disconnect, device number 2 [ 6916.289618] usb 1-1: new high-speed USB device number 3 using ehci-pci [ 6916.423407] usb 1-1: New USB device found, idVendor=13fe, idProduct=5500 [ 6916.423424] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6916.423433] usb 1-1: Product: USB DISK 3.0 [ 6916.423442] usb 1-1: Manufacturer: [ 6916.423449] usb 1-1: SerialNumber: 90003658B035F027 [ 6916.427618] usb-storage 1-1:1.0: USB Mass Storage device detected [ 6916.427941] scsi3 : usb-storage 1-1:1.0 [ 6917.432272] scsi 3:0:0:0: Direct-Access USB DISK 3.0 PMAP PQ: 0 ANSI: 6 [ 6917.434522] sd 3:0:0:0: Attached scsi generic sg2 type 0 [ 6918.136636] sd 3:0:0:0: [sdb] 31555584 512-byte logical blocks: (16.1 GB/15.0 GiB) [ 6918.137786] sd 3:0:0:0: [sdb] Write Protect is off [ 6918.137803] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00 [ 6918.139522] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.139542] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.145683] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.145702] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.147147] sdb: sdb1 [ 6918.151671] sd 3:0:0:0: [sdb] No Caching mode page found [ 6918.151687] sd 3:0:0:0: [sdb] Assuming drive cache: write through [ 6918.151700] sd 3:0:0:0: [sdb] Attached SCSI removable disk [ 6931.390696] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [ 6933.198312] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0) [ 6933.198326] FAT-fs (sdb1): Filesystem has been set read-only [ 6964.187889] sdb: detected capacity change from 16156459008 to 0
The last line is a bit disturbing. I have read the man on fsck, but I am struggling with the syntax.
linux-sbl1:/home/andrewg # lsusb Bus 001 Device 003: ID 13fe:5500 Kingston Technology Company Inc. Bus 002 Device 002: ID 0c45:6321 Microdia Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
I do not want to run it in parallel with the root filesystem, I tried to nominate /dev/sdb1 and when that didn't work tried /dev/USB0 ... nothing.
Could you recommend the syntax, please?
Andrew
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

Andrew Greig <pushin.linux@gmail.com> wrote:
[ 6931.390696] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [ 6933.198312] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 0) [ 6933.198326] FAT-fs (sdb1): Filesystem has been set read-only
There's your problem, as you noticed.
I do not want to run it in parallel with the root filesystem, I tried to nominate /dev/sdb1 and when that didn't work tried /dev/USB0 ... nothing.
Could you recommend the syntax, please?
fsck.vfat -n /dev/sdb1 after making sure that it's on /dev/sdb1 by running fdisk -l or checking the kernel logs. You don't want to check the wrong drive by mistake. The -n option performs a check without writing any changes, according to the manual page. After you've seen the errors, you can decide whether you want to attempt a repair, or take a backup first with dd, or whatever suits you. See the fsck.vfat manual page for full details.

On Sun, 2014-05-11 at 18:29 +1000, Jason White wrote:
Andrew Greig <pushin.linux@gmail.com> wrote:
Hi All,
I recently copied some files onto a USB stick, but now, I cannot delete them from the stick as the fs is readonly. I have tried to chmod, but no luck. I have tried to chmod as roo, still no good. Then I remembered that the fstab sometimes mounts removable devices readonly, but the only drives referenced in fstab are the swap, / and /home partitions. Where would I be able to change the permissions for this drive, please? OpenSuse 13.1
It could be due to file system corruption. Have a look at your kernel logs to see whether there's an error message when you mount the file system. Also, when you run the mount command, do you get any error messages?
Hi Jason, I eventually settled on this: andrewg@linux-sbl1:~> su Password: linux-sbl1:/home/andrewg # dosfsck -a -v /dev/sdb1 and it worked. Now I have my drive back! Many thanks Andrew

Andrew Greig <pushin.linux@gmail.com> wrote:
linux-sbl1:/home/andrewg # dosfsck -a -v /dev/sdb1
and it worked. Now I have my drive back!
Excellent. Make sure that the umount command completes before you remove the device from the USB port, otherwise the file system will be inconsistent, requiring more repair.

On Mon, 2014-05-12 at 13:27 +1000, Jason White wrote:
Andrew Greig <pushin.linux@gmail.com> wrote:
linux-sbl1:/home/andrewg # dosfsck -a -v /dev/sdb1
and it worked. Now I have my drive back!
Excellent. Make sure that the umount command completes before you remove the device from the USB port, otherwise the file system will be inconsistent, requiring more repair.
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main Thanks Jason and others,
I see from the previous posts that the problem is caused by not using the "Safely Remove ..." provision in the GUI. I used to run "sync" before umount in the old days to make sure that all the writes had completed. Obviously a moment of carelessness can cause a large amount of pain. I will tuck the fsck command away safely i case the third glass of whiskey kicks in unawares ;-) Cheers Andrew

Hello Andrew, Been catching up, with too little time. On Mon, 2014-05-12 at 22:41 +1000, Andrew Greig wrote:
On Mon, 2014-05-12 at 13:27 +1000, Jason White wrote:
Andrew Greig <pushin.linux@gmail.com> wrote:
linux-sbl1:/home/andrewg # dosfsck -a -v /dev/sdb1
and it worked. Now I have my drive back!
Excellent. Make sure that the umount command completes before you remove the device from the USB port, otherwise the file system will be inconsistent, requiring more repair.
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main Thanks Jason and others,
I see from the previous posts that the problem is caused by not using the "Safely Remove ..." provision in the GUI. I used to run "sync" before umount in the old days to make sure that all the writes had completed. Obviously a moment of carelessness can cause a large amount of pain. I will tuck the fsck command away safely i case the third glass of whiskey kicks in unawares ;-)
The "Safely Remove ..." provision will run the necessary unmount command, and any syncing. It will not relinquish the mount while there are pending writes, that is the reason for a delay. It is just good practice, the same as was sensible under old DOS systems, even if inadequately enforced, to wait for activity to cease before removing removable media. It is prudent to do a little exploring and investigation and comprehend what is happening, it prevents these foreseeable problems and associated grief. There will be some script or the like relating to the automounting, and when mounted, it will appear in the /etc/mtab file. As to a little hiccup with unmounting, that will block if something has an open file or directory on the device filesystem.
Cheers Andrew
Regards, Mark Trickett
participants (4)
-
Andrew Greig
-
Jason White
-
Mark Trickett
-
Robert Brown