Is it possible to unmount a partition table so I only see sda and not sda1 and sda2 in /dev?


I know a partition table is not mounted. But I did not find a better name for this.

I often use dd to overwrite a hard disk or an usb pen. But they often have some partitions on it. And after overwriting I can still see the old (no longer existing) partition table using lsblk.

I know it's possible to reread the partition table using partprobe.

But I wonder if it is possible to unmount the partition table before overwriting the usb pen. Because I don't want a programm to access a corrupt partition while overwriting with dd.

1 Answer 1


You can use partx's -d option to tell the kernel to forget about partitions. For example, partx -d /dev/sda will make /dev/sda1, /dev/sda2, ... go away (temporarily). They'll show up again next time the kernel is made to re-scan the partition table.

Another option is delpart: delpart /dev/sda 1; delpart /dev/sda 2 should do it (but the partx syntax is nicer).

A third option is to wipe the partition table first then let the kernel reread it; any partition table editor tool (e.g., sfdisk, gdisk, etc.) could be used, or wipefs (which will do partition tables, not just filesystems).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .