Three commands answer the questions you have about a disk before, or instead of, mounting it. lsblk shows what block devices the kernel has — disks, partitions, LVM volumes, loop devices, encrypted mappings — as a tree, with their sizes and what is mounted where. blkid reads the signatures on a device and tells you what filesystem, partition table or swap it holds, with the UUID and label that fstab should be using instead of a device name. wipefs lists those same signatures byte by byte and, when you ask, removes them — which is the correct way to make a disk forget it was ever a GPT disk or an ext4 volume, and the thing dd if=/dev/zero is usually a slow and incomplete substitute for.
lsblk -f
blkid /dev/sdb1
wipefs /dev/sdbThe first is the one to run before touching any disk: every device, its filesystem type, label, UUID and mount point. The second pulls the identifiers for one device, which is what you paste into fstab. The third, with no options, is read-only: it prints every signature on the device and does nothing to it. Measured on an Ubuntu 24.04 machine with virtio disks and a 64 MiB loop device set up for the examples:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 253:0 0 0B 0 disk
vda 254:0 0 256G 0 disk /
vdb 254:16 0 9.6M 1 disk /opt/rclone
vdc 254:32 0 430.8M 1 disk /opt/claude-code
$ lsblk -dnpo NAME,SIZE,TYPE,TRAN,ROTA
/dev/vda 256G disk virtio 1
$ blkid /dev/loop0
/dev/loop0: LABEL="lab-data" UUID="d301111e-e027-4a9d-a750-81dabf10c163" BLOCK_SIZE="4096" TYPE="ext4"
$ blkid -o value -s UUID /dev/loop0
d301111e-e027-4a9d-a750-81dabf10c163
$ wipefs /dev/loop0
DEVICE OFFSET TYPE UUID LABEL
loop0 0x438 ext4 d301111e-e027-4a9d-a750-81dabf10c163 lab-datalsblk -d drops partitions and shows only whole devices, -n drops the header, -p prints full paths, and -o picks columns — TRAN is the transport (virtio, sata, nvme, usb) and ROTA is 1 for spinning disks, which is how a script tells an SSD from an HDD. blkid -o value -s UUID is the form for scripts: one value, no quoting. And wipefs with no flags shows where the ext4 superblock’s magic lives: two bytes at offset 0x438, which matters later.
A wiped disk that is not wiped
A GPT disk carries its partition table twice — a primary header near the start and a backup at the very end — and zeroing the first megabyte removes only one of them. The disk then looks blank to blkid and to most installers, while the backup header is still there for any tool that looks, and some will quietly “restore” the old table from it. wipefs sees all three signatures; wipefs -a removes them all. Measured on a freshly partitioned 64 MiB device:
$ wipefs /dev/loop0
DEVICE OFFSET TYPE UUID LABEL
loop0 0x200 gpt
loop0 0x3fffe00 gpt
loop0 0x1fe PMBR
$ dd if=/dev/zero of=/dev/loop0 bs=1M count=1 conv=fsync
$ blkid /dev/loop0; echo "rc=$?"
rc=2
$ wipefs /dev/loop0
DEVICE OFFSET TYPE UUID LABEL
loop0 0x3fffe00 gpt
$ wipefs -a /dev/loop0
/dev/loop0: 8 bytes were erased at offset 0x03fffe00 (gpt): 45 46 49 20 50 41 52 54
/dev/loop0: calling ioctl to re-read partition table: SuccessThree signatures: the GPT header at sector 1 (0x200), the protective MBR in sector 0 (0x1fe), and the backup GPT header in the last sector (0x3fffe00 on a 64 MiB device — on a real disk, gigabytes away from anything dd count=1 touches). After the dd, blkid reports nothing and exits 2, “no such signature”; wipefs still lists the backup. wipefs -a then erases exactly eight bytes — EFI PART, the header’s magic — and tells the kernel to re-read the table. That is the whole job, done in a millisecond, on a disk of any size.
The flip side is just as important: wipefs erases signatures, not data. Removing the ext4 signature is two bytes:
$ wipefs -a --backup /dev/loop0
/dev/loop0: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
$ ls ~/wipefs-loop0-0x00000438.bak
/root/wipefs-loop0-0x00000438.bak
$ dd if=~/wipefs-loop0-0x00000438.bak of=/dev/loop0 seek=$((0x438)) bs=1 conv=notrunc
$ mount /dev/loop0 /mnt/lab && ls /mnt/lab
lost+foundEvery file is still on the disk after wipefs -a; only the two bytes that let the kernel recognise the filesystem are gone. --backup saves them to a file named after the device and offset, and writing them back with dd makes the filesystem mountable again, intact. So wipefs is the right tool for “stop this disk being recognised as X” — before reusing it, before handing it to a new filesystem, before an installer refuses it — and the wrong tool for “make the data unrecoverable”, which needs blkdiscard on an SSD or a full overwrite on a spinning disk.
Options
| Command and flag | Meaning |
|---|---|
lsblk | Tree of every block device: name, major:minor, removable, size, read-only, type, mount points |
lsblk -f | Filesystem view: type, version, label, UUID, free space, mount points |
lsblk -d / -n / -p | Whole devices only (no partitions) / no header / full /dev paths |
lsblk -o COLS | Choose columns: NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,UUID,LABEL,PARTUUID,SERIAL,MODEL,TRAN,ROTA,RM,RO,PKNAME,PATH,DISC-GRAN and more; -o +COL adds to the default set |
lsblk -b / -x COL | Sizes in bytes rather than human units / sort by a column (-x SIZE) |
lsblk -e MAJ / -I MAJ | Exclude / include only these major numbers; -e 7 hides loop devices |
lsblk -s | Inverse tree: a device and what it is built on (a mapper volume down to its disks) |
lsblk -D / -S | Discard (TRIM) capabilities / SCSI-style device list with vendor and model |
lsblk -J | JSON |
blkid [DEV] | All devices (needs root for the probe, else the cache) or one: type, UUID, label, partition table |
blkid -s TAG -o value | One field, bare: -s UUID, -s TYPE, -s LABEL, -s PARTUUID |
blkid -L LABEL / -U UUID | Reverse lookup: which device has this label / UUID (prints the path) |
blkid -t TYPE=ext4 -o device | Every device matching a tag |
blkid -p DEV | Low-level probe, bypassing the cache, with extra fields (VERSION, USAGE, signature offsets); the form to trust after you have just changed a disk |
wipefs DEV | List every signature: offset, type, UUID, label. Read-only |
wipefs -a DEV | Erase all signatures (asks the kernel to re-read partitions afterwards); refuses a mounted or in-use device unless forced |
wipefs -t TYPE / -o OFFSET | Limit to one signature type (-t gpt, -t ext4; -t nodos to exclude) or one offset from the listing |
wipefs --backup | Save each erased byte range to ~/wipefs-DEV-OFFSET.bak first |
wipefs -f | Force: required to erase a partition-table signature on a device the kernel has partitions from, and overrides the mounted check — read the listing twice first |
wipefs -n | Dry run: say what -a would erase |
When lsblk -f is blank and blkid is not
The two commands get their filesystem information from different places. blkid opens the device and reads the signatures itself. lsblk asks udev’s database, which was filled when the device appeared — so on a machine with no udev running, which is most containers, rescue shells in an initramfs, and the sandbox this page was measured in, lsblk -f prints blank FSTYPE, LABEL and UUID columns for a device that blkid reads perfectly well:
$ lsblk -f /dev/loop0
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0
$ blkid /dev/loop0
/dev/loop0: LABEL="renamed" UUID="5b73f7a7-d1c2-46f6-9d73-e4fa56584f94" BLOCK_SIZE="4096" TYPE="ext4"A blank FSTYPE in lsblk therefore means “udev has not told me”, not “no filesystem”. Before concluding a disk is empty, run blkid or wipefs on it; both read the bytes. The same applies on a normal host immediately after mkfs on a device udev has not re-examined yet — udevadm trigger --name-match=sdb1 (or just waiting a moment) brings lsblk back into line.
UUID, PARTUUID and why fstab should use one of them
Device names are assigned in the order the kernel finds devices, and that order is not promised: add a disk, change a cable, boot with a USB stick in, and /dev/sdb is a different disk. A filesystem’s UUID is written into it by mkfs and travels with it; a partition’s PARTUUID is written into the GPT and travels with the partition even before it has a filesystem; a LABEL is whatever you set and is the only one a human can read. fstab lines should use UUID= for filesystems and PARTUUID= for raw partitions a program opens directly; blkid -o value -s UUID gives you the string, and findmnt -se shows what each fstab tag currently resolves to. Two warnings. Cloning a disk with dd clones the UUID, and two filesystems with one UUID make UUID= ambiguous — change one with tune2fs -U random (ext4) or xfs_admin -U generate. And mkfs makes a new UUID every time, so a rebuilt filesystem needs its fstab line updated, which is a classic cause of the emergency-mode boot that findmnt –verify catches.
Where they do not reach
None of the three reads the health of a disk: that is smartctl for the drive and fsck for the filesystem. lsblk does not know what is on an unformatted partition, only that it exists; blkid does not know about mounts, only signatures, so a device can be listed by both while findmnt says it is mounted somewhere unexpected. And wipefs cannot help with a disk that is in use: it refuses with “Device or resource busy” while a filesystem on it is mounted, and a partition table the kernel is still using needs -f, after which the kernel keeps the old table in memory until a re-read or a reboot. Partitioning itself — making the table wipefs just removed — is sfdisk, parted or gdisk, and formatting is mkfs; these pages stop at identification.
Common problems
| Symptom | Cause | Check / fix |
|---|---|---|
lsblk -f shows no filesystem on a disk you know is formatted | No udev, or udev has not re-probed since mkfs | blkid DEV or wipefs DEV; udevadm trigger on a normal host |
Installer or mkfs says the disk still has a partition table after dd of the start | Backup GPT header at the end of the disk | wipefs DEV to see it; wipefs -a DEV |
wipefs: Device or resource busy | Something on the device is mounted, or it is a swap or LVM PV in use | findmnt DEV, swapon --show, pvs; unmount or deactivate first |
Ran wipefs -a on the wrong disk | — | If --backup was used, dd the .bak files back at their offsets; otherwise stop writing to it and recreate the exact signatures (sgdisk, mkfs -S as a last resort) |
blkid prints nothing and exits 2 | No recognisable signature (or no permission to read the device) | wipefs DEV as root; blkid -p to bypass the cache |
blkid as a non-root user shows stale or missing entries | It is reading /run/blkid/blkid.tab, not the device | Run as root, or blkid -p |
| Boot fails after a disk was rebuilt | fstab still has the old UUID | blkid -o value -s UUID for the new one; findmnt --verify |
| Two disks with the same UUID after cloning | dd copies the UUID | tune2fs -U random / xfs_admin -U generate on the clone |
lsblk shows /dev/sdb as a different disk than yesterday | Enumeration order changed | Use SERIAL, WWN, UUID or /dev/disk/by-id/, never bare names, for anything persistent |
A device is listed but SIZE is 0B | Present but not attached to media (empty card reader, uninitialised zram) | Nothing to do unless you expected media |
Quick reference
lsblk # every device, as a tree
lsblk -f # ...with filesystem type, label, UUID, mounts
lsblk -dnpo NAME,SIZE,TRAN,ROTA,SERIAL # whole disks: transport, spinning?, serial
lsblk -o +PARTUUID,PKNAME /dev/sdb # add columns to the default set
lsblk -e 7 -x SIZE # no loop devices, sorted by size
lsblk -s /dev/mapper/vg-root # what a mapper volume sits on
lsblk -J | jq '.blockdevices[].name' # JSON for scripts
blkid # every signature on every device (root)
blkid -o value -s UUID /dev/sdb1 # the string for fstab
blkid -L backup # which device has this label
blkid -U 5b73… # which device has this UUID
blkid -p /dev/sdb1 # probe the device, ignore the cache
wipefs /dev/sdb # list signatures; changes nothing
wipefs -n -a /dev/sdb # dry run of the erase
wipefs -a --backup /dev/sdb # erase all, saving the bytes to ~/
wipefs -a -t gpt /dev/sdb # erase only the partition-table signatures
dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb seek=$((0x438)) bs=1 conv=notrunc # undoRelated reading
- The Life of a Block Device — the long one: from the bus to the mount, and where each of these three commands looks
- findmnt — the mounts on top of the devices this page identifies, and
--verifyfor thefstabyou write withblkid‘s output - Filesystems — what the signatures
wipefslists actually mark - Disk space —
dfanddu, once the device is mounted - Restoring a Linux Server — rebuilding a disk, and the
fstabUUIDs that change when you do - Automated Backups — the disk you are about to
wipefsshould not be the one holding them

