ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

Disks and partitions: lsblk, parted, fdisk

Lesson 6.17 minIntermediateDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • Find the new disk: lsblk, lsblk -f (no file system), blkid; on a virtual server usually vdb or sdb.
  • parted -s /dev/sdb mklabel gpt mkpart data xfs 1MiB 2GiB — partitioning from a script; write sizes in MiB/GiB.
  • fdisk /dev/sdb: g GPT, n new, t type (lvm for LVM, swap for swap), w write.
  • After partitioning, udevadm settle or partprobe — so the kernel sees the new partition.
  • Partition types: Linux filesystem, Linux LVM, Linux swap — choose the right type for LVM and swap.

Finding the new disk

srv-web01
[ali@srv-web01 ~]$ lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda             8:0    0   40G  0 disk
├─sda1          8:1    0  600M  0 part /boot/efi
├─sda2          8:2    0    1G  0 part /boot
└─sda3          8:3    0 38.4G  0 part
  ├─rhel-root 253:0    0 34.4G  0 lvm  /
  └─rhel-swap 253:1    0    4G  0 lvm  [SWAP]
sdb             8:16   0   10G  0 disk

sdb — 10 GB, with no partitions and no mount point. On KVM/virtio virtual machines disks are called vda, vdb — in the exam always check the name with lsblk.

The first rule: never touch sda (the system disk). Read the disk name a second time before every command.

parted: in one command

We covered fdisk interactively in the Ubuntu course. In scripts and for quick work parted is handy:

srv-web01
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb mklabel gpt
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb mkpart data xfs 1MiB 2GiB
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb mkpart lvm1 2GiB 8GiB set 2 lvm on
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb mkpart swap1 linux-swap 8GiB 100%
[ali@srv-web01 ~]$ sudo parted /dev/sdb print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  2147MB  2146MB               data
 2      2147MB  8590MB  6442MB               lvm1   lvm
 3      8590MB  10.7GB  2147MB               swap1  swap
PartMeaning
mklabel gptA GPT partition table (erases the old one!)
mkpart name type start endA partition; on GPT the name is required
1MiBStart the first partition at 1 MiB — correct alignment
100%To the end of the disk
set 2 lvm onThe LVM flag on partition 2

Watch the units: in parted GB = 1000³, GiB = 1024³. If the task says "2 GiB", write GiB; working in binary units (MiB, GiB) is always more precise.

fdisk: interactive

srv-web01
[ali@srv-web01 ~]$ sudo fdisk /dev/sdb

Command (m for help): n
Partition number (4-128, default 4):
First sector (20969472-20971486, default 20969472):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (20969472-20971486, default 20971486): +512M

Command (m for help): t
Partition number (1-4, default 4): 4
Partition type or alias (type L to list all): lvm
Changed type of partition 'Linux filesystem' to 'Linux LVM'.

Command (m for help): w

The partition size is written as +512M, +2G. t selects the type — by alias (lvm, swap, linux) or number.

Type (fdisk alias)What for
linuxA regular file system
lvmAn LVM physical volume (next lessons)
swapSwap
uefiEFI system partition

Make the kernel see the partition

srv-web01
[ali@srv-web01 ~]$ sudo udevadm settle
[ali@srv-web01 ~]$ lsblk /dev/sdb
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sdb      8:16   0   10G  0 disk
├─sdb1   8:17   0    2G  0 part
├─sdb2   8:18   0    6G  0 part
└─sdb3   8:19   0    2G  0 part

If a new partition does not appear in lsblk: sudo partprobe /dev/sdb. On a disk that is in use (for example the system disk), the kernel sometimes updates its table only after a reboot.

Deleting partitions

srv-web01
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb rm 3
[ali@srv-web01 ~]$ sudo wipefs -a /dev/sdb

wipefs -a erases all signatures on the disk (partition table, file system, LVM) — returning it to a "fresh" state. There is no way back.

Lab: prepare the disk

In the Red Hat simulator the first step of the "LVM on a new disk" task is finding the disk with lsblk; try the partitioning part on your own VM:

  1. Find the empty disk with lsblk (sdb).
  2. On your own VM: create a GPT table and three partitions — 2 GiB (for xfs), 6 GiB (with the LVM flag), the rest (swap).
  3. Check with parted /dev/sdb print and lsblk.
srv-web01
[ali@srv-web01 ~]$ lsblk
[ali@srv-web01 ~]$ sudo parted -s /dev/sdb mklabel gpt mkpart data xfs 1MiB 2GiB mkpart lvm1 2GiB 8GiB set 2 lvm on mkpart swap1 linux-swap 8GiB 100%
[ali@srv-web01 ~]$ lsblk /dev/sdb

We will use these partitions in the next lessons: sdb1 → XFS, sdb2 → LVM, sdb3 → swap. In the simulator, LVM is built on the whole /dev/sdb (6.3).

Check: lsblk shows sdb1, sdb2, sdb3, and sdb2 has the LVM flag.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1What is the first step before an RHCSA storage task?

So the system disk is not wiped by accident.

2Which unit is right for a 2 GiB partition in parted?

GB is decimal (1000³), GiB is binary (1024³).

3Which fdisk command makes a partition's type LVM?

t (type), then lvm.

4A new partition does not appear in lsblk. What do you do?

The kernel must re-read the partition table.

5What does wipefs -a /dev/sdb do?

It cannot be undone.
Was this lesson useful?

Comments

Sign in to comment.