What Should I know About The RHCSA Exam
RHCSA 8 Exam practice question 6
Create a 512M partition, make it as ext4 file system, mounted automatically under /mnt/data and which take effect automatically at boot-start.
The question is based On Storage Management In Linux in The RHCSA 8 Course on this website. If you have gone through this course, solving this wouldn’t be a problem.
Storage Management In Linux (LVM In Linux)
1 verify the disks on the server,
NOTE: If a disk is specified in the Exam, use the disk
[root@lab02 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 32G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 31G 0 part
├─rootvg-tmplv 253:0 0 2G 0 lvm /tmp
├─rootvg-usrlv 253:1 0 10G 0 lvm /usr
├─rootvg-optlv 253:2 0 2G 0 lvm /opt
├─rootvg-homelv 253:3 0 1G 0 lvm /home
├─rootvg-varlv 253:4 0 8G 0 lvm /var
└─rootvg-rootlv 253:5 0 8G 0 lvm /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /mnt
sdc 8:32 0 32G 0 disk
[root@lab02 ~]#
2. create a 512M partition on sdc
[root@lab02 ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xfe6d09dd.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-67108863, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-67108863, default 67108863): +512M
Created a new partition 1 of type 'Linux' and of size 512 MiB.
Command (m for help): p
Disk /dev/sdc: 32 GiB, 34359738368 bytes, 67108864 sectors
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: 0xfe6d09dd
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 1050623 1048576 512M 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@lab02 ~]#
3. verify if the partition has been created.
[root@lab02 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 32G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 31G 0 part
├─rootvg-tmplv 253:0 0 2G 0 lvm /tmp
├─rootvg-usrlv 253:1 0 10G 0 lvm /usr
├─rootvg-optlv 253:2 0 2G 0 lvm /opt
├─rootvg-homelv 253:3 0 1G 0 lvm /home
├─rootvg-varlv 253:4 0 8G 0 lvm /var
└─rootvg-rootlv 253:5 0 8G 0 lvm /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /mnt
sdc 8:32 0 32G 0 disk
└─sdc1 8:33 0 512M 0 part
[root@lab02 ~]#
4. Format the volume to ext4
[root@lab02 ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.44.3 (10-July-2018)
Discarding device blocks: done
Creating filesystem with 131072 4k blocks and 32768 inodes
Filesystem UUID: 8383ef24-a910-4829-ae81-6898b95102a9
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
[root@lab02 ~]#
5. verify it’s been formatted to ext4
[root@lab02 ~]# blkid |grep /dev/sdc1
/dev/sdc1: UUID="8383ef24-a910-4829-ae81-6898b95102a9" TYPE="ext4" PARTUUID="fe6d09dd-01"
6. create a mount point, /mnt/data
[root@lab02 ~]# mkdir /mnt/data
[root@lab02 ~]#
7. map the partition to the mount point.
[root@lab02 ~]# mount /dev/sdc1 /mnt/data
[root@lab02 ~]#
8. verify it’s been mounted
[root@lab02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.6M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 7.9G 61M 7.4G 1% /
/dev/mapper/rootvg-usrlv 9.8G 1.5G 7.9G 16% /usr
/dev/mapper/rootvg-homelv 976M 2.8M 906M 1% /home
/dev/mapper/rootvg-optlv 2.0G 6.0M 1.8G 1% /opt
/dev/sda1 976M 92M 817M 11% /boot
/dev/mapper/rootvg-varlv 7.9G 248M 7.2G 4% /var
/dev/mapper/rootvg-tmplv 2.0G 6.1M 1.8G 1% /tmp
/dev/sdb1 20G 45M 19G 1% /mnt
tmpfs 392M 0 392M 0% /run/user/0
/dev/sdc1 488M 780K 452M 1% /mnt/data
9. Edit the fstab file to make it persistent (take effect automatically at boot-start)
[root@lab02 ~]# vim /etc/fstab
[root@lab02 ~]#
10. Do a mount all to verify the fstab file is correctly inputted
[root@lab02 ~]# mount -a
[root@lab02 ~]#
11. Reboot.
Note: One thing you will always want to do in the RHCSA exam is to reboot as many times as possible to confirm that your system is okay. It’s very important. If your system doesn’t come up after solving all your questions, you will score a FAT zero
lsblk
fdisk /dev/sdc
lsblk
mkdir.ext4 /dev/sdc1
blkid |grep /dev/sdc1
mkdir /mnt/data
mount /dev/sdc1 /mnt/data
df -h
vim /etc/fstab
mount -a
reboot
You can also watch the Video on RHCSA 8 Exam Practice Question 6 by clicking the link below.
Your feedback is welcomed. If you love others, you will share with others
Hi, I noticed many typo’s in some answers in different Q’s, in this “mkdir.ext4”, I think should be mkfs.ext4? And is there a reason why in the fstab all FS’s are mounted with options 1 2 and not just 0 0?
Hi Theo,
The command is mkfs.ext4 in the main solution. The typo is in the solution summary and it will be corrected. Thanks for pointing this out. And yes, there is a reason why filesystems are mounted with 1 2 , and 0 0. The choice is yours. See here to understand fstab mount options (https://tekneed.com/storage-management-in-linux-explained-with-examples/#etc-fstab-file)
Is it ok to use the parted command instead of fdisk when making partitions for the exam?
Yes, as far as you are comfortable using it and its going to do the work.
cho mình hỏi khi mình vào vim /etc/fstab thì cho mình hỏi là bạn cho mình công thức ghi văn bản trong đó để tự động chạy khi khởi động được không ạ