UUID is globally unique except cloned partition
So need to generate new UUID after clone partition to avoid error in future actions
Label is human-readable custom name.
Follow 43 - Create Partition >> 43.3 Create Extended & Logical Partition >> 10. Select ending sector
Don't need to create Logical Partition 2
Verify the partitions were created.
p
Saves all changes to the physical disk and exits fdisk.
Changes made before existing only in RAM and can be undone.
w (Write)
Display partitions created
lsblk
Create xfs filesystem
Primary or logical partition only, extened partition can't be formatted.
mkfs.xfs [Partition]
Example: mkfs.xfs /dev/sdb1
Create ext4 filesystem
Primary or logical partition only, extened partition can't be formatted.
mkfs.ext4 [Partition]
Example: mkfs.ext4 /dev/sdb2
Display filesystem created
lsblk -f
Result
student@localhost:~$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.40.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2):
First sector (2099200-20971519, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-20971519, default 20971519):
Created a new partition 2 of type 'Extended' and of size 9 GiB.
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (2101248-20971519, default 2101248):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-20971519, default 20971519): +2G
Created a new partition 5 of type 'Linux' and of size 2 GiB.
Command (m for help): p
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK
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: 0x379b37cb
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 2099199 2097152 1G 83 Linux
/dev/sdb2 2099200 20971519 18872320 9G 5 Extended
/dev/sdb5 2101248 6295551 4194304 2G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
student@localhost:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 25G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 24G 0 part
├─rhel-root 253:0 0 21.5G 0 lvm /
└─rhel-swap 253:1 0 2.5G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part
├─sdb2 8:18 0 1K 0 part
└─sdb5 8:21 0 2G 0 part
sr0 11:0 1 1024M 0 rom
student@localhost:~$ sudo mkfs.xfs /dev/sdb1
[sudo] password for student:
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=1 bigtime=1 inobtcount=1 nrext64=1
= exchange=0 metadir=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
= rgcount=0 rgsize=0 extents
= zoned=0 start=0 reserved=0
student@localhost:~$ sudo mkfs.ext4 /dev/sdb5
mke2fs 1.47.1 (20-May-2024)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 950b0bc3-d649-42ac-8890-1063328f1949
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs 50ab6b2e-9419-4b1e-921c-7b93ab824055
├─sdb2
└─sdb5 ext4 1.0 950b0bc3-d649-42ac-8890-1063328f1949
sr0
Check UUID
If no sudo, new created filesytem might not be shown
sudo blkid
Check /etc/fstab content
cat /etc/fstab
Copy UUID to /etc/fstab
Refer Command List >> Read File for awk command explanation
sudo blkid | grep [Partition] | awk '{ print $2}' | sudo tee -a /etc/fstab
Example:
sudo blkid | grep sdb1 | awk '{ print $2}' | sudo tee -a /etc/fstab
sudo blkid | grep sdb5 | awk '{ print $2}' | sudo tee -a /etc/fstab
Open /etc/fstab and edit
vim /etc/fstab --> Esc --> I
Edit partition details
UUID=[UUID] [Mount Point] [Filesystem Type] defaults 0 0
Example:
UUID=50ab6b2e-9419-4b1e-921c-7b93ab824055 /mnt xfs defaults 0 0
UUID=950b0bc3-d649-42ac-8890-1063328f1949 /mnt ext4 defaults 0 0
Save vim
Esc --> :wq --> Enter
Verify edited /etc/fstab
cat /etc/fstab
Verify if there any syntax error before rebooting
If there's no syntax error, should have message: your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload
findmnt --verify
Reload systemd to update /etc/fstab
sudo systemctl daemon-reload
Mount filesystem
sudo mount -a
Verify
lsblk
Cleanup - Remove UUID in etc/fstab
vim /etc/fstab --> Esc --> I
Esc --> :wq --> Enter
sudo systemctl daemon-reload
Result
student@localhost:~$ sudo blkid
[sudo] password for student:
/dev/mapper/rhel-root: UUID="55d945ec-a35f-4434-bb1e-d6fe17df0f0a" BLOCK_SIZE="512" TYPE="xfs"
/dev/sda3: UUID="cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4" TYPE="LVM2_member" PARTUUID="013ee834-bfba-4354-b23c-da3a0a7d452f"
/dev/mapper/rhel-swap: UUID="7e46962b-2032-4f88-b7fa-8f9f8ffe515d" TYPE="swap"
/dev/sda2: UUID="65c11ddf-89a5-4f6f-a93e-38a4c7aed30c" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="fbfe43a2-90bb-4941-bbbb-a191af1abcde"
/dev/sdb5: UUID="950b0bc3-d649-42ac-8890-1063328f1949" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="379b37cb-05"
/dev/sdb1: UUID="50ab6b2e-9419-4b1e-921c-7b93ab824055" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="379b37cb-01"
/dev/sda1: PARTUUID="8fa0b879-5d28-4779-90af-a5e28089ada5"
student@localhost:~$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Oct 16 03:25:31 2026
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=55d945ec-a35f-4434-bb1e-d6fe17df0f0a / xfs defaults 0 0
UUID=65c11ddf-89a5-4f6f-a93e-38a4c7aed30c /boot xfs defaults 0 0
UUID=7e46962b-2032-4f88-b7fa-8f9f8ffe515d none swap defaults 0 0
UUID=8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0 /mnt xfs defaults 0 0
student@localhost:~$ sudo blkid | grep sdb1 |awk '{ print $2}' | sudo tee -a /etc/fstab
UUID="50ab6b2e-9419-4b1e-921c-7b93ab824055"
student@localhost:~$ sudo blkid | grep sdb5 |awk '{ print $2}' | sudo tee -a /etc/fstab
UUID="950b0bc3-d649-42ac-8890-1063328f1949"
student@localhost:~$ sudo vim /etc/fstab
student@localhost:~$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Oct 16 03:25:31 2026
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=55d945ec-a35f-4434-bb1e-d6fe17df0f0a / xfs defaults 0 0
UUID=65c11ddf-89a5-4f6f-a93e-38a4c7aed30c /boot xfs defaults 0 0
UUID=7e46962b-2032-4f88-b7fa-8f9f8ffe515d none swap defaults 0 0
UUID=8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0 /mnt xfs defaults 0 0
UUID=50ab6b2e-9419-4b1e-921c-7b93ab824055 /mnt xfs defaults 0 0
UUID=950b0bc3-d649-42ac-8890-1063328f1949 /mnt ext4 defaults 0 0
student@localhost:~$ findmnt --verify
/
[W] cannot detect on-disk filesystem type (Permission denied)
/boot
[W] cannot detect on-disk filesystem type (Permission denied)
none
[W] cannot detect on-disk filesystem type (Permission denied)
/mnt
[W] target specified more than once
[W] target specified more than once
[E] unreachable on boot required source: UUID=8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0
/mnt
[W] target specified more than once
[W] cannot detect on-disk filesystem type (Permission denied)
/mnt
[W] cannot detect on-disk filesystem type (Permission denied)
[W] your fstab has been modified, but systemd still uses the old version;
use 'systemctl daemon-reload' to reload
0 parse errors, 1 error, 9 warnings
student@localhost:~$ sudo systemctl daemon-reload
[sudo] password for student:
student@localhost:~$ sudo mount -a
mount: /mnt: can't find UUID=8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0.
student@localhost:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 25G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 24G 0 part
├─rhel-root 253:0 0 21.5G 0 lvm /
└─rhel-swap 253:1 0 2.5G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /mnt
├─sdb2 8:18 0 1K 0 part
└─sdb5 8:21 0 2G 0 part /mnt
sr0 11:0 1 1024M 0 rom
student@localhost:~$ sudo vim /etc/fstab
student@localhost:~$ sudo systemctl daemon-reload
Unmount partition
sudo umount [Partition]
Example:
sudo umount /dev/sdb1
sudo umount /dev/sdb5
Check current UUID
lsblk -f
Generate UUID
For ext4, message shows may need to run sudo e2fsck -f [Partition]
Example: sudo e2fsck -f /dev/sdb5
Example:
sudo xfs_admin -U generate /dev/sdb1
sudo tune2fs -U random /dev/sdb5
4. Verfiy new UUID
lsblk -f
Result
student@localhost:~$ sudo umount /dev/sdb5
student@localhost:~$ sudo umount /dev/sdb1
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs 50ab6b2e-9419-4b1e-921c-7b93ab824055
├─sdb2
└─sdb5 ext4 1.0 950b0bc3-d649-42ac-8890-1063328f1949
sr0
student@localhost:~$ sudo xfs_admin -U generate /dev/sdb1
Clearing log and setting UUID
writing all SBs
new UUID = a7bfc266-3389-4df6-b18f-c403640d319b
student@localhost:~$ sudo tune2fs -U random /dev/sdb5
tune2fs 1.47.1 (20-May-2024)
This operation requires a freshly checked filesystem.
Please run e2fsck -f on the filesystem.
student@localhost:~$ sudo e2fsck -f /dev/sdb5
e2fsck 1.47.1 (20-May-2024)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb5: 11/131072 files (0.0% non-contiguous), 26156/524288 blocks
student@localhost:~$ sudo tune2fs -U random /dev/sdb5
tune2fs 1.47.1 (20-May-2024)
Setting the UUID on this filesystem could take some time.
Proceed anyway (or wait 5 seconds to proceed) ? (y,N) y
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs a7bfc266-3389-4df6-b18f-c403640d319b
├─sdb2
└─sdb5 ext4 1.0 9b9dcc71-9cb5-4fd1-95fc-27f5146227ee
sr0
Unmount partition
sudo umount [Partition]
Example:
sudo umount /dev/sdb1
sudo umount /dev/sdb5
Check lable
lsblk -f
Assign label
Example:
sudo xfs_admin -L xfs_label /dev/sdb1
sudo tune2fs -L ext4_label /dev/sdb5
4. Verfiy new UUID
lsblk -f
5. Cleanup
Example:
sudo xfs_admin -L -- /dev/sdb1
sudo tune2fs -L "" /dev/sdb5
6. Verify
lsblk -f
Result
student@localhost:~$ sudo umount /dev/sdb1
umount: /dev/sdb1: not mounted.
student@localhost:~$ sudo umount /dev/sdb5
umount: /dev/sdb5: not mounted.
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs a7bfc266-3389-4df6-b18f-c403640d319b
├─sdb2
└─sdb5 ext4 1.0 9b9dcc71-9cb5-4fd1-95fc-27f5146227ee
sr0
student@localhost:~$ sudo xfs_admin -L xfs_lable /dev/sdb1
writing all SBs
new label = "xfs_lable"
student@localhost:~$ sudo tune2fs -L ext4_label /dev/sdb5
tune2fs 1.47.1 (20-May-2024)
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs xfs_lable a7bfc266-3389-4df6-b18f-c403640d319b
├─sdb2
└─sdb5 ext4 1.0 ext4_label 9b9dcc71-9cb5-4fd1-95fc-27f5146227ee
sr0
student@localhost:~$ sudo xfs_admin -L -- /dev/sdb1
writing all SBs
new label = ""
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs a7bfc266-3389-4df6-b18f-c403640d319b
├─sdb2
└─sdb5 ext4 1.0 ext4_label 9b9dcc71-9cb5-4fd1-95fc-27f5146227ee
sr0
student@localhost:~$ sudo tune2fs -L "" /dev/sdb5
tune2fs 1.47.1 (20-May-2024)
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 495.3M 48% /boot
└─sda3 LVM2_member LVM2 001 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 16.4G 23% /
└─rhel-swap swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
├─sdb1 xfs a7bfc266-3389-4df6-b18f-c403640d319b
├─sdb2
└─sdb5 ext4 1.0 9b9dcc71-9cb5-4fd1-95fc-27f5146227ee
sr0
Labels can be used in /etc/fstab but not recommended.
It's because label can be duplicated in multiple partitions.
LABEL=[Label Name] [Mount Point] [Filesystem Type] defaults 0 0
Example: LABEL=xfs_label /mnt xfs defaults 0 0