SIMULATION - Create a 512M partition, make it as ext4 file system, mounted automatically under /mnt/data and which take effect automatically at boot-start.
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
#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
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!
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.
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.
upvoted 2 times
...
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
nickoftime
Highly Voted 3 years, 7 months agochyaba
3 years, 3 months agoly01
Most Recent 4 months, 4 weeks agokenkct
2 years, 9 months agoSTFN2019
3 years, 2 months agopipolo1113
3 years, 8 months agoRedQuasar
3 years, 11 months agoSameer
3 years, 11 months agoRoldo97
3 years, 10 months ago