2

The setup:

Raspi2 B+ running on a 8GB SD card and 32 GB Sandisk Cruzer Orbit for at least a year. I mounted the drive to my torrent download directory like this:

sudo mount /dev/sda1 torrents/downloads/usb

It's been running smoothly until one day I wanted to do a reboot and it was not working. I can always ssh back to the machine despite it says that it's going to reboot/shutdown. I did a "shutdown -h now" and then unplugged the power, plugged it back.

When I mounted my drive back, the fun started:

pi@raspberrypi ~ $ sudo mount /dev/sda1 torrents/downloads/usb
mount: block device /dev/sda1 is write-protected, mounting read-only

Online research suggested that i remount so, I unmounted and tried this:

pi@raspberrypi ~ $ sudo blockdev --setrw /dev/sda1
pi@raspberrypi ~ $ sudo mount /dev/sda1 torrents/downloads/usb
mount: block device /dev/sda1 is write-protected, mounting read-only
pi@raspberrypi ~ $ sudo mount -t ext3 -o remount,rw /dev/sda1 torrents/downloads/usb
pi@raspberrypi ~ $ 

I tried to create a file and edit it using sudo vi and this is what I get once I try to save the file:

pi@raspberrypi ~ $ touch torrents/downloads/usb/test
pi@raspberrypi ~ $ sudo vi torrents/downloads/usb/test

The error I get is:

"torrents/downloads/usb/test" E667: Fsync failed

So basically, my usb drive is in Read-Only mode. Here are some diagnostic details from dmesg:

[366650.998500] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
[366651.100045] usb 1-1.3: New USB device found, idVendor=0781, idProduct=557c
[366651.100080] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[366651.100100] usb 1-1.3: Product: Cruzer Orbit
[366651.100120] usb 1-1.3: Manufacturer: SanDisk
[366651.100137] usb 1-1.3: SerialNumber: 4C530009861225104380
[366651.101898] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[366651.102327] scsi2 : usb-storage 1-1.3:1.0
[366652.099937] scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer Orbit     1.27 PQ: 0 ANSI: 6
[366652.105483] sd 2:0:0:0: [sda] 62530624 512-byte logical blocks: (32.0 GB/29.8 GiB)
[366652.107847] sd 2:0:0:0: [sda] Write Protect is on
[366652.107889] sd 2:0:0:0: [sda] Mode Sense: 43 00 80 00
[366652.110976] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[366652.129022]  sda: sda1

And using fdisk I get:

pi@raspberrypi ~ $ sudo fdisk -l

Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
4 heads, 16 sectors/track, 243200 cylinders, total 15564800 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: 0x000981cb

    Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15564799     7720960   83  Linux

Disk /dev/sda: 32.0 GB, 32015679488 bytes
255 heads, 63 sectors/track, 3892 cylinders, total 62530624 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: 0x00000000

Device Boot Start End Blocks Id System /dev/sda1 32 62530623 31265296 c W95 FAT32 (LBA)

I tried to clean the partition using parted as well:

pi@raspberrypi ~ $ sudo parted /dev/sda1
Warning: Unable to open /dev/sda1 read-write (Read-only file system).  /dev/sda1 has been opened read-only.
Warning: Unable to open /dev/sda1 read-write (Read-only file system).  /dev/sda1 has been opened read-only.
GNU Parted 2.3
Using /dev/sda1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

This is my dosfsck results:

pi@raspberrypi ~ $ sudo dosfsck -v /dev/sda1
dosfsck 3.0.13 (30 Jun 2012)
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
Logical sector size is zero.
pi@raspberrypi ~ $ sudo dosfsck -a -f /dev/sda1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
open: Read-only file system

I have tried a lot other things like using parted to delete the partition, HDDGURU's low level format tool - nothing work.

Can anyone give any lead on this? I'm willing to try anything.

Thanks a lot!

-mc

3
  • To isolate the issue between the drive and the operating system, it might make sense to test read-write by plugging the drive into another device. Commented Oct 13, 2016 at 16:23
  • After formatting the USB drive, so it is running in out of the factory settings it is still in read only mode?
    – Darth Vader
    Commented Oct 13, 2016 at 16:24
  • Thank you for asking the question guys! I did plug it to my Windows Laptop, where I used the HDDGURU's low level format tool. After a 'successful' format, when I open the drive in explorer, I see that nothing has changed there - all the old files are there as if nothing happened. I guess it answers both of your questions.
    – nitemarez
    Commented Oct 14, 2016 at 8:33

1 Answer 1

2

It looks like a case of this issue. When a flash drive is near its end of life, it switches internally to read-only mode to allow for recovery of data that was last written to it. There's nothing you can do about this besides buying a new flash drive.

Note that file sharing software is heavy in therms of disk loads, conceivably reducing the lifetime of a typical thumb drive to 1 year or so. You may want to use an HDD as a storage for your torrents. If that's not an option, you may want to buy a bigger thumb drive even if you don't need more than 32 GB, as a bigger drive will take more time to wear out.

2
  • Thank you so much for this, I was banging my head on the wall :)
    – nitemarez
    Commented Feb 28, 2017 at 16:53
  • 1
    @nitemarez Yeah, flash memory is one of those technologies which are complex inside yet presented as very simple abstractions to the users. Then something happens inside the black box and abstractions familiar to users no longer make sense :) Commented Feb 28, 2017 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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