How to delete device signature using wipefs command on Ubuntu

This short tutorial will show you how to wipe or delete device signature on a USB flash disk using wipefs command on Ubuntu. Previously, I got many errors when trying to delete partitions on my USB Flash disk which contains Fedora filesystem inside. The Fedora filesystem brings error (device signature) on Ubuntu when using GParted to repartition the device. So, first I must delete the signature information on the USB disk before I can use it with GParted. To wipe this device signature, I use wipefs command.

What is wipefs ?

wipefs is a special command that will wipe the signature from a device. When combined with -a option, wipefs command will erase the whole filesystem, raid or partition-table signature on a specific device to make the signatures invisible for libblkid. (read the original source)

How to use wipefs?

I will show you how to use wipefs command using my own example. Here is my fdisk -l command output, showing the detailed information about my disks.

Disk /dev/sda: 465,8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0xc0e05ef6

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 195311615 195309568 93,1G 83 Linux
/dev/sda4 195313662 976771071 781457410 372,6G f W95 Ext’d (LBA)
/dev/sda5 567175168 976771071 409595904 195,3G 7 HPFS/NTFS/exFAT
/dev/sda6 195313664 488280063 292966400 139,7G 83 Linux
/dev/sda7 488282112 567175167 78893056 37,6G 82 Linux swap / Solaris

Partition table entries are not in disk order.

Disk /dev/sdb: 3,8 GiB, 4063232000 bytes, 7936000 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
Disklabel type: dos
Disk identifier: 0x165c7323

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 7935999 7933952 3,8G 7 HPFS/NTFS/exFAT

Look at the /dev/sdb section. I will wipe the /dev/sdb (my usb disk) using wipefs command

First, make sure there is no mounted partition on the USB disk. Use the umount command to unmount.

sudo umount /dev/sdb1

Now wipe the disk using wipefs

sudo wipefs -a /dev/sdb

If it success, it should show something like this

gamblisfx@gamblisfx-comp:~$ sudo wipefs -a /dev/sdb
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioclt to re-read partition table: Success

Now check the device using fdisk command

sudo fdisk -l

gamblisfx@gamblisfx-comp:~$ sudo fdisk -l

Disk /dev/sda: 465,8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0xc0e05ef6

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 195311615 195309568 93,1G 83 Linux
/dev/sda4 195313662 976771071 781457410 372,6G f W95 Ext’d (LBA)
/dev/sda5 567175168 976771071 409595904 195,3G 7 HPFS/NTFS/exFAT
/dev/sda6 195313664 488280063 292966400 139,7G 83 Linux
/dev/sda7 488282112 567175167 78893056 37,6G 82 Linux swap / Solaris

Partition table entries are not in disk order.

Disk /dev/sdb: 3,8 GiB, 4063232000 bytes, 7936000 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

Now look at the /dev/sdb device. There is no more partitions found on the device which means all the partitions and signature information have been erased. Now we can start create new partition and filesystem to the USB disk. Please be careful when doing this. Any error or mistakes can damage your data on the disk forever.

Admin

Leave a Reply

Your email address will not be published. Required fields are marked *