RHCSA Rapid Track
In this lab, you will create an MBR partition on a newly allocated disk, format the partition with an ext4 file system, and configure the file system for persistent mounting.
| Resources: | |
|---|---|
| Machines: | serverX |
Outcomes
1 GiB ext4 file system on second disk persistently mounted at /archive.
Reset your serverX system.
Log into serverX.
Switch to
rootusing sudo -i.
You have been asked to archive data to a new directory,
/archive, on serverX. You have been allocated a second disk
for this purpose. The /archive directory will require 1 GiB
of space. To make sure that the /archive directory is
always available for use, you will need to configure the newly created
file system to be persistently mounted at /archive
even after a server reboot.
Once you have completed your work, reboot your serverX machine and
verify that the newly created file system is persistently mounted at
/archive after the reboot.
Create a 1 GiB MBR partition on
/dev/vdbof type Linux.Use fdisk to modify the second disk.
[root@serverX ~]#fdisk /dev/vdbDisplay the original partition table, then add a new partition that is 1 GiB in size.
Command (m for help):
pDisk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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 Disk label type: dos Disk identifier: 0xfd41a9d3 Device Boot Start End Blocks Id System Command (m for help):nPartition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p):pPartition number (1-4, default 1):1First sector (2048-20971519, default 2048):EnterUsing default value 2048 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):+1GPartition 1 of type Linux and of size 1 GiB is setSave the partition table changes.
Command (m for help):
wThe partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.If fdisk issues a warning, then run the partprobe command to make the kernel aware of the partition table change. This will not be necessary if the disk device is currently unused.
[root@serverX ~]#partprobe
Format the newly created partition with the ext4 file system.
[root@serverX ~]#mkfs -t ext4 /dev/vdb1mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 65536 inodes, 262144 blocks 13107 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=268435456 8 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: doneConfigure the newly created file system to persistently mount at
/archive.Create the
/archivedirectory mount point.[root@serverX ~]#mkdir /archiveDetermine the UUID of the new partition on the second disk.
[root@serverX ~]#blkid /dev/vdb1/dev/vdb1: UUID="5fcb234a-cf18-4d0d-96ab-66a4d1ad08f5" TYPE="ext4"Add an entry to
/etc/fstab.UUID=5fcb234a-cf18-4d0d-96ab-66a4d1ad08f5 /archive ext4 defaults 0 2
Test mounting the newly created file system.
Execute the
mountcommand to mount the new file system using the new entry added to/etc/fstab.[root@serverX ~]#mount -aVerify that the new file system is mounted at
/archive.[root@serverX ~]#mount | grep -w /archive/dev/vdb1 on /archive type ext4 (rw,relatime,seclabel,data=ordered)
Reboot serverX. After the server has rebooted, log in and verify that
/dev/vdb1is mounted at/archive.[student@serverX ~]$
mount | grep ^//dev/vda1 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota) /dev/vdb1 on /archive type ext4 (rw,relatime,seclabel,data=ordered)