2

I have a usb stick that is read only. I want to completely erase it, so I could write on it again.

I had tried to remove the write protection - but nothing worked (chmod, dd, dosfsck, gparted, hdparm, umount, fdisk, df ...)

It seems like the stick is lost.

How can I format this stick so I could use it again?

Running ls -lsa /usb-root-dir:

4 drwxr-xr-x 3 root root 4096 אפר 25 14:11  
drwxr-x---+ 3 root root 4096 אפר 30 10:40 .. 16 
drwx------ 2 root root 16384 אפר 25 14:11 lost+found 
4
  • Please edit your question and add the result of running ls -lsa on the usb-stick root directory
    – Yaron
    Apr 26, 2017 at 5:51
  • 4 drwxr-xr-x 3 root root 4096 אפר 25 14:11 . 4 drwxr-x---+ 3 root root 4096 אפר 30 10:40 .. 16 drwx------ 2 root root 16384 אפר 25 14:11 lost+found
    – Dudu Arbel
    Apr 30, 2017 at 7:41
  • It seems that the owner of the DOK is root and also somehow ACL was set on a folder in your DOK (marked with + in the result of ls -lsa) - Please review my answer. note that you should locate the folder name which holds the +, as the output provided by you was corrupted due to hebrew fonts
    – Yaron
    Apr 30, 2017 at 13:06
  • Read only can also represent a hardware failure of the memory stick I believe ? (in case none of the above works) Sep 7, 2017 at 0:07

3 Answers 3

5

Use mkusb to restore your USB drive

sudo add-apt-repository universe

(use above command only on Stock Ubuntu)

sudo add-apt-repository ppa:mkusb/ppa
sudo apt-get update
sudo apt-get install mkusb mkusb-nox usb-pack-efi
mkusb

All of these commands will install and start mkusb. It's a pretty intuitive utility. Make sure to read the complete Community Wiki of mkusb before diving into it


I read your previous question, and it's known to happen, and it has also happened to me in the past. Don't worry, your USB stick isn't lost

3
  • mkusb gives the same results as using dd - the ubs is created with no write permissions.
    – Dudu Arbel
    May 1, 2017 at 10:26
  • @DuduArbel see the properties of the folder and check if you have permission or root does May 1, 2017 at 10:32
  • As usual for all advice on formating write only USB is that the poster never pays attention to the fact it is no write and no solution that does not address that first will always fail. I suspect getting the correct node name for the device would be needed as they always go on about mount points. If I recall Ubuntu does not have the software installed to deal with this so the search is on. DD is probably the solution as long as you get the device name on the USB node and that path which won't be the mount point BTW.
    – lewis
    Sep 19, 2017 at 3:30
1

The output of running ls -lsa on your Disk-on-Key (which got a corrupted due to the Hebrew fonts):

4 drwxr-xr-x 3 root root 4096 אפר 25 14:11  
drwxr-x---+ 3 root root 4096 אפר 30 10:40 .. 16 
drwx------ 2 root root 16384 אפר 25 14:11 lost+found 

There are two issues:

1) Folders are owned by Root, and can be read/write by root only

Please execute the below command to set you as the owner of the folder:

sudo chown your-user-name /folder-of-usb-dok

2) Folder holds + which means ACL

The meaning of the + at the end of drwxr-x---+ is Access Control List

File_system_permissions

+ (plus) suffix indicates an access control list that can control additional permissions.

FilePermissionsACLs

Listing Access list can be done using

getfacl /folder-name

Updating Access List can be done using setfacl

The following command should grant you full access to the folder.

  • replace username with your user-name, and /folder-of-usb-dok with the usb-dok-folder

    setfacl -m u:username:rwx /folder-of-usb-dok

4
  • I get error: setfacl: folder-of-usb-dok: Operation not supported
    – Dudu Arbel
    May 1, 2017 at 10:21
  • You should replace foldrr of usb dok with the actual folder name of the mounted disk on keu
    – Yaron
    May 1, 2017 at 10:26
  • I also fail to change the ownership. chown returns ok, but the owner does not change
    – Dudu Arbel
    May 1, 2017 at 10:30
  • Try executing sudo setfacl
    – Yaron
    May 1, 2017 at 10:41
0

Since you don't show us how "chmod, dd, dosfsck, gparted, hdparm, umount, fdisk, df ..." failed (df?), it's hard to help you.

Is the USB stick mounted? With the read-only (ro) option? That would cause some failures.

Either umount the USB stick (then gparted or dd will work) or remount the USB stick read-write (rw), with sudo mount -o remount,rw <device> <mountpoint>

You must log in to answer this question.

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