2

I have a thumb drive with a partion containing a bootable POP-OS image. I'd like to reclaim this space and just use as a thumb drive, but in "Disks" utility in POP_OS, if I try to delete:

"Error deleting partition /dev/sdg1: Failed to get partition '1' on device /dev/sdg (udisks-error-quark, 0)"

If I try to format:

"This partition cannot be modified because it contains a partition table; please reinitialize layout of the whole device (udisks-error-quark, 11)"

I am a linux amateur and toasted my last thumb drive so I am being cautious. How to make it one big partition?

4
  • Use dd to wipe the first few blocks of the USB. Try dd if=/dev/zero of=/dev/sdg bs=512 count=100 Commented Jul 8, 2020 at 1:03
  • It will probably work with dd according to fpmurphy's advice, but it is risky, because there is no final checkpoint. A minor typing error is enough to damage valuable data. I suggest that you use mkusb for this purpose. Commented Jul 8, 2020 at 6:28
  • @sudodus. What you you mean by "there is no final checkpoint"? Commented Jul 8, 2020 at 9:46
  • @fpmurphy, dd will start doing what you tell it to do without any question. It does not ask for a confirmation (at a 'final checkpoint'), where you can double-check, that the command points to the correct target device. Commented Jul 8, 2020 at 13:53

2 Answers 2

4

Sometimes it is very difficult to wipe drive with OS partition, especially bootable drives. You can easily do this by using wipefs command.
Open terminal, check the partitions available in your drive by running
fdisk -l This will list all the devices mounted on your system and their details.
Your drive should be listed as /dev/sd..., be very sure of the block device name of the drive you are erasing because any changes made would be irreversible.
Forcefully erase the disk by running
wipefs -a -f /dev/your_block_device_name
After the above operations, you can now easily format the GNOME Disks desktop application, click on Disks » Drive Name » Right click on Settings Icon » Format Partition
GOOD LUCK !

0

Read this first to understand your situation:

You may be facing this error because a partition table may have been created inside this partition and now it has subpartitions. The partition can be loop mounted and recognized as a full drive containing subpartitions inside it. One way to create this environment is to run: parted /dev/sdg1 and force it to consider the partition as a complete device. After you're inside parted you would run mktable msdos to create an MBR partition table and after this you will be able to create subpartitions.

Now you may understand what happened, here's a possible solution. An easy way to clear a partition table is to write at the beginning of the device. You can do it in Unix-like systems by using the command dd. Giving specific parameters for it to wipe just the partition table:

dd if=/dev/zero of=/path/to/your/partition bs=1048576 count=1

This command will read zeroes from "/dev/zero" 1048576 bytes at a time (1MB total) and do it only once. The first 1MB of an MBR disk contains info about the partitions and a bootloader in case the disk has an OS installed in it. A sane partition creation procedure will always jump the first 1MB of data in the disk and create the first partition after it in order to not corrupt or overwrite this valuable data.

In your specific case, you may change the example path to /dev/sdg1 (the partition that has a partition table) and run the dd command, this way the program may no more find a partition table and proceed.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.