Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

As in the title, I'm unable to format it as it says read-only. I've tried couple of searches and the solutions too. Even I tried GParted to see I have any luck. Unfortunately below is what I get.

GParted 0.11.0 --enable-libparted-dmraid

Libparted 2.3

Delete /dev/sdb1 (fat32, 14.91 GiB) from /dev/sdb  00:00:00    ( ERROR )

calibrate /dev/sdb1  00:00:00    ( SUCCESS )

path: /dev/sdb1
start: 32
end: 31,266,815
size: 31,266,784 (14.91 GiB)
delete partition  00:00:00    ( ERROR )
libparted messages    ( INFO )

Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.
Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.
Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.
Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.
Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.
Can't write to /dev/sdb, because it is opened read-only.
Unable to open /dev/sdb read-write (Read-only file system). /dev/sdb has been opened read-only.

Output of dmesg

[10061.878073] usb 2-1.3: new high-speed USB device number 8 using ehci_hcd
[10061.972140] scsi9 : usb-storage 2-1.3:1.0
[10062.969922] scsi 9:0:0:0: Direct-Access     SanDisk  Cruzer Blade     1.20 PQ: 0 ANSI: 5
[10062.971746] sd 9:0:0:0: Attached scsi generic sg2 type 0
[10062.972799] sd 9:0:0:0: [sdb] 31266816 512-byte logical blocks: (16.0 GB/14.9 GiB)
[10062.976439] sd 9:0:0:0: [sdb] Write Protect is on
[10062.976453] sd 9:0:0:0: [sdb] Mode Sense: 43 00 80 00
[10062.977353] sd 9:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[10062.999026]  sdb: sdb1
[10063.003367] sd 9:0:0:0: [sdb] Attached SCSI removable disk

Output of fsck

sudo fsck -n /dev/sdb
fsck from util-linux 2.20.1
e2fsck 1.42 (29-Nov-2011)
fsck.ext2: Device or resource busy while trying to open /dev/sdb
Filesystem mounted or opened exclusively by another program?

Output of sudo fdisk -l /dev/sdb

Disk /dev/sdb1: 16.0 GB, 16008593408 bytes
64 heads, 32 sectors/track, 15266 cylinders, total 31266784 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6f20736b

This doesn't look like a partition table
Probably you selected the wrong device.

     Device Boot      Start         End      Blocks   Id  System
/dev/sdb1p1   ?   778135908  1919645538   570754815+  72  Unknown
/dev/sdb1p2   ?   168689522  2104717761   968014120   65  Novell Netware 386
/dev/sdb1p3   ?  1869881465  3805909656   968014096   79  Unknown
/dev/sdb1p4   ?  2885681152  2885736650       27749+   d  Unknown

Partition table entries are not in disk order

This is not yet fixed as I've tried plenty of ways. Any idea on how to fix this?

share|improve this question
    
What is the storage device? If it's a USB stick or an SD card, there may be a write-protect switch... –  yjwong Jan 23 at 7:10
    
Well its a USB stick (SanDisk) & no it does not have a switch. –  AzkerM Jan 23 at 7:15
    
Any more advises on this? –  AzkerM Jan 29 at 8:25
    
possible duplicate of USB turn write protection off, since [sdb] Write Protect is on –  falconer Jan 29 at 8:30
    
none of those did worked.. –  AzkerM Jan 29 at 8:50

2 Answers 2

up vote 1 down vote accepted

If the hdparm method mentioned here doesn't work then you are most likely out of luck with that pendrive. (Have you tried remounting rw the partition after setting the write protect off on sdb?) Since the kernel says that the whole drive is write protected you have to deal with the protection at the drive level.

hdparm does this. If it can't solve this it is likely that your pendrive is write protected by design or it is failed.

Maybe it has a hardware switch under its casing if you take it apart. If it was writable before maybe this switch got flipped, if it was never writable maybe it was always on.

Also googling for your device gives out a lot of hits with the same problem even on windows. This is from the Sandisk forums:

For the SanDisk USB stick the answer has been posted many times. If new return it to where you bought it. If under warrantee return it to SanDisk. BOTH options will get you a new USB stick. There are no other consistent options.

Also from the Sandisk forum:

This is an offical answer if you contact customer service:

"I understand that you are getting write protection error while accessing your Cruzer flash drive. The flash drive has detected a potential fault and has become write protected to prevent data loss. There is no method to fix this. You will need to backup your data and replace the flash drive. Our team of developers is in combination with the OS developers looking into a solution to resolve this issue. Please note that only a minor percentage of users are experiencing the write protection issue and these are the customers posting on the internet to find a solution."

So likely there is no way to solve it.

share|improve this answer
    
I guess this is it for the USB drive. Thank you so much for such a valuable time to find and post a descriptive answer. Since there's no such way rather than getting a new one. –  AzkerM Jan 29 at 11:06
    
I do not remember what else I tried apart from these answers available to this question. But what I came across is the same similar to this answer. There is no way to fix than replacing it. –  AzkerM Mar 12 at 4:42

If you've not tried this, first unmount the partition which you want to format and then continue the further jobs.


To check the permission of the mount you can use:

ls -ld /path/to/target

If it's permission issue, to solve it could change the permissions with chmod or just change the ownership recursively, and this is what I've shown below:

sudo chown <username>:<groupname> -R /path/to/target

Now if you need, you may also set the permissions with chmod:

find /path/to/target -type f -execdir chmod 666 -Rv {} +

(which gives owner, group and the world RW permissions for all the files in the target.)

find /path/to/target -type d -execdir chmod 777 -Rv {} +

(which gives owner, group and the world RWX permissions for all the directories in the target.)

(use sudo chmod if the owner is root)

share|improve this answer
    
Partition is unmounted and the /path/to/target is root who's holding permission, also I'm executing this with root. –  AzkerM Jan 23 at 8:42
    
..and does root have the permission to write? if not set RW permissions for the root or change the ownership to normal user and then format... –  rusty Jan 23 at 8:45
    
yes root does have permission to write and I tried all the possible ways and tools to get this thing fixed.. but no luck –  AzkerM Jan 23 at 9:01

protected by Community Sep 1 at 13:26

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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