Special thanks advices from Samuel Amoah-Danquah | LinkedIn.
Follow 44 - Filesystem >> 44.3 Create Filesystem by Format Partition
It's not recommend to use this method for permanent solution.
Because the device/partition name always changed after reboot.
So user may confused and mount wrong partition
Example: Original is/dev/sdb1, after reboot will become /dev/sda1
Decide mount point
11 - Mount is mount external storage like USB so is recommended create new folder under /mnt, example /mnt/my_device.
For partition may mount direct under /mnt.
Check filesystem before mount
The <MOUNTPOINT> columns show empty for the partition
lsblk
Mount filesystem
mount [Partition] [Mount Point]
Example: mount /dev/sdb1 /mnt
Check filesystem after mount
The <MOUNTPOINT> columns show /mnt for the partition
lsblk
Result
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
sr0 11:0 1 1024M 0 rom
student@localhost:~$ sudo mount /dev/sdb1 /mnt
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
sr0 11:0 1 1024M 0 rom
Unmount partition
sudo umount [Partition]
Example: sudo umount /dev/sdb1
Identify the UUID of the partition
sudo blkid [Partition]
Example: sudo blkid /dev/sdb1
Identify filesystem type
Refer column FSTYPE
lsblk -f
Example: xfs
Open/etc/fstab by vim
sudo vim /etc/fstab --> Esc --> I
Add partition into /etc/fstab
UUID=[UUID] [Mount Point] [Filesystem Type] defaults 0 0
Example: UUID=8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0 /mnt xfs 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
Result
student@localhost:~$ sudo umount /dev/sdb1
student@localhost:~$ sudo blkid /dev/sdb1
/dev/sdb1: UUID="8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="379b37cb-01"
student@localhost:~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
│
├─sda2
│ xfs 65c11ddf-89a5-4f6f-a93e-38a4c7aed30c 629.8M 34% /boot
└─sda3
│ LVM2_m LVM2 cgm27m-e6d1-zNZI-1L5H-nuOG-l2Np-rePdc4
├─rhel-root
│ xfs 55d945ec-a35f-4434-bb1e-d6fe17df0f0a 15.8G 26% /
└─rhel-swap
swap 1 7e46962b-2032-4f88-b7fa-8f9f8ffe515d [SWAP]
sdb
└─sdb1
xfs 8b6a9bfc-6c6a-4c7a-bdca-1cd6b2892ba0
sr0
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
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] 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, 0 errors, 5 warnings
student@localhost:~$ sudo systemctl daemon-reload
student@localhost:~$ sudo mount -a
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
sr0 11:0 1 1024M 0 rom
Simulate running process at directory cause partition failed to unmount
cd [Mount Point] && sleep 300 &
Example: cd /mnt && sleep 300 &
Unmount the partition
Fail to unmount, error: target is busy
sudo umount [Mount Point]
Example: sudo umount /mnt
Record PID of busy process/open files under mount points/device/partition
For directory, sudo lsof +D [Mount Point]
Example: sudo lsof +D /mnt (In this tutorial we choose this)
For specific device/partition, sudo lsof [Partition]
Example: sudo lsof /dev/sdb1
Kill the process under the lsof
sudo kill [PID]
Example:
sudo kill 7268
sudo kill 7269
Verify all process/open files under mount points/device/partition are cleared
For directory, sudo lsof +D [Mount Point]
Example: sudo lsof +D /mnt (In this tutorial we choose this)
For specific device/partition, sudo lsof [Partition]
Example: sudo lsof /dev/sdb1
Unmount the partition
Success to unmount
sudo umount [Mount Point]
Example: sudo umount /mnt
[Extra] Use lazy unmount only for no other choice
If you have tried closing applications or killing stuck processes, but the mount point still refuses to unmount.
sudo umount [Mount Point]
Example: sudo umount /mnt
Verify
lsblk
Result
student@localhost:~$ cd /mnt && sleep 300 &
[1] 7268
student@localhost:~$ sudo umount /mnt
umount: /mnt: target is busy.
student@localhost:~$ sudo lsof +D /mnt
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 7268 student cwd DIR 8,17 6 128 /mnt
sleep 7269 student cwd DIR 8,17 6 128 /mnt
student@localhost:~$ sudo kill 7268
[1]+ Terminated cd /mnt && sleep 300
student@localhost:~$ sudo kill 7269
student@localhost:~$ sudo lsof +D /mnt
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
Output information may be incomplete.
student@localhost:~$ sudo umount /mnt
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
sr0 11:0 1 1024M 0 rom
Don't need to clean up if you want to proceed next chapter
Follow 43 - Create Partition >> 43.5 Cleanup - Delete Hard Disk