unable to delete / create partition / format USB stick

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Elt10W

unable to delete / create partition / format USB stick

Post by Elt10W »

This is a 64 GB Nexxtech USB stick. Somehow, I seem to have corrupted it, and now can only un / mount it in Nemo, and view the contents. BUT I can't write to it, delete any files on it, nor reformat or re-partition it. The gnome-disk-utility shows as Master Boot Record /dev/sdc1 (READ-ONLY) W95 / FAT 32 with 1.6 Gb Free Space at the end. :?

How do I delete the entire partition(s) and reformat the drive? I can't seem to access it with the proper write permissions even as 'sudo'.

I'd hate to throw this out, as I got it at a good price, and I barely had it a month... :oops:
TIA for any assistance, pointers in the right direction...
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

It could be a matter of ownership, or permissions.
If your mount point is /media/mint/32GBusb - for example:
Take ownership of the mount point and all directories on the USB so that you can edit grub.cfg and add and remove .iso files freely:
(or whatever other operation you intend)
sudo chown -R yourusername:yourusername /media/mint/32GBusb
- edit the command for your actual user name and the correct mount point.

If that doesn't work, I have always been able to fix uncooperative USB drives using the dd command.
First, make sure you know the linux drive letter for your USB drive. You don't want to accidentally erase your hard drive. Run the following commands just to be sure you have the right drive designation.
inxi - pou or sudo fdisk -l
Since I have two internal hard drives, my USB is sdc. Yours might be sdb or sdd
Now you can erase the boot area and everything on the drive with this command
sudo dd if=/dev/zero of=/dev/sdX bs=4096
- where X is your USB drive
It takes a long time to dd a drive, so be patient. My 8 GB drive took almost 20 minutes.
That will write zeros to the entire drive, including the MBR (partition table), so you will have to create a new partition table when it is done.
If you don't have GParted, install it > sudo apt-get install gparted
Open GParted and locate the USB drive using the drop-down menu at the top right.
Unmount the USB drive - right click > Unmount
Create a new partition table - Device > Create Partition Table > msdos
Create a new ext2 partition - right click on the unallocated space > New > Format: ext2, Label: 32GBusb
- (it can be ext2, ext3, or ext4. I use ext2 on flash drives because the lack of journaling means less wear and tear on the drive. Of course, you can use FAT32 if you prefer.)
Close GParted.
Now you have a clean USB drive ready for your files.
http://community.linuxmint.com/tutorial/view/1846
Last edited by austin.texas on Sun Dec 14, 2014 1:24 pm, edited 1 time in total.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

Thank you so much austin.texas! I have saved / printed the instructions. Will try the 'simplest first', i.e. gparted. I'm a poor typist, so there is a risk of errors when I use the command-line. However, I shall resort to using the console, if need be. Though I tend to use the GUI,I recognise that power and efficacy of the linux console. Navigating up through Nemo, the mount point of the device is media/elton/Nexxtech 64.

.... much appreciated. Will report back later! :)
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

Elt10W wrote: Navigating up through Nemo, the mount point of the device is media/elton/Nexxtech 64.
With a space in the Label, you will have to put it in quotes in a command -
media/elton/"Nexxtech 64"
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

This machine is my Asus EEE 1000 PC netbook with two SDDs. hence the USB is /dev/sdc. (I made sure to remove and unmount my SD card (/dev/sde) so I don't delete the wrong partition!

So now I have to resort to the console (this is GOOD PRACTICE for me since I'm taking the EDX course "Introduction to Linux". 8)

console output:
~ $ sudo fdisk -l
[sudo] password for elton:

Disk /dev/sda: 8069 MB, 8069677056 bytes
255 heads, 63 sectors/track, 981 cylinders, total 15761088 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: 0x000e75df

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 15247359 7622656 83 Linux
/dev/sda2 15249406 15759359 254977 5 Extended
/dev/sda5 15249408 15759359 254976 82 Linux swap / Solaris

Disk /dev/sdb: 32.3 GB, 32279224320 bytes
255 heads, 63 sectors/track, 3924 cylinders, total 63045360 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: 0x000ef14f

Device Boot Start End Blocks Id System
/dev/sdb1 2048 63043583 31520768 83 Linux

Disk /dev/sdc: 64.4 GB, 64425558016 bytes
255 heads, 63 sectors/track, 7832 cylinders, total 125831168 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: 0x00007d9b

Device Boot Start End Blocks Id System
/dev/sdc1 2048 125828096 62913024+ b W95 FAT32
elton@el-1000 ~ $

also:
elton@el-1000 ~ $ inxi -pou
Partition: ID: / size: 7.1G used: 4.7G (70%) fs: ext4 dev: /dev/sda1 uuid: 7ee270c4-467a-4855-a9dd-f921ebc9c4ad
ID: /home size: 30G used: 1.4G (5%) fs: ext4 dev: /dev/sdb1 uuid: d1a78ed0-89c6-4afb-a359-80768bacaf1f
ID: swap-1 size: 0.26GB used: 0.24GB (94%) fs: swap dev: /dev/sda5 uuid: a7b5fc08-0e34-4583-8a5a-a53ceafdf378
Unmounted: No unmounted partitions detected
elton@el-1000 ~ $

... will report back later. Again, THANK YOU!
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

seems that I'm proceeding correctly:

~ $ sudo chown -R elton:elton /media/elton/"Nexxtech 64"
chown: changing ownership of ‘/media/elton/Nexxtech 64/DSC_0331A.JPG’: Read-only file system
chown: changing ownership of ‘/media/elton/Nexxtech 64/The(bla,bla).mp4’: Read-only file system
chown: changing ownership of ‘/media/elton/Nexxtech 64’: Read-only file system

... and now:
Disk /dev/sdc: 64.4 GB, 64425558016 bytes
255 heads, 63 sectors/track, 7832 cylinders, total 125831168 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: 0x00007d9b

Device Boot Start End Blocks Id System
/dev/sdc1 2048 125828096 62913024+ b W95 FAT32
==================================
~ $ sudo dd if=/dev/zero of=sdc1 bs=4096

The light on this 64Gb stick should flash. However, the cursor in my console is blinking. I'll just leave this alone for a few hours. My tiny netbook is 7-years old (32-bit) with a mere 1GB RAM. :wink:
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

while running this:
~ $ sudo dd if=/dev/zero of=sdc1 bs=4096

Unexpected complication: :shock:
"running out of space on home directory".

System is 2 SDDs (/dev/hda,8 Gb and /dev/hdb, 32 Gb)
/hda = 7 Gb (mount= /) and 261 Mb swap)
/hdb = 32 Gb (mount = /home) I quickly removed everything I could find out of my home folder. (26 Gb free at the moment)

The Nexxtech (/dev/hdc) is 64 Gb. Would "dd" need my entire home directory to swap? I see it's writing data there...
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

sudo chown -R elton:elton/media/elton/"Nexxtech 64"
Your command above should have a space after the elton:elton
Like this
sudo chown -R elton:elton /media/elton/"Nexxtech 64"
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

To wipe the whole usb drive, the command would be:
sudo dd if=/dev/zero of=sdc bs=4096
not:
sudo dd if=/dev/zero of=sdc1 bs=4096
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

I've mounted my external 1Tb HD (W95/FAT32), 866 Gb free space. The 'passport" light blinks, assuring me that there is activity going on.

$ cd /media/elton/"MY PASSPORT"
===================================
/media/elton/MY PASSPORT $ sudo dd if=/dev/zero of=sdc bs=4096
dd: error writing ‘sdc’: File too large
1048576+0 records in
1048575+0 records out
4294967295 bytes (4.3 GB) copied, 217.26 s, 19.8 MB/s
elton@el-1000 /media/elton/MY PASSPORT $

======================================
Still the process abends... What am i still doing wrong? Is it because of file size limitation of VFAT?
FWIW, I am not running anything whatsoever on the external HD while this is going on: no reads, no writes.
:?
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

Sorry, you omitted the /dev in the command -
It should be
sudo dd if=/dev/zero of=/dev/sdc bs=4096
(see my first post)
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: unable to delete / create partition / format USB stick

Post by Flemur »

austin.texas @6:11 pm [now it says "4:11 pm...")= TYPOS. ( /dev/ missing)

Use his 7:09 am information.

while running this:
~ $ sudo dd if=/dev/zero of=sdc1 bs=4096
Unexpected complication:
"running out of space on home directory".


That command wrote zeros to a file named 'sdc1' in whatever directory you were in when you ran it.

That's a method for wiping the free-space on your disk: fill it with zeros, then delete the file to get the space back. You should delete the regular file named 'sdc1', which is just filled with zeros. Then use austin.texas's 7:09 am post info.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: unable to delete / create partition / format USB stick

Post by austin.texas »

Flemur wrote: use austin.texas's 7:09 am post info.
times are different for each viewer :?
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

I aborted the process (CTRL-C), Did a clean shutdown, then reboot.
Removed the 'junk' "sdc" files off the external HD.

I've corrected the syntax as pointed out.(Herewith is a copy-paste of what I did in the console):

el-1000 ~ $ cd /media/elton/"MY PASSPORT"
elton@el-1000 /media/elton/MY PASSPORT $ sudo dd if=/dev/zero of=/dev/sdc bs=4096

The console cursor is blinking in tandem with the indicator light on my external HD. I trust that I'm doing it properly this time (...despite my muddle-headedness!) :oops:

Thank you both! :)
Cardenio

Re: unable to delete / create partition / format USB stick

Post by Cardenio »

Elt10W wrote:I'd hate to throw this out, as I got it at a good price, and I barely had it a month...
Just a thought, but there are a lot of pirated flashdrives being sold for a "good price" on eBay. For instance; a 64 GB stick might only have a 8 GB NAND unit inside, and the controller is set to loop the 8 GB eight times to make it appear to your computer as being 64 GB.

If all else fails, Partdisk from the Windows command line is great for restoring flash drives to their original capacity.
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

Cardenio wrote:
Elt10W wrote:I'd hate to throw this out, as I got it at a good price, and I barely had it a month...
Just a thought, but there are a lot of pirated flashdrives being sold for a "good price" on eBay. For instance; a 64 GB stick might only have a 8 GB NAND unit inside, and the controller is set to loop the 8 GB eight times to make it appear to your computer as being 64 GB.

If all else fails, Partdisk from the Windows command line is great for restoring flash drives to their original capacity.
I don't use Windows. I don't have a Windows (nor an Apple Mac) machine. I'll keep following the procedure outlined by the other respondents, but thank you for your suggestion, nevertheless!
Elt10W

Re: unable to delete / create partition / format USB stick

Post by Elt10W »

Just to update and thank all who responded: I should have cut my losses and just junked that $30 USB 64 Gb. It managed to corrupt my external 1 Tb, causing the system to report it as "32 Gb"! :evil: Lost all my data....most is backed up on the cloud,though. Formatted the "Passport" in my chromebook. I believe that chromeos doesn't do low level formatting...given the speed that it's done. Going by this theory, I'm running gparted (with gpart) on my netbook with the hope that some data can be recovered on the 1Tb.

A hard lesson ... but you live and learn! <sigh> :oops:
Locked

Return to “Hardware Support”