Linux usb delete partition

Remove all partition from USB drive

On 18.04 I’ve made a bootable pen drive. Now I don’t need it. I want to remove the iso9660 partition. sudo cfdisk /dev/sdb I tried to delete (it makes) but when I want to save the changes, it fails.

@j-money In my opinion, this should be an answer, as it does not require anything that is not already installed and is desktop environment agnostic.

4 Answers 4

The non-interactive sfdisk can do this from the CLI:

See man sfdisk for details.

Use gnome-disks. That is the tool I use to remove, create and format partition in my USB drives.

You can easily install it with the command

sudo apt install gnome-disk-utility

Welcome to AskUbuntu! You don’t have to be running Gnome to use gnome-disk-utility. It’s either pre-installed or available for all flavors of Ubuntu.

You can use mkusb with a graphical user interface. You can select

There are more details at the following links to Ubuntu help wiki pages

If mkusb cannot solve the problem, you can analyze it, and if you are lucky solve it, according to the following link

Rather than installing any extra software (and if you’re comfortable with the command line), I would suggest using the dd command.

To wipe your USB fire up the gnome-terminal and type

sudo dd if=/dev/zero of=/path/to/usb 

As was pointed out in the comments, you may be better off only wipe the MBR so as not to roast the USB

dd if=/dev/zero of=/dev/ bs=512 count=1 seek=0 

Edit: Again as stated in comments MBR is in fact not 440 bytes :facepalm:

Источник

Thread: How can I remove the partition from a usb stick

Alan5 is offline5 Cups of Ubuntu

How can I remove the partition from a usb stick

I have booted from live ubuntu usb sticks, 8GB size. There were problems which is why there are two. I wish to reclaim one of these for genereal use.

Please, how do I remove the partition ?

Before coming here I searched by google, The advice is format the stick under Windows. This does not work.

ttshivers is offlineFrothy Coffee!

Re: How can I remove the partition from a usb stick

You can delete a partition on a flash drive just like deleting a partition on any other storage device. Here is an article explaining how: http://www.ehow.com/how_7331108_dele. ernal-hdd.html

Ad@m is offlineA Carafe of Ubuntu

Читайте также:  Команда linux на перезагрузку

Re: How can I remove the partition from a usb stick

You should be able to delete and format the partitions in Windows by using ‘Disk Management’

Right click on My Computer > Manage > Disk Management

C.S.Cameron is offlineUbuntu addict and loving it

Join Date Jun 2007 Location North Vancouver, Canada Beans 3,443 —> Beans 3,443 Distro Ubuntu 20.04 Focal Fossa

Re: How can I remove the partition from a usb stick

I blame two bricked flash drives on trying to format in Windows.
Windows does not like multi partition flash drives.

Use gparted if you have more than one partition.

Alan5 is offline5 Cups of Ubuntu

Re: How can I remove the partition from a usb stick

Alan5 is offline5 Cups of Ubuntu

Re: How can I remove the partition from a usb stick

I tried the suggestion of ttshivers described at the eHow site. I was running ubuntu off another memory stick. The process didn’t work.

The partitiioned drive showed a usable memory of 7.4 GB . Empty and unpartitioned it would show 8.0 .

The method is : plug in the device then : System > Administration > Disk Utility > Peripheral Devices . Select the drive.

This utility appears excellent. In the lower part of the pane Delete Partition produces «The device is busy,» so Unmount the partition then Delete it. The lower part of the pane showed that there is no partition. The drive was present, showing the 7.4 GB . To reclaim the full memory I clicked on Format , which produced the 8.0 .

The snag is that the stick is now invisible under ubuntu and fedora. Windows can see drive F: , but tells me to insert a disk. Even the Disk Utility cannot find it.

I suspect the Format command, because this should take what it finds and deliver a useful drive..

I am losing appetite for this.

Источник

Format a USB stick completely

How can I delete all data that is on stick? For example I have this problem: My stick has two partitions A (3.7 GB) and B (330 MB). How can I merge the two partitions in one and to delete all data that they contain? I guess they have read-only properties. How can I force deleting them? I see this in GParted:

3 Answers 3

How to erase / delete / blank or wipe a disk

I’m sure there are other methods, but the one I prefer to use is the one that uses dd to copy zeros, or random data in the file system I want to wipe.

So, run this command if you want to erase your… let’s say microSD card.

Читайте также:  Linux list all binaries

