Can't write to Flash Drive

I have a problem USB Flash Drive that under MATE is displaying the incorrect volume label (it says it’s RED-JUMP-Drive but is supposed to be Sega-Blue)and I can’t copy any files to it or create a folder or delete files. It does not have this problem in Windows and if I boot Mint Linux from a Jump Drive it also does not have this problem, Only under Ubuntu MATE does it have this problem.
I was able to format it so now I have to recover all the data that was on it.
I tried doing this
sudo dosfsck -a /dev/sdc1
and this
sudo hdparm -r0 /dev/sdc1

but it still has the problem.

dmesg | grep sdc will show you how the drive is mounted, RO read only or RW read write. But … if you formatted the drive, how will you be able to recover data from it?

I typed dmesg | grep sdc
in a terminal and it did not do anything, it did not display anything and went back to the prompt
If I type just grep sdc
the prompt does not come back as if it locked up and if I try to close the terminal it says

There is still a process running in this terminal. Closing the terminal will kill it.

If I type just dsesg
it displays a whole window full of test I can’t read or understand.

As far as recovering the data, I backed it up first and the restored it under Windows 7.

If you type dmesg in the terminal you should get a long listing. The grep
subsets that listing for sdc (since you wrote earlier the usb drive was
sdc). If your drive is sdb then grep for sdb. If you plug in a usb drive,
dmesg will show the size of the drive and if it was able to open is as RW.
Example, I plugged in my usb drive and dmesg contains: … it found a drive
8 GB in size, the write protect is off (that means RW) and it has only one
partition (sdc is the device, sdc1 is the partition)

sd 2:0:0:0: [sdc] 15360000 512-byte logical blocks: (7.86 GB/7.32 GiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Mode Sense: 43 00 00 00
sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
sdc: sdc1

grep by itself does not do much. grep acts as a filter, eg. “dmesg | grep
sdb” (show only those lines that contain the search string)

You can stop any process you started with ctrl C.

1 Like

I managed to some how do a fsck on the drive and it said it had a dirty bit because it was not unmounted properly so I told it to remove the dirty bit and then it checked the drive and said something about the fat being corrupt and asked which back up fat to use I chose 1 and it did it’s thing and I was able to change the volume label but it still is read only under Ubuntu MATE only and Not under Windows 7 or if I boot Linux Mint from a jump drive.

Now when I try to do a fsck on it it fails with this message
/dev/sda5 is mounted.
e2fsck: Cannot continue, aborting.

I’m Not trying to fsck on /dev/sda5, I’m trying to fsck the jump drive on /dev/sdj1 or maybe it’s
/mnt/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1
because if I do a
cd /mnt/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1 it changes to the jump drive.

i did a dmesag and it returned this information

[ 2298.812755] usb 1-1.5.4: new high-speed USB device number 8 using ehci-pci
[ 2298.922015] usb 1-1.5.4: New USB device found, idVendor=0781, idProduct=5575
[ 2298.922020] usb 1-1.5.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2298.922023] usb 1-1.5.4: Product: Cruzer Glide
[ 2298.922026] usb 1-1.5.4: Manufacturer: SanDisk
[ 2298.922029] usb 1-1.5.4: SerialNumber: 4C530001010701113445
[ 2298.922505] usb-storage 1-1.5.4:1.0: USB Mass Storage device detected
[ 2298.922624] scsi host9: usb-storage 1-1.5.4:1.0
[ 2299.922931] scsi 9:0:0:0: Direct-Access SanDisk Cruzer Glide 1.00 PQ: 0 ANSI: 6
[ 2299.923608] sd 9:0:0:0: Attached scsi generic sg11 type 0
[ 2299.924141] sd 9:0:0:0: [sdj] 61341696 512-byte logical blocks: (31.4 GB/29.3 GiB)
[ 2299.926974] sd 9:0:0:0: [sdj] Write Protect is off
[ 2299.926982] sd 9:0:0:0: [sdj] Mode Sense: 43 00 00 00
[ 2299.928061] sd 9:0:0:0: [sdj] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 2299.937668] sdj: sdj1

AS you can see it says the Write Protect is Off, so why can I not write to it under ubuntu mate and Only under ubuntu mate?

So the usb drive is sdj … when it mounts it, can you show the location? type df to see the mount point. Change directory into that mount point and type, touch bob it should create a file called bob with zero bytes. In my case it mounts it in /media/pavlos/something (pavlos is the user, something is the label of the usb drive)

cd /media/pavlos/something ; touch bob ; ls -l

I found out the only way I can write to the drive is to launch a file manager as a super user by typing sudo caja or sudo nautilus and than clicking on file system and then mnt where I can then see the drive and create folders or write files to it or delete files from it. If it check the properties, permissions it shows it’s owned by root and if I try to change it to any other user it won’t let me, even if I log on as a super user in a terminal window by typing su and and launch nautilus I get this error message

Sorry, could not change the owner of “usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1”: Error setting owner: Operation not permitted

This is what I get when I type

touch bob ; ls -l

touch: cannot touch ‘bob’: Permission denied
total 240
drwxr-xr-x 3 root root 16384 Jun 10 20:28 apps
-rwxr-xr-x 1 root root 44 Aug 20 2017 BLUE LED
drwxr-xr-x 2 root root 16384 Jun 19 11:00 Created as ROOT
drwxr-xr-x 2 root root 16384 Jun 19 10:03 Created in Linux Mint
drwxr-xr-x 3 root root 16384 Apr 28 05:30 DCIM
drwxr-xr-x 2 root root 16384 May 4 01:46 Games
drwxr-xr-x 5 root root 16384 Jun 1 20:13 gxgeo
drwxr-xr-x 5 root root 16384 Jun 1 20:24 hugo
-rwxr-xr-x 1 root root 12000 May 3 18:25 ndebug.log
-rwxr-xr-x 1 root root 544 May 3 17:42 nincfg.bin
drwxr-xr-x 2 root root 16384 Jun 19 12:25 On Hold
drwxr-xr-x 9 root root 16384 May 30 16:23 SEGA
drwxr-xr-x 2 root root 16384 May 28 22:28 System Volume Information
drwxr-xr-x 6 root root 16384 May 30 16:42 TG-16
drwxr-xr-x 5 root root 16384 May 30 16:06 wiisxr
taslim@Taslims-Ubuntu-Mate:/mnt/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:

why is the usb drive mounted under /mnt ? do you have something in /etc/fstab to automount?

/mnt perms look like: drwxr-xr-x 2 root root 4096 Jun 28 2017 mnt/
The permissions are read-write for root only.

to become root, use sudo su

Can you show the output of: lsblk -f and cat /etc/fstab

I have no idea why the usb drive mounted under /mnt. Where should it be mounted?

This is the contents of my fstab file relating to the Flash Drive

/dev/disk/by-id/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1 /mnt/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1 auto nosuid,nodev,nofail,noauto,x-gvfs-show,x-gvfs-name=SEGA-BLUE 0 0

output of lsblk -f

sda
├─sda1 vfat 72B5-870F
├─sda2 ntfs 69DD3A6D63312CEA
├─sda3
├─sda5 ext4 97aecfea-8188-4561-8eb3-317fdb9f9d32 /
├─sda6 swap e7c0752c-cf7d-469e-ac77-e4d680ca094b [SWAP]
├─sda7 ntfs Windoze 7 7AABBEBE66960972
└─sda8 ntfs 781 GB NTFS DATA 78AD770B26AC8D95
sdb
└─sdb1 ntfs Samsung 2TB Drive 8482BEE982BEDF3C
sdd
├─sdd1
└─sdd2 ntfs Toshiba 4TB USB 4E3653C53653AD29 /media/tasl
sde
└─sde1 vfat SEGA-BLUE 0707-73F8 /mnt/usb-Sa
sr0
sr1

Output of cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=97aecfea-8188-4561-8eb3-317fdb9f9d32 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=e7c0752c-cf7d-469e-ac77-e4d680ca094b none            swap    sw              0       0
# swap was on /dev/sdb3 during installation
UUID=2e691c3d-e984-451b-8bcd-39786e538cbe none            swap    sw              0       0
/dev/disk/by-id/usb-Initio_HM160HC_0000000000000000W-0:0-part1 /mnt/usb-Initio_HM160HC_0000000000000000W-0:0-part1 auto nosuid,nodev,nofail,noauto,x-gvfs-show,x-gvfs-name=160GBUSB 0 0
/dev/disk/by-id/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1 /mnt/usb-SanDisk_Cruzer_Glide_4C530001010701113445-0:0-part1 auto nosuid,nodev,nofail,noauto,x-gvfs-show,x-gvfs-name=SEGA-BLUE 0 0

I wrote earlier that usb drives usually mount under /media and the user’s name, eg /media/pavlos/usbdrive. I have no idea who added the mount line to /etc/fstab, that dictates the usb drive be mounted under /mnt But I see 2 swap files (kinda strange, one reference to sda6 (correct) but also to sdb3 which does not exist in blkid). Earlier, you showed that the usb drive appeared as sdj, now it appears as sde, formatted as VFAT. There is also a 160 GB usb-Initio which I do not see in the blkid listing.

You could try, sudo chmod 777 /mnt that will open /mnt to be RW by everyone and this may help to read/write files in there as a normal user. To revert back, use sudo chmod 755 /mnt

I think I fixed it, I deleted the line in the fstab file that refereed to the Jump Drive I was having trouble with and now I can write to it again without having to open a file browser as a super user.
see, it no longer says root for the owner

drwxr-xr-x 3 taslim taslim 16384 Jun 10 20:28 apps
-rw-r–r-- 1 taslim taslim 44 Aug 20 2017 BLUE LED
-rw-r–r-- 1 taslim taslim 0 Jun 20 22:31 bob
drwxr-xr-x 2 taslim taslim 16384 Jun 19 11:00 Created as ROOT
drwxr-xr-x 2 taslim taslim 16384 Jun 19 10:03 Created in Linux Mint
drwxr-xr-x 3 taslim taslim 16384 Apr 28 05:30 DCIM
drwxr-xr-x 2 taslim taslim 16384 Jun 20 21:58 fixed it
drwxr-xr-x 2 taslim taslim 16384 May 4 01:46 Games
drwxr-xr-x 5 taslim taslim 16384 Jun 1 20:13 gxgeo
drwxr-xr-x 5 taslim taslim 16384 Jun 1 20:24 hugo
-rw-r–r-- 1 taslim taslim 12000 May 3 18:25 ndebug.log
-rw-r–r-- 1 taslim taslim 544 May 3 17:42 nincfg.bin
drwxr-xr-x 2 taslim taslim 16384 Jun 19 12:25 On Hold
drwxr-xr-x 9 taslim taslim 16384 May 30 16:23 SEGA
drwxr-xr-x 2 taslim taslim 16384 May 28 22:28 System Volume Information
drwxr-xr-x 6 taslim taslim 16384 May 30 16:42 TG-16
drwxr-xr-x 5 taslim taslim 16384 May 30 16:06 wiisxr

it also changed it’s mount point to
/media/taslim/SEGA-BLUE$

I did make a back up of the fstab file just in case I screwed something up by doing that.

Thanks for all your help.