USB Disk stuck in read only after dd an ISO
A quick fix (and sort of a hack) to get it out of read only mode, (this will delete the contents of the usb device!!!) is to open "startup disk creator" in ubuntu and choose to erase the device and it will be out of read only mode.
"that worked. but why? how can I do that in terminal?"
I don't know exactly why but it seems to be python related. I'm doing some digging and will report back with any findings.
How to in terminal:
According to this post you can change the read only attribute using hdparm like so (assuming the device is /dev/sdb):
sudo hdparm -r0 /dev/sdb
Then, remount the device. That may involve simply unplugging and plugging the device back in or you could run the following command to remount the device in read/write mode:
sudo mount -o remount,rw /dev/sdb /media/$USER/8E22-6590
First find out the device: lsblk
Suppose the USB stick is on /dev/sdb
. If any of its partitions are mounted, then unmount them all.
Let's zero out the device. This will completely wipe out all of its partitions and data. Please make sure you dd
the correct device, here in case /dev/sdb
$ sudo dd if=/dev/zero of=/dev/sdb; sudo sync
Use any disk utility of your choice (gdisk
, fdisk
, gparted
) and create a partition on it.
$ sudo gdisk /dev/sdb
Command (? for help): n
Partition number (1-128, default 1): <enter>
First sector (34-15634398, default = 2048) or {+-}size{KMGTP}: <enter>
Last sector (2048-15634398, default = 15634398) or {+-}size{KMGTP}: <enter>
Hex code or GUID (L to show codes, Enter = AF00): 0700
Changed system type of partition to 'Microsoft basic data'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk1.
The operation has completed successfully.
gdisk doesn't create filesystems, so run ..
$ sudo mkfs.vfat /dev/sdb1