5

When I insert a particular USB stick into my PC (running Ubuntu 17.04) and open Nautilus, I see all the files on the USB stick, but cannot cut them or delete them. Right-clicking on a file brings up a menu with option to cut greyed out and with no option to "Move to Trash". Until now I have never such a problem with this USB stick. I tried it in Windows (dual boot) and it said it had some errors that need to be fixed. I fixed errors and tried it again in Ubuntu, but it does not work.

This is the output of the mount command, as requested:

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1966096k,nr_inodes=491524,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=404380k,mode=755)
/dev/sda5 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1735)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=404376k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sda2 on /media/Win D type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks)
/dev/sdb on /mnt/usb-090c_1000_12083108001104-0:0 type vfat (ro,nosuid,nodev,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

After that I went to windows and when I plugged USB stick I got message, that there might be a problem with some files on this device. I chose option scan and fix and after 20 minutes of scanning I got message, that no problems were found. I managed to delete all files in Windows and did quick format. After that I went to Ubuntu and there is still a problem. I cannot write a file on USB stick (and I cannot check if I can delete file, because now there is no file on USB stick).

This is output of dmesg | tail (after formatting in Windows):

[  716.524531] scsi 6:0:0:0: Direct-Access                                    PQ: 0 ANSI: 4
[  716.527759] sd 6:0:0:0: [sdb] 62259200 512-byte logical blocks: (31.9 GB/29.7 GiB)
[  716.528503] sd 6:0:0:0: [sdb] Write Protect is off
[  716.528505] sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
[  716.529233] sd 6:0:0:0: Attached scsi generic sg2 type 0
[  716.529416] sd 6:0:0:0: [sdb] No Caching mode page found
[  716.529420] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[  716.537532]  sdb:
[  716.540525] sd 6:0:0:0: [sdb] Attached SCSI removable disk
[  716.873704] FAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

I also did run mount again, after formatting. The only difference is that, in last few lines (concerning my USB stick) it says vfat (rw, instead of vfat (ro,.

As suggested I unmounted USB stick and did the command sudo fsck /dev/sdb. I got:

fsck from util-linux 2.29
fsck.fat 4.0 (2016-05-06)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 

I chose Remove dirty bit and get this:

There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
? 
  • 2
    Do you want write access (to write files and delete files)? In that case there can be different problems: 1. the file system is read-only by design; 2. the file system is read/write by design but mounted with read-only mount options or mounted with permissions only for another user, for example root; 3. the drive itself is read-only because it is failing, 'grid-locked'. The solution depends on the problem (if there is a solution). This link helps you analyze the problem, askubuntu.com/questions/144852/… – sudodus Sep 6 '17 at 17:05
  • In windows I get message, that there might be a problem with some files on this device. I chose option scan and fix and after 20 minutes of scanning I get message, that no problems were found. I managed to delete all files in windows and did quick format. After that I went to ubuntu and there is still problem. I can not write a file on USB stick... – Mersault Sep 6 '17 at 20:17
  • I would remove the dirty bit. Since you've formatted the device It seems clear you had no important data on it. The root cause of this issue is likely removing the flash drive with triggering safe removal. – Elder Geek Sep 6 '17 at 21:17
  • 1
    Related: Can't format my usb drive. I have already tried with mkdosfs and gparted I don't think this is a duplicate but some of the answers there may help. – Eliah Kagan Sep 7 '17 at 15:17
3

Your mount output indicates that /dev/sdb is to be remounted read only on errors. your dmesg output indicates that the file system is corrupt, hence it's being mounted read only. It's possible to repair this damage.

You can verify which drive with sudo fdisk -l which will list the drives attached.

First unmount the drive with sudo umount /dev/sdb

then issue the command sudo fsck /dev/sdb or since you formatted it in Windows you might want to run Windows chkdsk on it. To prevent this issue in the future always select safe removal when using a device with windowsand unmount in Ubuntu to insure that there are no pending writes to the device. If formatting and proper safe removal still leave you with a non-working device, you should replace it. (Flash memory has a limited lifespan)

When written to and erased during the normal course of use, the oxide layer separating the floating gate from the substrate degrades, reducing its ability to hold a charge for an extended period of time. Each solid-state storage device can sustain a finite amount of degradation before it becomes unreliable, meaning it may still function but not consistently. The number of writes and erasures (P/E cycles) a NAND device can sustain while still maintaining a consistent, predictable output, defines its endurance.

Source: http://www.storage-switzerland.com/Articles/Entries/2012/3/6_Why_Flash_Wears_Out_and_How_to_Make_it_Last_Longer.html

  • Chkdsk in Windows did not produce any errors, but I could still not write on USb in Ubuntu. As suggested I installed mkusb and Restored to a standard storga device. Now it seems ok. Thank you for all your help! – Mersault Sep 8 '17 at 15:02
4

There is a straight-forward alternative, when there is nothing important, that you must keep or recover on the USB drive. Wipe the first mibibyte, create a new partition table and file system.

Use mkusb and select Restore to a standard storage device.

enter image description here

If mkusb does not solve the problem, the USB drive may be damaged. But there may be other problems too, so please try according to the following list,

  • On some pendrives and on many memory cards there is a small mechanical switch for write protection, that can toggle between read/write and read-only. You might have set it read-only without intention.
  • Reboot the computer and try again to restore or wipe the first megabyte with mkusb.
  • Disconnect other USB devices. Sometimes USB devices can disturb the function for each other.
  • Try other USB ports and another computer.
  • Try another operating system (Windows, MacOS) in another computer.
  • If you still cannot wipe the first megabyte of the drive, and the drive is read-only, it is probably 'gridlocked', and the next stage is that it will be completely 'bricked'. There is a limit, when you have to accept that the pendrive is damaged beyond repair, at least with tools available to normal users like you and me. See this link: Pendrive lifetime

See this link for more details,

Can't format my usb drive. I have already tried ... Analysis of the problem

  • You are welcome, @Mersault :-) – sudodus Sep 8 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.