Choose style:

Author Topic: Problem with a USB stick that has become read-only  (Read 3422 times)

0 Members and 1 Guest are viewing this topic.

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Problem with a USB stick that has become read-only
« on: March 08, 2015, 12:24:42 pm »
Hi wondering if any one can help. :)
 
I have an 8GB USB stick that is a few years old.

A while back I was fiddling with it (I believe trying to get it setup for a Linux USB session) and it is now locked as read-only (note there is no physical tab on the outside) and I cannot get it writeable again. I have tried reformatting in GPARTED but that doesn't do much. I have tried various things over the past year on and off (including in Windows) but no joy.

I have PM5 running on a persistent 16gig drive but it's slow - even though the persistence is working well. I want to try and salvage this 8gig one and I will then try persistent PM5 on there instead - hoping the drive is faster.

It's sdc1 on here (I'm currently in a Mint liveusb session running from an 8gig SD card with reader which is faster than my 16gig PM5 drive).
Code: [Select]
mint@mint ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/cow            1.9G  315M  1.6G  17% /
udev            1.9G  8.0K  1.9G   1% /dev
tmpfs           382M  1.4M  381M   1% /run
/dev/sdb1       7.5G  1.5G  6.0G  20% /cdrom
/dev/loop0      1.5G  1.5G     0 100% /rofs
none            4.0K     0  4.0K   0% /sys/fs/cgroup
tmpfs           1.9G  144K  1.9G   1% /tmp
none            5.0M     0  5.0M   0% /run/lock
none            1.9G  808K  1.9G   1% /run/shm
none            100M   36K  100M   1% /run/user
/dev/sdc1       7.5G  4.1G  3.5G  54% /media/mint/USBSTICK
mint@mint ~ $ ^C
mint@mint ~ $

Thanks if any one can help me to get this thing unlocked :-\

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #1 on: March 08, 2015, 01:51:49 pm »
With the USB stick inserted (and preferably nothing in the CD/DVD drive), what's the output from:
Code: [Select]
sudo fdisk -l
and
Code: [Select]
sudo blkid
and
Code: [Select]
mount
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Re: Problem with a USB stick that has become read-only
« Reply #2 on: March 08, 2015, 01:55:58 pm »
Hi Mark, as per below:

Code: [Select]
mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xa52d772c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   500115455   249954304    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 7969 MB, 7969177600 bytes
221 heads, 20 sectors/track, 3521 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: 0x00066aa6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        8192    15564799     7778304    b  W95 FAT32

Disk /dev/sdc: 8053 MB, 8053063680 bytes
255 heads, 63 sectors/track, 979 cylinders, total 15728640 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: 0x0128ec18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63    15728639     7864288+   c  W95 FAT32 (LBA)
mint@mint ~ $ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/sdb1: UUID="5D0A-B398" TYPE="vfat"
/dev/sdc1: LABEL="USBSTICK" UUID="10C8-FE83" TYPE="vfat"
mint@mint ~ $ mount
/cow on / type overlayfs (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
/dev/sdb1 on /cdrom type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/999/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=mint)
/dev/sdc1 on /media/mint/USBSTICK type vfat (ro,nosuid,nodev,uid=999,gid=999,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
mint@mint ~ $

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #3 on: March 08, 2015, 04:26:25 pm »
OK 2 things are weird here

a) The partition ID is "c" =  FAT32 (LBA) .. quite why it's using logical block addressing I don't know  :-\
and
b) The User ID (UID) and Group ID (GID) are set to 999 .. there's not normally an account with that ID in Ubuntu and its derivatives  :-\

Can you post the output from
Code: [Select]
id -u mint
and
Code: [Select]
awk -v val=999 -F ":" '$3==val{print $1}' /etc/passwd

I'm thinking probably the easiest solution would be to unmount the partition, then use GParted to write a new partition table to the USB stick, then create a single FAT32 with a new label (say 8GB-Stick)
Is there anything on this USB stick (as the above will also completely erase it) that you need, and are you able to copy it off ?

Can you also let me know if this is being done on a PC running Mint or in a VM (as they may use weird UID/GID's, though I doubt it)
« Last Edit: March 08, 2015, 04:31:36 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Re: Problem with a USB stick that has become read-only
« Reply #4 on: March 08, 2015, 04:57:47 pm »
I was getting that info from my laptop which is running a Mint LiveUSB session.

I'm now sitting at my PM5 desktop (duel boot) and the outputs are as follows:

Code: [Select]
ms@ms-desktop ~ $ sudo fdisk -l
[sudo] password for ms:

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 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: 0x4cb31ef1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   250066943   124930048    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xd617f385

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  1953521663   976759808    7  HPFS/NTFS/exFAT

Disk /dev/sdc: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders, total 398297088 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: 0xd4a0fe34

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     7813119     3905536   83  Linux
/dev/sdc2         7815166   398295039   195239937    5  Extended
/dev/sdc5         7815168   390483967   191334400   83  Linux
/dev/sdc6       390486016   398295039     3904512   82  Linux swap / Solaris

Disk /dev/sdd: 8053 MB, 8053063680 bytes
255 heads, 63 sectors/track, 979 cylinders, total 15728640 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: 0x0128ec18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1              63    15728639     7864288+   c  W95 FAT32 (LBA)
ms@ms-desktop ~ $ sudo blkid
/dev/sda1: LABEL="System Reserved" UUID="60225BDB225BB52E" TYPE="ntfs"
/dev/sda2: UUID="2EF67A85F67A4CD9" TYPE="ntfs"
/dev/sdb1: LABEL="DATA" UUID="9A501F84501F6673" TYPE="ntfs"
/dev/sdc1: UUID="eef49df1-ad1b-44d9-849f-ed6df43ab506" TYPE="ext4"
/dev/sdc5: UUID="7587050c-bc8d-4bf9-b2e7-30429d2ea379" TYPE="ext4"
/dev/sdc6: UUID="69cee5e5-539c-4c5c-90b6-7a35c7673afc" TYPE="swap"
/dev/sdd1: LABEL="USBSTICK" UUID="10C8-FE83" TYPE="vfat"
ms@ms-desktop ~ $ mount
/dev/sdc5 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sdc1 on /boot type ext4 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=ms)
/dev/sdb1 on /media/ms/DATA type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
/dev/sdd1 on /media/ms/USBSTICK type vfat (ro,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
ms@ms-desktop ~ $ id -u mint
id: mint: no such user
ms@ms-desktop ~ $ id -u ms
1000
ms@ms-desktop ~ $ awk -v val=999 -F ":" '$3==val{print $1}' /etc/passwd
ms@ms-desktop ~ $


Nothing of value on the 8 gig stick, just a handful of high res photos so happy for it to be wiped.

 :)

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #5 on: March 08, 2015, 05:33:20 pm »
OK, that makes a bit more sense .. can we stick with Peppermint until this is done :)

The file system is being mounted  read-only, which is normally an indication that there's a file system error .. by default when a file system error is detected the partition is remounted in read-only mode so no further damage will be done.

The file system error might be no big deal and solved by the format we're about to do, but it could also be indicative of a failing USB stick (not much we can do about that (besides possibly manually remounting the partition read/write, or telling Peppermint not to remount the drive read-only when errors are detected).

Anyway, first things first...

make sure you have copies of anything you need from the USB stick before continuing, as we're about to wipe the stick

Open a terminal and run:
Code: [Select]
sudo umount /media/ms/USBSTICK
now make sure gparted is installed:
Code: [Select]
sudo apt-get install gparted
then fire up GParted (menu > System Tools > GParted)

When GParted starts, make 100% SURE you're working on the 8GiB USB stick (probably /dev/sdd) by selecting it in the drop menu top right of GParted

When you're SURE you're operating on the 8GiBUSB stick .. select
Device > Create Partition Table

and set the new partition type to msdos .. and click the Apply button.

The USB stick should now have NO partitions defined (all unpartitioned) .. so now right click on the unpartitioned space and select New and use these settings:-

Free space preceding (MiB): 1
Free space folllowing (MiB): 0
Align to: MiB
Create as: Primary Partition
File system: fat32
Label: 4GB-Stick


Then click the +Add button.

Then click the Apply all operations icon on the GParted toolbar, and in the resulting dialog click the Apply button.

When it's done, click Close, and close GParted.

Unplug the USB stick .. wait a coup,e of seconds .. replug the USB stick

Then back in the terminal post the output from:
Code: [Select]
sudo fdisk -l
and
Code: [Select]
sudo blkid
and
Code: [Select]
mount
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Re: Problem with a USB stick that has become read-only
« Reply #6 on: March 08, 2015, 05:44:10 pm »
Thanks Mark. Sounds like the drive might be damaged as it still won't write. After unmounting and going into GParted to create the partition it comes up with an error window titled 'Libparted Bug Found!' "Can't write to/dev/sdd, because it is opened read-only".

Sounds like I probably need a new USB drive?

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #7 on: March 08, 2015, 06:26:01 pm »
What happens if you remount the partition read.write .. run:
Code: [Select]
sudo mount -o rw,remount /media/ms/USBSTICK
are you now able to write to the USB stick ?

If so, will GParted let you format it now ?



If you have access to a windows PC, see if it'll let you format the USB stick using this utility:
https://dl.dropboxusercontent.com/u/11876059/HP_USB_Format_Utility.zip
« Last Edit: March 08, 2015, 06:30:26 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Re: Problem with a USB stick that has become read-only
« Reply #8 on: March 08, 2015, 07:38:15 pm »
No joy unfort. I think this drive is foobahed.

Couldn't get it to mount in Linux using that command.

Now in Windows and tried the HP tool but it didn't work.

Am now trying another called HDD Low Level Format Tool 4.40. Is showing errors and keeps going into 'not responding' and then out of it again. Been doing it for 20 mins or so and am only at sector 3500. So can't leave all night, will ditch it.



Recollection is that this is an old, cheap (7dayshop) USB stick so I guess not so surprising that it's failed. ::)

Thanks for your help though  :). I think this is destined for the bin  ;)


Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #9 on: March 08, 2015, 09:07:09 pm »
Yup, FUBAR  :(
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline mattosensei

  • Member
  • ***
  • Posts: 222
  • Karma: 28
  • Linux with 'L' plates
    • View Profile
  • Peppermint version(s): 6
Re: Problem with a USB stick that has become read-only
« Reply #10 on: March 09, 2015, 04:37:57 am »
Yeh will sling it.

Can you advise re: what to look for when buying a USB stick specifically to run a persistent-USB install? Do you need USB 3.0 (my laptop doesn't have a port for that anyway so I'm guessing would be over kill  ???). As mentioned in my first post, I have an old 16GB file that I run persistent PM5 with encrypted home folder from, on my laptop, but it's slow. I've been using Mint on an SD card/reader which has been a lot faster, so I'm guessing that SD card is faster than the old 16GB thumb-drive. Or could it be that because Mint is running unencrypted it's faster?

Thanks  :)

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26468
  • Karma: 2863
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Problem with a USB stick that has become read-only
« Reply #11 on: March 09, 2015, 08:12:09 am »
No point in USB  3.0 unless you have a USB 3.0 port .. that said a USB 3.0 stick will just fall back to USB 2.0 speeds if plugged into a USB 2.0 port, so it can't hurt I guess (there are some reports that a USB3 stick in a USB2 port is not as fast as a USB 2 stick, but I can't personally confirm that one way or the other).

Other than that a USB stick is a USB stick .. I've had expensive branded ones fail quickly, and cheap unbranded last for ages .. but I've also had the opposite too.

With that uncertainty in mind I now tend to just 'go cheap' ;)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec