EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 17


SIMULATION -

Create a 512M partition, make it as ext4 file system, mounted automatically under /mnt/data and which take effect automatically at boot-start.

Show Answer
Correct Answer:

To create a 512M partition, format it to ext4 filesystem, and mount it automatically under /mnt/data during boot, follow these steps: 1. Create a 512M partition: ```bash # fdisk /dev/vda ``` - Use the 'n' command to create a new partition. - Specify '+512M' for the size. - Use the 'w' command to write the changes and exit. 2. Let the system know about the partition changes: ```bash # partprobe /dev/vda ``` 3. Format the partition to ext4 filesystem: ```bash # mkfs.ext4 /dev/vda1 ``` - Note: Ensure the partition number is correct (e.g., /dev/vda1). 4. Create the mount point: ```bash # mkdir -p /mnt/data ``` 5. Edit the /etc/fstab file to mount the partition automatically at boot: ```bash # vim /etc/fstab ``` - Add the line: '/dev/vda1 /mnt/data ext4 defaults 0 0' 6. Reload the fstab configuration and mount the partition: ```bash # mount -a ``` Following these steps will ensure that the partition is created, formatted, and set to be mounted automatically under /mnt/data at system boot.

Discussion

6 comments
Sign in to comment
nickoftime
Apr 27, 2021

lsblk (checkin empty disk) parted /dev/vdb mkpart primary ext4 2048s 512MB udevadm settle mkfs.ext4 /dev/vdb1 lsblk --fs(fp..whatever u can get UUID.. for /dev/vdb1 ) append /etc/fstab UUID=xxxx /mnt/data ext4 defaults 0 0 systemctl daemon-reload mount -a

chyaba
Aug 10, 2021

I think "parted /dev/vdb mkpart primary ext4 2048s 513MB" is correct. size will be 512MB

STFN2019
Sep 15, 2021

Another solution to this is to use fdisk utility so: #fdisk -l (to check for empty disk) #fdisk /dev/sdd (format disk in question) #n (new partition) #p (for primary) #Enter (use the first sector by default) #+size 512M (to specify the size) #Enter #w (to write the changes) #fdisk -l /dev/sdd1 (to verify partition has been created) #mkfs.ext4 /dev/sdd1 (to format the partition with ext4 file system) #mkdir /mnt/data (to create the mount point) #mount /dev/sdd1 (mount the partition) #vi /etc/fstab (to configure auto mount after each boot) Press Shift G to go to the last line and press O to start in new line in Insert mode. Enter the following (ensure you press TAB for each part of the entry): /dev/sdd1 /mnt/data /ext4 defaults 0 0 Exit out of the Insert mode and type: :wq! Job done!

kenkct
Feb 28, 2022

#sudo su #lsblk -psf (to check for empty disk) #fdisk /dev/sd[] (format disk in question) #n (new partition) #p (for primary) #Enter (use the first sector by default) #+size 512M (to specify the size) #Enter #w (to write the changes) #lsblk -psf(to verify partition has been created) #mkfs.ext4 /dev/sd[]1 (to format the partition with ext4 file system) #mkdir /mnt/data (to create the mount point) #lsblk -psf (to show the UUID for the newly created file system) #echo 'UUID=XXX /mnt/data ext4 defaults 0 0' >> /etc/fstab #systemctl daemon-reload #mount -a

RedQuasar
Dec 12, 2020

parted /dev/sda mkpart primary 2048s 512M mkfs.ext4 /dev/sda1 mkdir /mnt/data2 lsblk -pf (UUID= 36721aac-2a8a-457f-927c-446bbb805753) echo “UUID= 36721aac-2a8a-457f-927c-446bbb805753 /mnt/data2 ext4 defaults 0 0” >> /etc/fstab

Sameer
Dec 14, 2020

Hi RedQuasar, was going thru ur comment and the answer posted with question. Refered to exam preparation guide of RHCSA 8 and realised i can still use the method written in the answer. Your answer is right but the provided answer is also acceptable. Can u guide if i choose the above answer or the method with answer is correct.

Roldo97
Jan 13, 2021

Hi Sameer. In the exam, you can use any tool that you prefer to make partitions on block devices (gdisk, fdisk, parted). The only exception may be, when thay ask you tu use an specific partition table for de device. In example: If the question says that you must use a GUID partition table, you'll be forced to use parted o gdisk.

pipolo1113
Mar 16, 2021

And finally: systemctl daemon-reload mount -a

ly01
Jul 9, 2024

also, if you prefer to use gdisk: lsblk gdisk /dev/sdb p - print n - new - 512M w -write sudo mkfs.ext4 /dev/sdb1 lsblk -f sudo mkdir /mnt/data sudo vim /etc/fstab -> /dev/sdb1 /mnt/data2 ext4 defaults 0 0 tail -n1 /etc/fstab /dev/sdb1 /mnt/data2 ext4 defaults 0 0 sudo systemctl daemon-reload sudo mount -a lsblk -f