Lesson 5.1: Create, mount, unmount, and use vfat, ext4, and xfs file systems


Created partition and mount folders

[root@serverB ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sr0 11:0 1 1024M 0 rom nvme0n1 259:0 0 25G 0 disk ├─nvme0n1p1 259:1 0 600M 0 part /boot/efi ├─nvme0n1p2 259:2 0 1G 0 part /boot └─nvme0n1p3 259:3 0 18.4G 0 part ├─cs-root 253:0 0 16.4G 0 lvm / └─cs-swap 253:1 0 2G 0 lvm [SWAP] nvme0n2 259:4 0 5G 0 disk nvme0n3 259:5 0 5G 0 disk nvme0n4 259:6 0 5G 0 disk [root@serverB ~]# [root@serverB ~]# gdisk /dev/nvme0n2 GPT fdisk (gdisk) version 1.0.7 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): n Partition number (1-128, default 1): First sector (34-10485726, default = 2048) or {+-}size{KMGTP}: Last sector (2048-10485726, default = 10485726) or {+-}size{KMGTP}: +512M Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): n Partition number (2-128, default 2): First sector (34-10485726, default = 1050624) or {+-}size{KMGTP}: Last sector (1050624-10485726, default = 10485726) or {+-}size{KMGTP}: +512M Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): n Partition number (3-128, default 3): First sector (34-10485726, default = 2099200) or {+-}size{KMGTP}: Last sector (2099200-10485726, default = 10485726) or {+-}size{KMGTP}: +512M Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): p Disk /dev/nvme0n2: 10485760 sectors, 5.0 GiB Model: VMware Virtual NVMe Disk Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 76D2C6D1-BCA4-4C90-A69E-9BA1198EDAB3 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 10485726 Partitions will be aligned on 2048-sector boundaries Total free space is 7339965 sectors (3.5 GiB) Number Start (sector) End (sector) Size Code Name 1 2048 1050623 512.0 MiB 8300 Linux filesystem 2 1050624 2099199 512.0 MiB 8300 Linux filesystem 3 2099200 3147775 512.0 MiB 8300 Linux filesystem Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/nvme0n2. The operation has completed successfully. [root@serverB ~]# [root@serverB ~]# partprobe /dev/nvme0n2 [root@serverB ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sr0 11:0 1 1024M 0 rom nvme0n1 259:0 0 25G 0 disk ├─nvme0n1p1 259:1 0 600M 0 part /boot/efi ├─nvme0n1p2 259:2 0 1G 0 part /boot └─nvme0n1p3 259:3 0 18.4G 0 part ├─cs-root 253:0 0 16.4G 0 lvm / └─cs-swap 253:1 0 2G 0 lvm [SWAP] nvme0n2 259:4 0 5G 0 disk ├─nvme0n2p1 259:10 0 512M 0 part ├─nvme0n2p2 259:11 0 512M 0 part └─nvme0n2p3 259:12 0 512M 0 part nvme0n3 259:5 0 5G 0 disk nvme0n4 259:6 0 5G 0 disk [root@serverB ~]# cd /mnt [root@serverB mnt]# mkdir xfs_dir [root@serverB mnt]# mkdir ext4_dir [root@serverB mnt]# mkdir vfat_dir [root@serverB mnt]# cd

Make filesystems

# XFS [root@serverB ~]# mkfs -t xfs /dev/nvme0n2p1 meta-data=/dev/nvme0n2p1 isize=512 agcount=4, agsize=32768 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1 nrext64=0 data = bsize=4096 blocks=131072, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 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 # EXT4 [root@serverB ~]# mkfs -t ext4 /dev/nvme0n2p2 mke2fs 1.46.5 (30-Dec-2021) Creating filesystem with 131072 4k blocks and 32768 inodes Filesystem UUID: b7314a68-8555-494c-b5bb-cd85170be584 Superblock backups stored on blocks: 32768, 98304 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done # VFAT [root@serverB ~]# mkfs -t vfat /dev/nvme0n2p3 mkfs.fat 4.2 (2021-01-31) [root@serverB ~]# blkid /dev/nvme0n2p1 /dev/nvme0n2p1: UUID="b5771d68-b344-4242-a8da-d3c81b23b898" TYPE="xfs" PARTLABEL="Linux filesystem" PARTUUID="149f8956-3ba9-4e3d-b54e-7bfed0f5e5e0" [root@serverB ~]# blkid /dev/nvme0n2p2 /dev/nvme0n2p2: UUID="b7314a68-8555-494c-b5bb-cd85170be584" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="71268420-4bcd-4cbc-a16c-0a59f1bd96e3" [root@serverB ~]# blkid /dev/nvme0n2p3 /dev/nvme0n2p3: UUID="9632-72E6" TYPE="vfat" PARTLABEL="Linux filesystem" PARTUUID="7415dae1-4e49-4637-b4f8-ff96594bd396"

Mount

[root@serverB ~]# vim /etc/fstab [root@serverB ~]# tail -3 /etc/fstab /dev/nvme0n2p1 /mnt/xfs_dir xfs defaults 0 0 /dev/nvme0n2p2 /mnt/ext4_dir ext4 defaults 0 0 /dev/nvme0n2p3 /mnt/vfat_dir vfat defaults 0 0 [root@serverB ~]# systemctl daemon-reload [root@serverB ~]# mount -a [root@serverB ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sr0 11:0 1 1024M 0 rom nvme0n1 259:0 0 25G 0 disk ├─nvme0n1p1 259:1 0 600M 0 part /boot/efi ├─nvme0n1p2 259:2 0 1G 0 part /boot └─nvme0n1p3 259:3 0 18.4G 0 part ├─cs-root 253:0 0 16.4G 0 lvm / └─cs-swap 253:1 0 2G 0 lvm [SWAP] nvme0n2 259:4 0 5G 0 disk ├─nvme0n2p1 259:10 0 512M 0 part /mnt/xfs_dir ├─nvme0n2p2 259:11 0 512M 0 part /mnt/ext4_dir └─nvme0n2p3 259:12 0 512M 0 part /mnt/vfat_dir nvme0n3 259:5 0 5G 0 disk nvme0n4 259:6 0 5G 0 disk
All systems normal

© 2025 2023 Sanjeeb KC. All rights reserved.