2

I have a generic pendrive with a problem... I can't copy to inside, delete or move any archive or folder from the pendrive. I don't know how this happens, I do not change any kind of permissions... the only change that I made was change the user password feels days ago.

I try use dosfsck -t -a /dev/sdb1 but without results... some minutes before the Terminal shows:

Contains a free cluster (199578). Assuming EOF. Broke cycle at cluster 119648 in free chain. Unable to create unique name.

I can't even format that... it is useless... anyone can help?

The syslog shows:

Feb  1 15:32:13 everton-Vostro1510 kernel: [ 2714.745488] usb 2-4: USB disconnect, device number 4
Feb  1 15:32:13 everton-Vostro1510 udisksd[1979]: Cleaning up mount point /media/everton/Everton (device 8:17 no longer exist)
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.024168] usb 2-4: new high-speed USB device number 5 using ehci_hcd
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.163813] usb 2-4: New USB device found, idVendor=058f, idProduct=6387
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.163824] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.163832] usb 2-4: Product: Mass Storage
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.163839] usb 2-4: Manufacturer: Generic
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.163846] usb 2-4: SerialNumber: 4B367433
Feb  1 15:32:18 everton-Vostro1510 kernel: [ 2720.166566] scsi6 : usb-storage 2-4:1.0
Feb  1 15:32:18 everton-Vostro1510 mtp-probe: checking bus 2, device 5: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-4"
Feb  1 15:32:18 everton-Vostro1510 mtp-probe: bus: 2, device: 5 was not an MTP device
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.167548] scsi 6:0:0:0: Direct-Access     Generic  Flash Disk       8.07 PQ: 0 ANSI: 4
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.170022] sd 6:0:0:0: Attached scsi generic sg2 type 0
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.176841] sd 6:0:0:0: [sdb] 16000128 512-byte logical blocks: (8.19 GB/7.62 GiB)
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.177843] sd 6:0:0:0: [sdb] Write Protect is on
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.177855] sd 6:0:0:0: [sdb] Mode Sense: 23 00 80 00
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.178963] sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.193531]  sdb: sdb1
Feb  1 15:32:19 everton-Vostro1510 kernel: [ 2721.197623] sd 6:0:0:0: [sdb] Attached SCSI removable disk
Feb  1 15:32:20 everton-Vostro1510 udisksd[1979]: Mounted /dev/sdb1 at /media/everton/Everton on behalf of uid 1000

Using the command: cat /proc/mounts | grep sdb

everton@everton-Vostro1510:~$ cat /proc/mounts | grep sdb
/dev/sdb1 /media/everton/Everton vfat ro,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=cp437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro 0 0
6
  • Welcome to Ask Ubuntu! What do your logs say? I suspect you'll see more details I/O errors in /var/log/syslog and this would indicate a hardware issue such as broken flash memory or a USB bus error.
    – gertvdijk
    Feb 1, 2013 at 17:13
  • Are you sure you're not using one of these "free" commercial USB flash drives which are write protected, only meant for promotional purposes? And what do logs say when you try to write to the drive after mounting? And also include the output of cat /proc/mounts | grep sdb while it's mounted. And from the logs I see you're removing the drive before unmounting - don't do that!
    – gertvdijk
    Feb 1, 2013 at 18:47
  • Yes I remove before unmounting... it is not common I'm quite stressed with that... well I write some archive inside... just today I see the problem... :(
    – Everton
    Feb 1, 2013 at 18:52
  • It's all read-only, from device level all the way up to the file system. Seems more of a hardware issue from the information now available.
    – gertvdijk
    Feb 1, 2013 at 19:05
  • So... only the hammer can change it :) I will try replace that with the seller. Thanks!!!
    – Everton
    Feb 1, 2013 at 19:12

4 Answers 4

4

There is only two ways that will work everytime, even performing a:

:~$ cd /media

:~/media$ sudo bash

:~/media# cd your_user/pen_drive

:~/media/your_user/pen_drive# chmod 0755 *

:~/media/your_user/pen_drive# chown -R 1000:1000 *

WILL NOT WORK!! DON'T WASTE YOUR TIME, ITS A HEADACHE!

The first involves a 125 line recursive shell script.

The second, the one you should try involves copying all your data to your $HOME directory (/home/your_user). The 0400 bug will not transfer to your local drive or $HOME directory.

After transfer all the data re-format the pendrive, then label it. The re-format from command line will blank the disk. Labeling it will initialize the disk in order to move data from the local disk to the pendrive. Shown below is what you need to do.

(No Brainer: Stick the USB drive in the port)

First run the fdisk with -l flag using sudo to verify the where the device is located (should be /dev/sdb1):

:~$ sudo fdisk -l

next unmount the disk using umount

:~$ sudo umount /dev/sdb1

To reformat the disk use the mkdosfs utility

:~$ sudo mkdosfs -F 32 -I /dev/sdb1

Pull the USB out, then re-insert it. Perform an unmount once again.

:~$ sudo umount /dev/sdb1

Now label the device. Check to see if there is a label first:

:~$ sudo mlabel -i /dev/sdb1 -s ::

Next add a label

:~$ sudo mlabel -i /dev/sdb1 ::your_chosen_name

Keep in mind this assumes /dev/sdb1 is where the device is located at. Also you may not have to pull the drive out and reinserted it. On my lenovo I had to pull it then reinsert it. On my dell I did not. I still do it anyways though.

GOOD LUCK, AND MAY THE FORCE BE WITH YOU!

2
  • This didnt work for me.
    – David
    Apr 25, 2018 at 11:00
  • When I tried that I got this: mkfs.fat 4.1 (2017-01-24) mkdosfs: unable to open /dev/sda1: Read-only file system
    – raphael75
    Jun 9, 2021 at 14:32
4

It worked for me when I did two of the above.

  1. First I have tried to create a new partition using gparted. Here, my USB type was iso image. I change it to fat32 system.

  2. I have pulled out USB and reinserted

  3. Then,

    sudo fdisk -l
    sudo umount /dev/sdb
    sudo mkdosfs -F 32 -I /dev/sdb
    

Pull the USB out, then re-insert it. Perform an unmount once again.

sudo umount /dev/sdb1

Add a label

sudo mlabel -i /dev/sdb1 ::LabelName
3

The easiest and fastest way to this:

  1. run your terminal as root sudo su.

  2. run this command in your terminal: df -Th; you will get something like:

    /dev/sdb1 vfat 3.8G 126M 3.6G 4% /media/linux/YOUR_USB_NAME

  3. unmount the directory in which the USB pen drive is automatically mounted by running : umount /media/linux/YOUR_USB_NAME.

  4. as you can see in step 2 the USB pen drive got /dev/sdb1 partition and filesystem is vfat; now run dosfsck -a /dev/sdb1 .
  5. After the dosfsck command get completed.Remove the USB pen drive from system and then re-attach back to system.Now your USB pen drive should working and it should not have read only filesystem.

Hope it helps.

2

Try copying all your files on the drive somewhere else. Then:

  1. Install gparted. sudo apt-get install gparted
  2. Run gparted and select the drive (/dev/sdb ?)
  3. Click on the Device menu and select Create partition
  4. Right click on the Unallocated space and click Create partition.
  5. Create a new msdos partition and click the apply button.

If the problem lies with the drive itself this might help. If the problem lies with the way Ubuntu is handling pen drives then we would need logs as @gertvdijk pointed out.

1
  • 1
    Does your drive have a physical write-protection switch by any chance?
    – To Do
    Feb 1, 2013 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .