Results 1 to 5 of 5

Thread: Can't format USB flash drive, says it's read only

  1. #1
    Join Date
    Feb 2013
    Location
    Highway to hell
    Beans
    45
    Distro
    Ubuntu Development Release

    Can't format USB flash drive, says it's read only

    I wanted to transfer something over to my laptop so I decided to use an old 16GB flash drive, had to format it first though. So, I plugged it in, went into fdisk, removed all partitions, made a new partition and when I tried to write, it gave me the following message:
    Code:
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    Error closing file
    Nothing happened at all, that was not what I expected it to do. So I tried to format one of the existing partitions instead:
    Code:
    # mkfs.ext2 /dev/sdb2
    Which gave me this:
    Code:
    /dev/sdb2: Read-only file system while setting up superblock
    Tried this:
    Code:
    # hdparm -r0 /dev/sdb
    
    /dev/sdb:
     setting readonly to 0 (off)
     readonly      =  0 (off)
    Aaand...
    Code:
    /dev/sdb2: Read-only file system while setting up superblock
    *sigh* No results. So, does anyone have any ideas on how can I format this thing? It's only that one flash drive that makes problems, others work perfectly, I tried googling for the answer but all I found are people with read-only filesystems when a partition from the flash drive is mounted, but in my case the entire drive is read-only and I can't set it as read/write to repartition it. Any help is appreciated.

  2. #2
    Join Date
    Jun 2008
    Location
    Ballard
    Beans
    2,409
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Can't format USB flash drive, says it's read only

    Have you tried just using Gparted or Disks? Delete all existing partitions and start over. I had a drive yesterday where Gparted was not able to delete a partition (originally encrypted) because it was locked. Disks was able to delete it. Then I was able to repartition as desired.
    "We're all in this together, kid." --H. Tuttle (a.k.a. H. Buttle)
    "Maybe it's a layer 8 problem." --thatguruguy
    A High-Tech Blech!

  3. #3
    Join Date
    Feb 2013
    Location
    Highway to hell
    Beans
    45
    Distro
    Ubuntu Development Release

    Re: Can't format USB flash drive, says it's read only

    @jamesisin Tried Gparted, said there's an I/O error when I tried to delete the partition and then it crashed. Lovely...

    I assume that by "Disks" you meant gnome-disk-utility (palimpsest), that one succeeded though, gave me this error message in the process:
    Code:
    Error erasing: helper exited with exit code 1: In part_del_partition: device_file=/dev/sdb, offset=537919488
    Entering MS-DOS parser (offset=0, size=15676211200)
    MSDOS_MAGIC found
    looking at part 0 (offset 1048576, size 536870912, type 0x82)
    new part entry
    looking at part 1 (offset 537919488, size 6442450944, type 0x83)
    new part entry
    looking at part 2 (offset 0, size 0, type 0x00)
    new part entry
    looking at part 3 (offset 0, size 0, type 0x00)
    new part entry
    Exiting MS-DOS parser
    MSDOS partition table detected
    got it
    got disk
    got partition - part->type=0
    committed to disk
    Error calling fsync(2) on /dev/sdb: Input/output error
    Cannot scrub filesystem signatures at offset=537919488 and size=6442450944
    That message appeared on all four partitions but they were deleted and once I removed and re-inserted the flash drive, I formatted it with an MS-DOS partitioning table in palimpsest and now it works, I can change the filesystem with mkfs and remove/add partitions with fdisk again. It still boggles me as to why it didn't work before, I'll find that out one day but I'm too lazy to do it right now.

    Thanks for the help man, I appreciate it! I've always used fdisk for partitioning but it seems the GUI tools are sometimes better suited for the job, gotta remember that.

  4. #4
    Join Date
    Jun 2008
    Location
    Ballard
    Beans
    2,409
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Can't format USB flash drive, says it's read only

    Yeah, I believe Disks is how the GUI is now referring to Palimpsest.

    Sounds like a bad thumb drive. They do die and i/o errors are a strong indicator of said death. Others may have different suggestions.
    "We're all in this together, kid." --H. Tuttle (a.k.a. H. Buttle)
    "Maybe it's a layer 8 problem." --thatguruguy
    A High-Tech Blech!

  5. #5
    Join Date
    Feb 2013
    Location
    Highway to hell
    Beans
    45
    Distro
    Ubuntu Development Release

    Re: Can't format USB flash drive, says it's read only

    Quote Originally Posted by jamesisin View Post
    Sounds like a bad thumb drive. They do die and i/o errors are a strong indicator of said death.
    It's less than 2 years old but it was used only about 2-3 times, that's nothing compared to my 6-years old 1GB Patriot that transfered cca 500GB of data and still works perfectly. Then again, I never did have great results with those Alcor flash drives, that thing might really be dying. Ah well, 16GB flash drives are 10$ so it's not like it matters much, got nothing important on it and it practically never gets used.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •