I have installed Ubuntu on the USB stick and afterwards tried to clean up the disc to install another version of Ubuntu.
I was not able to do it (even when tried to delete files by using sudo -rm), because of the read-only files.
Trying to format the disk with gparted: the disks has flags boot and lbs. After unmounting the disk I get the code in console:
/dev/sdb: unrecognised disk label
Input/output error during write on /dev/sdbAfter typing in the terminal
fdisk -lI receive this message:
Disk /dev/sdb: 8441 MB, 8441462784 bytes 64 heads, 32 sectors/track, 8050 cylinders, total 16487232 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: 0x704e26c8
Disk /dev/sdb doesn't contain a valid partition table`After running:
fdisk /dev/sdb
o
n (and than all default, so: primary, partition number 1, first sector 2048, last sector 16487231)
wand trying to write a new partition table I get this message:
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.After running
dmesg | tailThe code:
[ 8223.479979] Info fld=0x0
[ 8223.479984] sd 12:0:0:0: [sdb]
[ 8223.479990] Add. Sense: Write protected
[ 8223.479995] sd 12:0:0:0: [sdb] CDB:
[ 8223.479998] Write(10): 2a 00 00 00 00 00 00 00 08 00
[ 8223.480043] end_request: critical target error, dev sdb, sector 0
[ 8223.480050] Buffer I/O error on device sdb, logical block 0
[ 8223.480054] lost page write due to I/O error on sdb
[ 9080.052379] FAT-fs (sdb1): invalid media value (0x10)
[ 9080.052389] FAT-fs (sdb1): Can't find a valid FAT filesystemAfter running:
sudo dd if=/dev/zero of=/dev/sdX bs=512 count=1I got:
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0,011829 s, 43,3 kB/sso I guessed it worked. Unmounted the disk, rebooted the system and the problem persist.
- Do you have some ideas how to repair it?
I would be thankful for help!
51 Answer
In similar conditions, I messed up the formatting of a USB pen drive, and at the point of opening it the file manager threw this message
Error mounting /dev/sdb1 at /media/user/usbsrive: Command-line `mount -t "vfat" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush" "/dev/sdb1" "/media/user/usbdrive"' exited with non-zero exit status 32: mount: /dev/sdb1: can't read superblock
I think this command helped me a lot to reverse the bad twist of luck (change sdX into the drive where the device is plugged in, see fdisk -l for example):
sudo dd if=/dev/zero of=/dev/sdX bs=512 count=1
I reopened it with gparted (v 0.25.0) and it only complained about not finding the partition table. So with the same tool I created the partition table again, formatted the disk to my liking, and have it up and running again. Probably I would have achieved the same with fdisk.
Previously I would have concluded that the drive was irremediably lost and thrown it into the bin.