Label an uninitialized disk with an MBR
(msdos) partition table, create a primary partition
with parted, verify the kernel sees it via
lsblk and /proc/partitions, then remove
the partition and confirm the disk returns to a clean state.
A new 100MB disk (/dev/sdb) was attached to a RHEL
VM for a legacy appliance. The appliance requires an MBR
partition table (msdos), not GPT. Your job is to
label the disk, create a small primary partition for testing,
verify the kernel sees it, then remove the partition to return
the disk to a clean state.
Double-check the target device before writing partition tables. The commands in this lab are destructive to existing partition layouts on the selected disk.
msdos) disk label with
parted mklabel.
parted output.lsblk and
/proc/partitions.
parted rm and verify
cleanup.
msdos
in
parted
.
1MiB
is a common alignment practice and avoids MBR reserved space.
parted
updates the partition table, but the kernel may need to re-read it before
/dev/sdb1
appears.
/proc/partitions
is a simple kernel-exported view that helps confirm the partition exists even
when tooling is confusing.
/dev/sdb
.
sudo parted /dev/sdb print
On an uninitialized disk,
parted
will report an unrecognized label and show the disk geometry. This confirms you
are starting from a blank layout.
Error: /dev/sdb: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/sdb: 105MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
msdos) on
/dev/sdb
.
sudo parted /dev/sdb mklabel msdos
This writes the disk label. It is destructive if the disk previously contained a partition layout.
msdos
.
sudo parted /dev/sdb print
Model: Virtio Block Device (virtblk)
Disk /dev/sdb: 105MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
sudo parted /dev/sdb mkpart primary 1MiB 101MiB
Starting at
1MiB
avoids the MBR gap and aligns partitions cleanly. The end boundary leaves a little
room for device geometry and alignment.
Information: You may need to update /etc/fstab.
parted
.
sudo parted /dev/sdb print
Number Start End Size Type File system Flags
1 1.05MiB 101MiB 100MiB primary
/dev/sdb1
.
lsblk /dev/sdb
This is the practical check that userspace sees the device node and the partition.
If
/dev/sdb1
does not appear, you may need a rescan.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 100M 0 disk
└─sdb1 8:17 0 95M 0 part
/proc/partitions
reflects the new partition.
grep -E 'sdb$|sdb1$' /proc/partitions
/proc/partitions
is the kernel’s exported view. This is a clean verification step when
troubleshooting device node issues.
8 16 102400 sdb
8 17 97280 sdb1
sudo parted /dev/sdb rm 1
This removes the partition entry from the table. It does not wipe data blocks, but it returns the partition layout to no partitions.
sudo parted /dev/sdb print
Model: Virtio Block Device (virtblk)
Disk /dev/sdb: 105MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
sdb1
).
lsblk /dev/sdb
You should only see the disk device now. If a stale partition device remains visible, you may need to trigger a rescan.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 100M 0 disk
The kernel may not have re-read the partition table yet. In real environments, you might use
partprobe
or a device rescan to refresh the kernel’s view.
Always verify device identity using
lsblk -o NAME,SIZE,MODEL,SERIAL
when available before writing a new disk label.
Some environments default to GPT. This lab forces
msdos
explicitly to match legacy requirements.
Confirm the partition entry is removed and only the base disk remains visible.
sudo parted /dev/sdb print
lsblk /dev/sdb
grep -E 'sdb$|sdb1$' /proc/partitions || true
parted
shows no partitions, and
lsblk
does not list
sdb1
.
parted /dev/sdb print
: Shows disk geometry and partition table.
print
: Displays current label, partitions, and disk metadata.
parted /dev/sdb mklabel msdos
: Writes an MBR partition table to the disk.
mklabel
: Creates a new disk label (partition table).
msdos
: MBR partition table type.
parted /dev/sdb mkpart primary 1MiB 101MiB
: Creates a primary partition using MiB boundaries.
mkpart
: Creates a new partition.
primary
: Partition type for MBR layouts.
1MiB 101MiB
: Start and end positions with MiB alignment.
parted /dev/sdb rm 1
: Removes a partition by number.
rm
: Deletes the partition entry.
1
: The partition number shown in print.
lsblk /dev/sdb
: Verifies kernel device and partition nodes.
/dev/sdb1
appears or disappears after changes.
/proc/partitions
: Kernel-exported list of block devices and partitions.
When you need deterministic boundaries, prefer MiB units (
1MiB
) and verify with
parted print
immediately after each write.