Suppose it is mounted on /dev/sdd1 :

dd if=/dev/urandom of=/dev/sdd1 

If you do not want to wait too much, you can fill the partition with zeros instead of random data:

Both are secure, but IMHO the first one may be better, but of course I can be wrong.

Once again, be sure to double check, or better triple check on which partition you are going to apply this, you will not be warned by Linux, and the result can not be undone.

A good practice could be to first make an image of the disk and then wipe it. If you want to proceed that way, do this.

dd if=/dev/[partition-to-wipe] of=/tmp/backup.img 
dd if=/dev/urandom of=/dev/[partition-to-wipe] 

You can then recover the data by doing

dd if=/tmp/backup.img of=/dev/[partition-to-wipe] 

Urrr. Doesn’t restoring the image restore anything that was removed by wiping it with /dev/random or /dev/zero ?

@wilf Nope. /dev/zero is just a place where data gets dumped and destroyed. If you reboot, nothing will be left, might even be before!

@wilf True. I think he just included that in case John ツ wants to restore the data in case he accidentally didn’t want to wipe that stick.

GParted

Just use GParted.

Unmount all the partitions on the USB stick, and then delete them. You can then create partitions as you like. The is some documentation here if you need any.

This should effectively wipe any partitions. — remember to click this green button, or it won’t do anything:

enter image description here

If you just want to wipe it, you could also find the device name in sudo fdisk -l in terminal, and then run:

Where sdX1 is the name and partition number of the device, which you can find in GParted or fdisk . This is not that necessary if you just use GParted, but you may need to use GParted afterwards to reformat it anyway.

If is not visible, it is probably not there in the first place. Just delete everything, and some new partitions (FAT32 is best if you want it to work with Windows as well)Having copied anything you want off first — 🙂

Is this a common-or-garden USB stick? Wiping the partition table would get rid of everything as well. Note that you have to click the tick in GParted before it does anything.

Simple! Start up gparted via the terminal ( Ctrl + Alt + T ) and entering sudo gparted

terminal

.

Once you do that gparted will start.

gparted starting

The USB stick should show in the disks area (upper-right-hand corner) as something like /dev/usb or /dev/sdb . Make sure the disk selected is the USB stick, the following steps will wipe ALL data on the selected disk.

Читайте также:  Alt linux dns сервер

new partition window

click Apply . You may have to also start this process by clicking the check-mark button.

This will create a new partition table and will make the data unrecoverable by most people.

Источник

How to delete a partition on a USB drive?

I have a USB drive that I accidentally partitioned when trying to put Ubuntu on it. It’s a 16 GB Kingston flash drive but it is now split to two partitions, 7.30 GB each. How do I combine the two partitions into one? I have tried Disk Management in Windows but no luck.

Can’t test that on windows, but if you have Linux unstalled or can boot a live CD or something, you can use cfdisk , delete all partitions then create a new unique one.

4 Answers 4

You can do this by using diskpart on Windows:

  1. Open an elevated command prompt.
  2. Run diskpart
  3. list disk
  4. Note the disk number that corresponds to your USB drive (it should be obvious going by size)
  5. select disk X where X is the number from step 4
  6. list partition — There should be two, numbered 0 and 1, each about 7 GB
  7. select partition 0
  8. delete partition
  9. select partition 1
  10. delete partition
  11. create partition primary
  12. exit
  13. Exit Command Prompt (type exit or just close the window)
  14. In Windows, go to Computer(or This PC for Windows 10) and try to open the disk. It will ask you to format it.
  15. Format it with the default settings and give it a name if you want.

It should now a single, unified partitioned drive.

everything works untill step 6. there is still only 1 partition listed as 7569mb. the problem might be that the second partition is not allocated to anything?

The steps in my answer will do it for you. If there is only partition 0 and no partition 1, skip steps 8 and 9, but do the rest.

Instead of selecting every partition one by one and then deleting, you should be able to simply use clean after selecting a disk.

I had to perform four more steps to get my single partition to be recognized by Windows (after step 11) as a letter drive (The biggest is probably the «assign» step. Please note I wasn’t trying to save anything on the USB drive so a full format wasn’t a concern for me): 11a. select partition 1 11b. active 11c. format fs=ntfs quick 11d. assign

thank you so so much, I had to use delete partition override for it to work. But this answer was perfect and to the point.

Источник

Оцените статью
Adblock
detector