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 
Yaron
  • 13,453

3 Answers3

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

Zanna
  • 72,312
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

Yaron
  • 13,453
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>

waltinator
  • 37,856