Sie sind auf Seite 1von 68

May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Password Break 1
STEP 1: Restart the Server
STEP 2: In the OS selection screen,

SELECT the ‘Red Hat Enterprise Linux Server (3.10.0-327.e17.x86_64) 7.2 (Majpo)’ and then PRESS ‘e’.

NOTE: The screen stays for only 4 sec, so in order to pause the screen , you should press UP and DOWN arrow
before it changes the screen. To make the mouse active on the screen and PAUSE the screen, click CTRL + G
followed by UP and DOWN arrow.

STEP 3: On the following screen…. Press DOWN arrow till you find line starting with with word “linux16 ……”,
go to end of that line [PRESS END Key] and give SPACE and type rd.break after UTF-8 word and then press
CTRL + X

1
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

STEP 4: On switch_root:/# prompt, give the following 2 commands to mount the system

switch_root:/# mount –oremount,rw /sysroot


switch_root:/# chroot /sysroot

2
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

STEP 5: On sh-4.2# prompt, give the command to change the root password as follows

Sh-4.2# echo “redhat” | passwd --stdin root

NOTE: redhat is the new password for the root user.

STEP 6: Type the following command to create a new hidden file called .autorelabel

Sh-4.2# touch /.autorelabel

STEP 8: Type Exit (twice) to exit and logout.

3
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Then use new root password to login into the system.

NOTE:
After successful login, give the following command to switch to graphical mode (permanent):

# systemctl set-default graphical.target


# reboot

4
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Network Configuration 2
Assumption : station# 7

password : redhat
ip address: 172.24.7.10
netmask : 255.255.255.0
gateway : 172.24.254.254
nameserver ip : 172.24.254.254
hostname: station net7.example.com
domain name: example.com

STEP 1: Display all Network Adapter Devices and TAKE NOTE OF THE DEVICE NAME

# ip addr show
OR
# nmcli device show

# ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN


link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UP qlen 1000
link/ether 00:0c:29:79:27:68 brd ff:ff:ff:ff:ff:ff
inet 192.168.164.128/24 brd 192.168.164.255 scope global dynamic
eno16777736
valid_lft 1677sec preferred_lft 1677sec
inet6 fe80::20c:29ff:fe79:2768/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
state DOWN
link/ether 52:54:00:ef:03:bf brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master
virbr0 state DOWN qlen 500

NOTE:
eno16777736 : Primary Ethernet connection

5
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# nmcli device show

GENERAL.DEVICE: eno16777736
GENERAL.TYPE: Ethernet
GENERAL.HWADDR: 00:0C:29:79:27:68
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: eth0
GENERAL.CON-PATH:
/org/freedesktop/NetworkManager/ActiveConnection/0
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.164.128/24
IP4.GATEWAY: 192.168.164.2
IP4.DNS[1]: 192.168.164.2
IP4.DOMAIN[1]: localdomain
IP6.ADDRESS[1]: fe80::20c:29ff:fe79:2768/64
IP6.GATEWAY:

NOTE AND CHECK:


GENERAL.DEVICE: eno16777736
GENERAL.CONNECTION: eth0

NOTE: GENERAL.CONNECTION: i.e. network connection must be there like above, if


GENERAL.CONNECTION is BLANK like below

GENERAL.CONNECTION: --

Then first you have ADD the connection using using below command:

# nmcli connection add


type ethernet
con-name eth0 --> New Connection Name
ifname eno16777736

STEP 3: Check total number of available connections

# nmcli connection show

NAME UUID TYPE DEVICE


virbr0 219dd17a-91a1-478a-bb25-dae6daf9c8d0 bridge virbr0
eth0 40a4c7ab-f873-47a4-9e37-9d4da9df68e2 802-3-ethernet eno16777736
virbr0-nic 0130a60c-2bfe-4b1d-921f-921ca453a91d 802-3-ethernet virbr0-nic cd

ipv4.address

STEP 4: MODIFY IP & GATEWAY


# nmcli connection modify eth0

6
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

ipv4.address "172.24.7.10/24"
ipv4.gateway "172.24.254.254"

STEP 5: MODIFY DNS


# nmcli connection modify eth0
ipv4.dns "172.24.254.254"

STEP 6: Make IP STATIC


# nmcli connection modify eth0
ipv4.method manual

[OR] ipv4.addresses

STEP 4: MODIFY IP & GATEWAY


# nmcli connection modify eth0
ipv4.addresses "172.24.7.10/24"

STEP 5: MODIFY DNS


# nmcli connection modify eth0
ipv4.dns "172.24.254.254"

STEP 6: Make IP STATIC


# nmcli connection modify eth0
ipv4.method manual

ADD THE GATEWAY MANULLY TO NETWORK FILE

# vim /etc/sysconfig/network-scripts/ifcfg-eth0
GATEWAY=172.24.254.254

Save and Exit using ESC + :wq!

STEP 7: RESTART Services

# systemctl restart network.service

STEP 8: Check the details using

# ip addr show
OR
# nmcli device show

STEP 9: Open and Check the Corresponding Netowkr Configuration File

# cat /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE="Ethernet"
BOOTPROTO=none
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"

7
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="40a4c7ab-f873-47a4-9e37-9d4da9df68e2"
DEVICE="eno16777736"
ONBOOT="yes"
DNS1=172.24.0.254
IPADDR=172.24.7.10
PREFIX=24
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

STEP 10: Check the Host Name


# hostnamectl status

STEP 11: Set the Hostname


# hostnamectl set-hostname net7.example.com

STEP 12: RESTART Netowrk Services and Reboot the system

# systemctl restart network.service

# systemctl reboot

Check:
# hostnamectl status

# cat /etc/hostname

# ping 172.24.254.254

8
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 1 — [SELINUX ENFORCE]


Configure your systems that should be running in Enforcing.

# getenforce
# vim /etc/sysconfig/selinux
SELINUX=enforcing
# systemctl reboot
# getenforce

9
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 2 — [USERS/GROUP PERMISSION]


Create the following users, groups, & group members.

1. A group named sysusers.


2. A user andrew who belongs to sysusers as a secondary group
3. A user susan who also belongs to sysusers as a secondary group
4. A user brad who does not have access to an interactive shell on the system, and who is not a member of
sysusers.
5. andrew, susan, and brad should all have the password of password.

TASKS IN NUTSHELL
1. CREATE A GROUP called ‘sysusers’ using linux command:
# groupadd sysusers
Confirm the group is created from file /etc/group:
# cat /etc/group | grep “sysusers” /* Check Group */
2. CREATE AN USER called ‘andrew’ with ‘sysusers’ as SECONDARY GROUP linux command:
# useradd andrew –G sysusers
Confirm:
# id andrew /* Check Secondary group */
3. CREATE AN USER called ‘susan’ with ‘sysusers’ as SECONDARY GROUP linux command:
# useradd susan –G sysusers
Confirm:
# id susan /* Check Secondary group */
4. CREATE AN USER called ‘brad’ using useradd command with nologin access permission.
# useradd brad -s /sbin/nologin
Confirm:
# id brad /* Check Secondary group */
# cat /etc/passwd | | grep “brad” /* Check default shell */
5. Set password for user ‘andrew’, ‘susan’ and ‘brad’ as ‘password’.
# echo “password” | passwd --stdin andrew
# echo “password” | passwd --stdin susan
# echo “password” | passwd --stdin brad
Confirm:
# su – andrew
# su – susan
# su – brad

10
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

SIMILAR QUESTION
Create the following users, groups and group members.
1. User ‘natasha’, ‘hary’ and ‘sarah’ and Group ‘sysadmin’
2. The user ‘natasha’ who belongs to the ‘sysadmin’ group as a secondary group.
3. User ‘hary’ who also belongs to ‘sysadmin’ as a secondary group.
4. User ‘sarah’ who doesnot have access to interactive shell on the system and who is also member of
‘sysadmin’ group.
5. ‘natasha’, ‘hary’, and ‘sarah’ should have password of ‘postrole’

TASKS NUTSHELL
1. CREATE A GROUP called ‘sysadmin’ using linux command:
# groupadd sysadmin
Confirm the group is created from file /etc/group:
# cat /etc/group | grep “sysadmin” /* Check Group */
2. CREATE AN USER called ‘natasha’ with ‘sysadmin’ as SECONDARY GROUP linux command:
# useradd natasha –G sysadmin
Confirm:
# id natasha /* Check Secondary group */
3. CREATE AN USER called ‘hary’ with ‘sysadmin’ as SECONDARY GROUP linux command:
# useradd hary –G sysadmin
Confirm:
# id hary /* Check Secondary group */
4. CREATE AN USER called ‘sarah’ with ‘sysadmin’ as SECONDARY GROUP and has nologin shell access
linux command:
# useradd sarah –G sysadmin –s /sbin/nologin
Confirm:
# id sarah /* Check Secondary group */
# cat /etc/passwd | grep “sarah” /* Check default shell */
5. Set password for user ‘natasha’, ‘hary’ and ‘sarah’ as ‘postrole’.
# echo “postrole” | passwd --stdin natasha
# echo “postrole” | passwd --stdin hary
# echo “postrole” | passwd --stdin sarah
Confirm:
# su – natasha
# su – hary
# su – sarah

11
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 3 — [USERS/GROUP PERMISSION]


Create a collaborative directory /common/sysusers with the following characteristics:

1. Group ownership of /common/sysusers is sysusers


2. The directory should be readable, writable, and accessible to member of sysusers but not to
any other user.
3. Files created in /common/sysusers automatically have group ownership set to the sysusers
group.

TASKS NUTSHELL
1. CREATE A DIRECTORY called ‘/common/sysusers’ using linux command:
# mkdir –p /common/sysusers
Confirm:
# ll /common/sysusers /* Check Directory */
MODIFY THE GROUP OWNER of the directory ‘sysusers’ to ‘sysusers’
# chgrp sysusers /common/sysusers
Confirm:
# ll /common/sysusers /* Check Directory */
2. MODIFY THE GROUP EXECUTE
# chmod g+rws /common/sysusers /* To allow all group users */
# chmod o=--- /common/sysusers/ /* To Disallow all other users
OR (single command)
# chmod 2770 /common/sysusers
OR (single command)
# chmod 2070 /common/sysusers

Confirm:
# ll /common/sysusers /* Check Directory */
3. Create 2 file in the directory /common/sysusers, one using root user and another from a user
having access to the directory eg.: andrew
# whoami
root
# touch testfile1 /common/sysusers
Confirm:
# ll /common/sysusers/ /* Check File */
-rw-r--r--. 1 root sysusers 0 May 11 12:30 testfile

# su – andrew
# touch testfile2 /common/sysusers
Confirm:
# ll /common/sysusers/ /* Check File */
-rw-rw-r--. 1 andrew sysusers 0 May 11 12:31 testfile1

12
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

SIMILAR QUESTION
Create a collaborative directory /home/materials with the following characteristic.
1. Group ownership of /home/materials should be sysadmin group.
2. The directory should be RWX for members of sysadmin but not to any other user.
3. Files created in /home/materials automatically set to sysadmin group.

TASKS IN NUTSHELL
1. CREATE A DIRECTORY called ‘/home/materials’ using linux command:
# mkdir /home/materials
Confirm:
# ll /home/materials /* Check Directory */
MODIFY THE GROUP OWNER of the directory ‘sysusers’ to ‘sysusers’
# chgrp sysadmin /home/materials
Confirm:
# ll /home/materials /* Check Directory */
2. MODIFY THE GROUP EXECUTE
# chmod g+rws /home/materials
# chmod o=--- /home/materials
OR
# chmod 2770 /home/materials
OR
# chmod 2070 /home/materials
Confirm:
# ll /home/materials /* Check Directory */
We are building a collaborative directory so use SETGID bit on the group ownership of the directory to set
RWX to the members of the sysadmin group.
3. Create 2 file in the directory /common/sysusers, one using root user and another from a user
having access to the directory eg.: natasha
# whoami
root
# touch testfile1 /home/materials
Confirm:
# ll /home/materials /* Check File */
-rw-r--r--. 1 root sysusers 0 May 11 12:30 testfile

# su – natasha
# touch testfile2 /home/materials
Confirm:
# ll /home/materials /* Check File */
-rw-rw-r--. 1 andrew sysusers 0 May 11 12:31 testfile1

13
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 4 — [USERS/GROUP PERMISSION]


Copy the file /etc/fstab to /var/tmp. Configure the permissions of /var/tmp/fstab so that:

1. The file /var/tmp/fstab is owned by the root user.


2. The file /var/tmp/fstab is belongs to the group root.
3. The file /var/tmp/fstab should not be executable by anyone.
4. The user andrew is able to read and write /var/tmp/fstab.
5. The user susan can neither write nor read /var/tmp/fstab.
6. All other users have the ability to read /var/tmp/fstab

TASKS IN NUTSHELL
COPY the file /etc/fstab to /var/tmp using linux command using PRESERVE option:
# cp -p /etc/fstab /var/tmp/fstab
Confirm:
# ll /var/tmp/fstab /* Check File */
1. [INFO / PRESENT] Check if the file /var/tmp/fstab is owned by root
# ll /var/tmp/fstab /* Check File */
2. [INFO / PRESENT] Check if the file /var/tmp/fstab belogs to the group root
# ll /var/tmp/fstab /* Check File */
3. [INFO / PRESENT] Check if the file /var/tmp/fstab does not contain execute (x) permission set to other
(public) users
# ll /var/tmp/fstab /* Check File */
4. Set Read and Write permission on file /var/tmp/fstab for user ‘andrew’ using (ACL) SETFACL linux
command:
# setfacl -m u:andrew:rw- /var/tmp/fstab
OR
# setfacl -m user:andrew:rw- /var/tmp/fstab

Check:
# ll /var/tmp/fstab /* Check File */
# getfacl /var/tmp/fstab
# su – andrew
# cat /var/tmp/fstab /* should be able to read */
5. Set No Read and No Write permission on /var/tmp/fstab for user ‘susan’ using (ACL) SETFACL linux
command:
# setfacl -m u:susan:--- /var/tmp/fstab
OR
# setfacl -m user:susan:--- /var/tmp/fstab

Check:
# ll /var/tmp/fstab /* Check File */
# getfacl /var/tmp/fstab
# su – susan
# cat /var/tmp/fstab /* shouldn’t able to read */
6. [INFO / PRESENT] Check if the file /var/tmp/fstab has Read (r) permission set to other (public)
users.

14
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# ll /var/tmp/fstab /* Check File */


-rw-rw-r--+ 1 root root 465 May 20 2016 /var/tmp/fstab

SIMILAR QUESTION
Copy the file /etc/fstab to /var/tmp. Configure the permission of /var/tmp/fstab so that.
1. The file /var/tmp/fstab belongs to the group ‘root’
2. The file /var/tmp/fstab owned by user root.
3. The file /var/tmp/fstab should not be execute by anyone.
4. The user ‘natasha’ is able to read and write on /var/tmp/fstab file.
5. The user ‘hary’ neither write or read /var/tmp/fstab file.
6. All other users have the ability to read /var/tmp/fstab file.

TASKS IN NUTSHELL
COPY the file /etc/fstab to /var/tmp using linux command using PRESERVE option:
# cp -p /etc/fstab /var/tmp/fstab
Confirm:
# ll /var/tmp/fstab /* Check File */
1. [INFO] Check if the file /var/tmp/fstab is owned by root
# ll /var/tmp/fstab /* Check File */
2. [INFO] Check if the file /var/tmp/fstab belogs to the group root
# ll /var/tmp/fstab /* Check File */
3. [INFO] Check if the file /var/tmp/fstab does not contain execute (x) permission set to other (public)
users
# ll /var/tmp/fstab /* Check File */
4. Set Read and Write permission on file /var/tmp/fstab for user ‘andrew’ using (ACL) SETFACL linux
command:
# setfacl -m u:natasha:rw- /var/tmp/fstab
OR
# setfacl -m user:natasha:rw- /var/tmp/fstab

Check:
# ll /var/tmp/fstab /* Check File */
# getfacl /var/tmp/fstab
# su – natasha
# cat /var/tmp/fstab /* should be able to read */
5. Set No Read and No Write permission on /var/tmp/fstab for user ‘susan’ using (ACL) SETFACL linux
command:
# setfacl -m u:hary:--- /var/tmp/fstab
OR
# setfacl -m user:hary:--- /var/tmp/fstab

Check:
# ll /var/tmp/fstab /* Check File */

15
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# getfacl /var/tmp/fstab
# su – hary
# cat /var/tmp/fstab /* shouldn’t able to read */
6. [INFO / PRESENT] Check if the file /var/tmp/fstab has Read (r) permission set to other (public)
users.
# ll /var/tmp/fstab /* Check File */
-rw-rw-r--+ 1 root root 465 May 20 2016 /var/tmp/fstab

16
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 5 — [USERS/GROUP PERMISSION]


Create a user ‘jean’ having user identity as 4032 and his home directory should be in /india/redhat.

TASKS IN NUTSHELL
1. As we have to customise the user home directory ie. the user home directory should be pointed to
/india/redhat and not to default /home/jean, we have to first create a directory called
/india/redhat/jean using MKDIR.
# mkdir –p /india/redhat/jean

2. Use USERADD command to create the user with option –d to set and point to /india/redhat as
jean’s home directory.
# useradd jean -u 4032 -d /india/redhat/jean/
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

Check the file /etc/passwd to ensure that the user is created with UID 4032 and the user’s home
directory is pointed to /india/redhat/jean.
# cat /etc/passwd | grep “jean”
3. Copy all hidden files inside /etc/skel directory to /india/redhat using CP –R
command.
# cp -r /etc/skel/. /india/redhat/jean/
# ll -a /india/redhat/jean/
4. As the directory /india/redhat/jean was manually created, the owner will be root, the user jean
will not able to create any file inside his own home directory. So use change owner command using
CHOWN with –R to change the owner from root to jean. –R for recursive to change owner for not only
directory but also inside files.
# ll /india/redhat/
# chown -R jean:jean /india/redhat/jean

NOTE: -R for recursive all files and directories

Check:
# cat /etc/passwd
# su – jean
# pwd

17
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 6 — [using FIND FILE(S) & COPY]


Find the file which owned by user jean and copy the file into /findresult directory.

TASKS IN NUTSHELL
1. Create a directory /findresult:
# mkdir /findresult
2. Find all the file(s) which are owned by julia and copy those files to /findresult.
# find / -user jean -exec cp -avp {} /findresult/ \;

Check:
# cd /findresult
# ls -la

18
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 7 — [SEARCH STRING(S) & COPY]


Search the string brad in the /etc/passwd file and save the output in /root/grepoutput1.

ANSWER
# grep brad /etc/passwd >> /root/grepoutput1
# cat /root/grepoutput1

SIMILAR ANOTHER QUESTION


Search all the lines from /etc/passwd which having word ‘bash’ and store the output in the
/root/grepoutput2 file and arrange them in correct order.

ANSWER

# grep fish /usr/share/dict/words | sort –r >> /root/grepoutput2


# cat /root/grepoutput2

NOTE: r for reverse order

19
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 8 — [FILE/DIRECTORY COMPRESSION]


Create an archive file /root/local.tar.gz for /usr/local. It should be compressed by
gzip.

TASKS IN NUTSHELL
1. Check the directory size of /usr/local :
# du -sh /usr/local/
OR
# ls -lh /usr/local
2. Archive the directory /usr/local/
# tar cvfz /root/local.tar.gz /usr/local

NOTE:
c CREATE
v VERBOSE (Shows Msg)
f FILE
z To instrust to create file in .tar.gz format
Check:
# cd /root/
# ls -lh /local.tar.gz

SIMILAR ANOTHER QUESTION


Create a bzip2 compression of /etc directory. Name the compression file as etc.tar.bz2 and put
this file in /root directory.

TASKS IN NUTSHELL
1. Check the directory size of /usr/local :
# du -sh /etc
OR
# ls -lh /etc
2. Archive the directory /usr/local/
# tar cvfj /root/etc.tar.bz2 /root

NOTE:
c CREATE
v VERBOSE (Shows Msg)
f FILE
j To instrust to create file in .tar.gz format
Check:
# cd /root/
# ls -lh /etc.tar.bz2

gzip .gz = z
bzip2 .bz2 = j
x2 .x2 = J

20
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 9 — [CRON JOB]


The user andrew must configure a cron job that runs daily at 14:24 local time and executes /bin/echo Hello

TASKS IN NUTSHELL
1. Check the server time format is it in 24-hour format OR AM/PM format:

2. Switch user and add Cron job in /etc/echo:


# su – andrew

# which echo

# crontab -e
24 14 * * * /bin/echo Hello

3. LIST Cron Jobs from user login:


# crontab –l

4. Exit from the USER and go back to Root User


# su – root

5. RESTART Cron Service:


# systemctl restart crond.service

6. Check Cron STATUS:


# systemctl status crond.service

7. LIST Cron Jobs from root login:


# crontab –u andrew –l

21
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 10 — [REPOSITORY]


Create a Repository for your virtual machine.
The URI is http://classroom.example.com/content/rhel7.0/x86_64/dvd/

TASKS IN NUTSHELL
1. Create a repository in /etc/yum.repos.d/
# touch /etc/yum.repos.d/base.repo

2. Open the file ‘base.repo’ from /etc/yum.repos.d/


# vim /etc/yum.repos.d/base.repo

3. Enter the following in the repository:


[cms]
name=cms-repo
baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/
enabled=1
gpgcheck=0

4. Clean YUM CACHE Directory


# yum clean all

5. Check Repo List


# yum repolist

22
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 11 — [KERNEL UPDATE/UPGRADE]


Install the appropriate kernel UPDATE from
http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-
123.1.2.el7.x86_64.rpm.
The following criteria must also be met:
1. The updated kernel is the default kernel when the system is rebooted.
2. The original kernel remains available & bootable on the system.

TASKS IN NUTSHELL
1. Check current kernel version using:
# uname -r

2. Create a file to capture the current kernel (for reference) version using:
# uname –r >> kernel-ddmmyy

3. Open the browser and go to the link address (location) given and copy the kernel filename including the
full path using right click and select ‘copy link address’.

4. Take note whether we need to UPDATE or UPGRADE

5. Install the kernel update from the given link using:


/* UPDATE */
# rpm –ivh
http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/
kernel-3.10.0-123.1.2.el7.x86_64.rpm
OR
/* UPGRADE */
# rpm –uvh
http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/
kernel-3.10.0-123.1.2.el7.x86_64.rpm

6. Reboot the system


# reboot

7. Check and Confirm


# uname –r

8. Check if the older kernel details are there or not…should be there as we did UPDATE (not UPGRADE)

# find /etc/ -name grub.conf /* Find the file location */


# cat /etc/grub.conf

NOTE:
UPDATE will update the existing kernel to new one, also the original kernel remains available & bootable on
the system.
UPGRADE will upgrade the existing kernel to new one but the original kernel will not available during
botable.

23
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 12 — [TIME SYNC / NTP]


Configure your system so that it is an NTP client of classroom.example.com

TASKS IN NUTSHELL
1. ENSURE if ‘Automatic Date & Time’ is enabled in ‘Applications’ > ‘System Tools’ > ‘Settings’ > ‘Date &
Time’ and Check if the ‘Automatic Date & Time’ is Enabled.

2. Check the current system time:


# date

3. Check whether system is in SYNC with Check the current system time:
# timedatectl
Local time: Thu 2016-05-12 13:46:48 IST
Universal time: Thu 2016-05-12 08:16:48 UTC
RTC time: Thu 2016-05-12 08:17:45
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

4. ENSURE if ‘ntp’ is installed and if not Install ntp and then start the service :
# yum info ntp
# yum install ntp

5. ENABLE and START the NTPD service


# systemctl enable ntpd.service
# systemctl start ntpd.service
6. ENSURE if ‘system-config-date’ is installed and if not Install system-config-date:
# yum info system-config-date
# yum install system-config-date -y

7. Access system-config-date GUI Window


# system-config-date
- remove the all list of NTP server.
- Click on Add button ==> type ==> instructor.example.com ==> press
tab button ==> wait few minutes until it is finished ==> Then
click on ok button.

24
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

classroom.example.com

8. RESTART the NTPD service


# systemctl restart ntpd.service

8. RESTART the CHRONYD services


# systemctl restart chronyd.service

9. Check whether system is in SYNC with Check the current system time:
# timedatectl
Local time: Thu 2016-05-12 13:46:48 IST
Universal time: Thu 2016-05-12 08:16:48 UTC
RTC time: Thu 2016-05-12 08:17:45
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

25
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

OR
After ntp and system-config-date package installation using yum enabling and starting the ntp services, just
the add the following in the /etc/chrony.conf file

--------------- /etc/chrony.conf ---------------


# serverX classroom.example.com iburst

And then enable the chronyd services.


# systemctl restart chronyd.service

26
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 13 — [LDAP CONFIGURATION ON CLIENT]


Bind to the LDAP domain ‘dc=example,dc=com’ provided by classroom.example.com for user
authentication. Note the following:
- ldapuser7 should be able to log into your system, where 7 is your station number, but will not have a home
directory until you have completed the autofs requirement below.
- ldapuser7 have a password of “redhat”
- you will get your CA certificate at http://classroom.example.com/pub/example-ca-crt.

TASKS IN NUTSHELL

1. Install Packages
# yum install sssd authconfig-gtk krb5-workstation –y

USING NORMAL USING KERBEROS


2. Configuring LDAP USER in CLIENT MACHINE 2. Configuring LDAP USER in CLIENT MACHINE
[using GUI] [using GUI]

# authconfig-gtk # authconfig-gtk

UNDER Identify & Authentication UNDER Identify & Authentication


User Account Database: LDAP User Account Database: LDAP
LDAP Search Base DN: dc=example,dc=com LDAP Search Base DN: dc=example,dc=com
LDAP Server: classroom.example.com LDAP Server: classroom.example.com
Mark Tick on “Use TLS to encrypt connections” Mark Tick on “Use TLS to encrypt connections”
Click button ‘Download CA Certificate’ and enter the Click button ‘Download CA Certificate’ and enter the
CA Certificate full ftp path. CA Certificate full ftp path.
Authentication Method: LDAP Password Authentication Method: Kerberos Password
Enter Realm, KDCs and Admin Server.

UNDER Advanced Options TAB UNDER Advanced Options TAB


Password Hashing Algorithm: SHA512 Password Hashing Algorithm: SHA512
Mark Tick on “Create home directories on the first Mark Tick on “Create home directories on the first
login”. login”.

3. Home Directory of LDAP 3. Home Directory of LDAP


# getent passwd ldapuser7 # getent passwd ldapuser7

4. TEST / Check 4. TEST / Check


# su – ldapuser7 # ssh – ldapuser7

# touch filename # touch filename

27
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

1 1

28
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 14 — [LDAP AUTOFS]


Configure autofs to automount the home directories of LDAP users. Note the following:
- 172.24.8.x-nfs-exports /home/ to your system where x is your station number.
- ldapuser7 home directory is 172.25.254.254/home/rusers.
- ldapuser7 home directory should be automated local beneath /home as /home/rusers/ldapuser7.
- home directories must be writable by their users.
- while you are able to log in as any of the users ldapuser1 through ldapuser20, the only home directory is
accessible from your system is ldapuser7.

TASKS IN NUTSHELL
1. Install autofs package
# yum install autofs

2. ENABLE and START autofs


# systemctl enable autofs

# systemctl start autofs

3. Create a new file called ‘rusers.autofs’ and and modify an exiting files called ‘auto.misc’

# vim /etc/auto.master.d/rusers.autofs
/home/ /etc/auto.misc

# vim /etc/auto.misc
ldapuser7 -rw,sync,soft,intr
172.25.254.254/home/rusers/ldapuser7

4. RESTART autofs service


# systemctl restart autofs

5. Check
# su – ldapuser7

# touch filename

29
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

HARD DISK STRUCTURE FOR QUESTIONS# 15, 16, 17, 18, 19, 20 & 21

SCSI HDD#1 – sda SCSI HDD#2 – sdb

20GB 20GB

Primary Partitions
sda1 / 500M sda2 / 19G
sda2

/boot / SWAP
/boot
500M 17G SWAP
2G

LVM LVM

[root@server1 ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT


sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 19.5G 0 part
├─rhel-root 253:0 0 17.5G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk

30
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 15 — [Make and Mount Partition]


Create 1 GB ext4 file system on second disk persistent mounted at /archive.

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb
n
p
X --> sdbX
size
w
2. Make filesystem
# mkfs.fstype /dev/sdbX
NOTE: fstype = xfs / etx3 / etx4

3. Create Mount Point Directory


# mkdir /mount_directory

4. Mount Manually
# mount –t fstype /dev/sdbX /mount_directory

5. Mount permanently / persistently


# blkid /dev/sdbX
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /mount_directory fstype defaults 0 0

# mount –a
# reboot
6. Check
# df –hT
# lsblk

DETAILED STEPS
1. Check the disk structure using
# lsblk

# fdisk –l

# df –hT

2. Create a new partition of file system type ext4


# fdisk /dev/sdb

Command (m for help): n n = new partition

31
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended

Select (default p): p op = primary part.

Partition number (1-4, default 1): 1  sdb1

First sector (2048-41943039, default 2048): PRESS ENTER FOR


DEFAULT

Last sector, +sectors or +size{K,M,G} (2048-41943039, default


41943039): +1G

Command (m for help): p p = print

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 1048576 83 Linux

Command (m for help): w w = write/save

# partprobe

3. Make the partition file system as ext4

# mkfs.ext4 /dev/sdb1

4. Create Mount Point

# mkdir /archive

5. Mount MANUALLY

# mount -t ext4 /dev/sdb1 /archive/

CHECK & CONFIRM


# df -hT

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/rhel-root xfs 18G 7.3G 11G 42% /
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 913M 144K 913M 1% /dev/shm
tmpfs tmpfs 913M 9.0M 904M 1% /run
tmpfs tmpfs 913M 0 913M 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 158M 340M 32% /boot
tmpfs tmpfs 183M 12K 183M 1% /run/user/0
/dev/sr0 iso9660 3.8G 3.8G 0 100
/run/media/root/RHEL-7.2 Server.x86_64
/dev/sdb1 ext4 976M 2.6M 907M 1% /archive

6. Change the /etc/fstab file to mount PERSISTENTLY / PERMANENT

Get the partition UUID using:

32
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# blkid /dev/sdb1
/dev/sdb1: UUID="ac49e62e-e21c-46e3-95db-7e0a764baf28" TYPE="ext4"

Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:

# vim /etc/fstab

UUID=ac49e62e-e21c-46e3-95db-7e0a764baf28 /archive ext4 defaults 0 0


(save and exit the file using ESC + :wq!)

7. Mount All and Reboot

# mount –a

# reboot

8. FINACL CHECKING

# df –hT

# lsblk

# fdisk -l

33
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 16 — [SWAP]


Your SERVER HOST WILL HAVE 512MiB of swap space running on its second disk.

TASKS IN NUTSHELL
1. Check the SWAP structure and space
# free –m
# cat /proc/swaps

2. Create physical partitions


# fdisk /dev/sdb
n
p
X --> sdbX
size

t
82
w
3. Make SWAP
# mkswap /dev/sdbX
UUID=AAAABBBBBCCCC

4. Make SWAP ON and Check


# swapon /dev/sdbX
# free -m

5. Mount SWAP persistently / permanently on reboot


# swapoff /dev/sdbX

# vim /etc/fstab
UUID=AAAABBBBBCCCC swap swap defaults 0 0

# mount –a

6. Check
# free –m
# cat /proc/swaps

DETAILED STEPS
1. Check the SWAP structure and space

# free -m

34
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

total used free shared buff/cache available


Mem: 1824 539 769 10 515 1093
Swap: 2047 0 2047

NOTE: Make note of the above SWAP size ie. 2048MB

# cat /proc/swaps

Filename Type Size Used Priority


/dev/dm-1 partition 2097148 0 -1

2. Create a new swap partition


# fdisk /dev/sdb

Command (m for help): n

Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended

Select (default p): p p = primary

Partition number (2-4, default 2): 2  sdb2

First sector (2099200-41943039, default 2099200): PRESS ENTER


FOR DEFAULT

Last sector, +sectors or +size{K,M,G} (2099200-41943039,


default 41943039): +512M

Command (m for help): t t = type

Partition number (1,2, default 2): 2 i.e. sdb2

Hex code (type L to list all codes): 82

Command (m for help): p p = print

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 048576 83 Linux
/dev/sdb2 2099200 3147775 524288 82 Linux swap/Solaris

Command (m for help): w w = write/save

# partprobe

3. Make the /dev/sdb2 as swap and Make NOTE of the partition UUID

# mkswap /dev/sdb2
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=93ddaff5-b6aa-4454-9971-9888d180682e

35
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

4. Make swap ACTIVE

# swapon /dev/sdb2

CHECK & CONFIRM


# cat /proc/swaps

Filename Type Size Used Priority


/dev/dm-1 partition 2097148 0 -1
/dev/sdb2 partition 524284 0 -2

5. Change the /etc/fstab file to mount SWAP PERSISTENTLY / PERMANENT

Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:

# vim /etc/fstab

UUID=93ddaff5-b6aa-4454-9971-9888d180682e swap swap defaults 0 0


(save and exit the file using ESC + :wq!)

6. FINAL CHECKING

# free -m

total used free shared buff/cache available


Mem: 1824 516 793 10 514 1115
Swap: 2559 0 2559

Note: The total SWAP has increased from 2047 to 2559 = 512MB

# cat /proc/swaps

Filename Type Size Used Priority


/dev/sdb2 partition 524284 0 -1
/dev/dm-1 partition 2097148 0 -2

36
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 17 — [LVM Partition]


A 400MiB logical volume called storage in the volume group shazam, mount at /storage. The volume group
consists of two physical volumes each 256MiB in size.

Question Disection:
The VG Name = ‘shazam’.
The LV Name = ‘storage’.
The VG size = 512 MB [combining 2 physical volumnes of each 256MB ie. 256 M+256 M]
The LV size = 400 MB. [400MB LV from out of total 512MB VG]
LVM Mount Point = /storage.

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb
n
e
X --> sdbX
fullsize

n
Repeat steps
l for creating
X other logical
partitions
Size

t
Repeat steps
x for marking TYPE
8e for other logical
partitions as LVM
w

2. Create Physcial Volumne (PV)


# pvcreate /dev/sdbX /dev/sdbX
# pvdisplay OR # pvs

3. Create Volumne Group (VG)


# vgcreate vgname /dev/sdbX /dev/sdbX
# vgdisplay OR # vgs

4. Create Logical Volumne (LV)


# lvcreate –n lvname –L LVSize vgname
# lvdisplay OR # lvs

5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4

6. Create Mount Point Directory


# mkdir /mount_directory

37
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory

8. Mount permanently / persistently


# blkid /dev/vgname/lvname
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /mount_directory fstype defaults 0 0

# mount –a
# reboot

9. Check
# lvdisplay /* Check if the LV is ~ 400MB or not */
# vgdisplay /* Check if the VG is ~ 512MB [256+256] or not */
# df –hT
# lsblk

DETAILED STEPS
1. Pre-checks
# lsblk
# fdisk –l
# df –hT

2. Make the remaining free space as EXTENDED with 2 LOGICAL partitions and Assign those 2 Logical
Partitions as type LVM.

# fdisk /dev/sdb

MAKE EXTENDED PARTITION OF FREE SPACES


1st PARTITION

Command (m for help): n n = new partition

Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended

Select (default p): e e = extended part.

Partition number (3,4, default 3): 3

First sector (3147776-41943039, default 3147776): PRESS ENTER


for default

38
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Last sector, +sectors or +size{K,M,G} (3147776-41943039,


default 41943039): PRESS ENTER [default enter for making
remaining full size as extended partition]

MAKE TWO LOGICAL PARTITIONS


1st PARTITION

Command (m for help): n n = new partition

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)

Adding logical partition 5 --> sdb5

Select (default p): l l = logical part.

First sector (3149824-41943039, default 3149824): PRESS ENTER

Last sector, +sectors or +size{K,M,G} (3149824-41943039,


default 41943039): +256M

2nd PARTITION

Command (m for help): n n = new partition

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)

Select (default p): l l = logical part.

Adding logical partition 6 --> sdb6

First sector (3676160-41943039, default 3676160): PRESS ENTER

Last sector, +sectors or +size{K,M,G} (3676160-41943039,


default 41943039): +256M

Command (m for help): p P = print/display

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 3147775 524288 82 Linux swap / Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 83 Linux
/dev/sdb6 3676160 4200447 262144 83 Linux

MARK THE TWO PARTITIONS AS LVM


1st PARTITION

Command (m for help): t t = type

39
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Partition number (1-3,5,6, default 6): 5 --> sdb5

Hex code (type L to list all codes): 8e 8e = Linux LVM

2nd PARTITION

Command (m for help): t

Partition number (1-3,5,6, default 6): 6 --> sdb6

Hex code (type L to list all codes): 8e 8e = Linux LVM

PRINT / DISPLAY PARTITION

Command (m for help): p

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 3147775 524288 82 Linux swap/Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 8e Linux LVM
/dev/sdb6 3676160 4200447 262144 8e Linux LVM

Command (m for help): w w = write / save

# partprobe

2. Create LVM Physical Volume — PV.

# pvcreate /dev/sdb5 /dev/sdb6

# pvdisplay OR # pvs

3. Create LVM Volume Group of name ‘shazam’ — VG.

# vgcreate shazam /dev/sdb5 /dev/sdb6

# vgdisplay OR # vgs

4. Create LVM Logical Volumne of size 400 (from total 512MB) with name of ‘storage’ — LV.

# lvcreate –n storage –L 400M shazam

# lvdisplay

--- Logical volume ---


LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV UUID voqyub-H8er-vbCO-2EI4-zwT5-aIPr-FZ8Yd7
LV Size 400.00 MiB
Block device 253:2

40
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

5. Format LVM — mkfs

# mkfs.xfs /dev/shazam/storage

6. Create Mount Point

# mkdir /storage

7. Mount MANUALLY

# mount -t xfs /dev/shazam/storage /storage/

CHECK & CONFIRM


# df -hT

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/shazam-storage xfs 397M 21M 377M 6% /storage

8. Change the /etc/fstab file to mount PERSISTENTLY / PERMANENT

Get the partition UUID using:

# blkid /dev/shazam/storage
/dev/shazam/storage: UUID="ad56d020-ee81-4352-9e7a-7dc321c8292b" TYPE="xfs"
Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:

# vim /etc/fstab

UUID= ad56d020-ee81-4352-9e7a-7dc321c8292b /storage xfs defaults 0 0


(save and exit the file using ESC + :wq!)

9. Mount All and Reboot

# mount –a

# reboot

8. FINACL CHECKING

# lvdisplay /* Check if the LV is ~ 400MB or not */

# vgdisplay /* Check if the VG is ~ 512MB or not */

# df –hT

# lsblk

# fdisk -l

41
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 18 — [EXTEND LV & VG by adding new partition]


Resize logical volume 700MB total called storage in the volume group shazam, mounted at /storage.
Resizing done while the file system is still mounted and in-use. The volume group extended to include an
additional physical volumne of 512MB giving a total volume group of 1GB.

Question Disection:
The VG Name = ‘shazam’.
the LV Name = ‘storage’.
The LV size = 400 MB.
The VG size = 512 MB
LVM Mount Point = /storage.

+ Existing LV of 400MB should be extended upto 700MB, so additional 300MB needs to added to LV. And LV
and VG should be extended by adding a new partion of 512M
+ Existing VG of 512MB should be extended upto 1G by adding additional physical volume (PV) of 512MB.

TASKS IN NUTSHELL
1. Check
# lvdisplay /* Take note of the LV size which should increased later to 700M total */
# vgdisplay /* Take note of existing VG size which also increased later to existing + 512M
# df -hT

2. Create A physical partitions to add to the VGGROUP


# fdisk /dev/sdb

n
l
X --> sdbX
Size

t
X
8e --> sdbX
w

3. Create Physcial Volumne (PV)


# pvcreate /dev/sdbX
# pvdisplay OR # pvs

4. Create Volumne Group (VG)


# vgextend vgname /dev/sdbX
# vgdisplay OR # vgs

5. Create Logical Volumne (LV)


# lvextend –L +LVSize /dev/vgname/lvname
# lvdisplay OR # lvs

42
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

6. Make filesystem
-------- if the filesystem is XFS -------
# fstype_growfs /dev/vgname/lvname

-------- if the filesystem is EXT3/EXT4 -------


# resize2fs /dev/vgname/lvname

7. Checking
# lvdisplay
# vgdisplay
# df –hT

DETAILED STEPS
1. Note the existing size of VG and LV using
# lvdisplay
# vgdisplay
# df -hT

# lvdisplay
--- Logical volume ---
LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV Size 400.00 MiB ---> should be 700 MiB

# vgdisplay
--- Volume group ---

VG Name shazam
Format lvm2
VG Size 504.00 MiB ---> should be 1 GiB

# df -hT
/dev/mapper/shazam-storage xfs 797M 33M 765M 5% /storage

2. Create a new partition of size 512MB to be added to the existing VG and Mark that as LVM

# fdisk /dev/sdb

Command (m for help): n n = new

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)

Select (default p): l l = logical partition

Adding logical partition 7 --> sdb7

43
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

First sector (4202496-41943039, default 4202496): PRESS ENTER

Last sector, +sectors or +size{K,M,G} (4202496-41943039,


default 41943039): +512M

MARK THE PARTITION AS LVM

Command (m for help): t

Partition number (1-3,5-7, default 7): 7

Hex code (type L to list all codes): 8e 8e = Linux LVM

PRINT / DISPLAY PARTITION

Command (m for help): p

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 3147775 524288 82 Linux swap/ Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 8e Linux LVM
/dev/sdb6 3676160 4200447 262144 8e Linux LVM
/dev/sdb7 4202496 5251071 524288 8e Linux LVM

Command (m for help): w w = write / save

# partprobe

3. Create Physical Volume — PV.

# pvcreate /dev/sdb7

4. Extend Volume Group ‘shazam’ to 1G — VG.

# vgextend shazam /dev/sdb7

CHECKING:
# vgdisplay

--- Volume group ---


VG Name shazam
VG Size 1012.00 MiB

5. Extend Logical Volume ‘storage’ by 300M to make 700MB — LV.

# lvextend –L +300M /dev/shazam/storage

CHECKING:
# lvdisplay

--- Logical volume ---


LV Path /dev/shazam/storage

44
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

LV Name storage
VG Name shazam
LV Size 700.00 MiB
Block device 253:2

6. Format the file system

Check and Note the filesystem:

# df –hT

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/shazam-storage xfs 397M 21M 377M 6% /storage

Because the file format us XFS, we are using xfs_growfs...


# xfs_growfs /dev/shazam/storage

NOTE:
Else if the file format would have been ext3/4, then the command
would have been:
# resize2fs /dev/shazam/storage

7. FINACL CHECKING

# lvdisplay /* to check the lv size */

--- Logical volume ---


LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV Size 700.00 MiB --> Increased

# vgdisplay /* to check the vg size */

--- Volume group ---


VG Name shazam
VG Size 1012.00 MiB --> Increased

# df -hT

45
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 19 — [EXTEND LV from Free Space of VG]


Resize logical volume 800MB total called storage in the volume group shazam, mounted at /storage.
Resizing done while the file system is still mounted and in-use.

Question Disection:
The VG Name = ‘shazam’.
the LV Name = ‘storage’.
The LV size = 800 MB.
The VG size = 1012 MB
LVM Mount Point = /storage.

+ Existing LV of 700MB should be extended upto 800MB, so additional 100MB needs to added to LV. We
have 100MB spare space in VG which we can use (1012 – 700 = 300M FREE in VG)

TASKS IN NUTSHELL
1. Check
# lvdisplay
# vgdisplay
# df -hT

2. Unmount the partition


# umount /dev/vgname/lvname
The above step is striked-out because not required as the question itself says the resizing should be done
while the partition is mounted, else required.

3. Extend Logical Volume (LV)


# lvextend –L +LVSize /dev/vgname/lvname
# lvdisplay OR # lvs

4. Make filesystem
-------- if the filesystem is XFS -------
# fstype_growfs /dev/vgname/lvname

-------- if the filesystem is EXT3/4 -------


# resize2fs /dev/vgname/lvname

5. Checking
# df –hT
# lvdisplay
# vgdisplay

DETAILED STEPS
1. Note the existing size of VG and LV using
# lvdisplay

46
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# vgdisplay
# df -hT

# lvdisplay
--- Logical volume ---
LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV Size 700.00 MiB ---> should be 800 MiB

# vgdisplay
--- Volume group ---

VG Name shazam
VG Size 1012.00 MiB

# df -hT
/dev/mapper/shazam-storage xfs 797M 33M 765M 5% /storage

2. Unmount the partition


# umount /dev/vgname/lvname
The above step is striked-out because not required as the question itself says the resizing should be done
while the partition is mounted, else required

3. Extend Logical Volume ‘storage’ by 300M to make 700MB — LV.

# lvextend –L +100M /dev/shazam/storage

CHECKING:
# lvdisplay

--- Logical volume ---


LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV Size 700.00 MiB
Block device 253:2

4. Format the file system

Check and Note the filesystem:

# df –hT

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/shazam-storage xfs 397M 21M 377M 6% /storage

47
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

As the file format is XFS: use xfs_growfs else if the format would
have been ext3/4, then we we would have been used resize2fs.
# xfs_growfs /dev/shazam/storage

5. FINAL CHECKING

# lvdisplay /* to check the vg size */


# vgdisplay /* to check the lv size */

--- Logical volume ---


LV Path /dev/shazam/storage
LV Name storage
VG Name shazam
LV Size 800.00 MiB --> Increased

--- Volume group ---

VG Name shazam
VG Size 1012.00 MiB

# df -hT

48
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 20 — [LVM Partition]


Create a logical volume called homeval, the logical volume size is 550MiB with ext4 file system. Logical
volume is mounted at the /mnt/homeval. The volume group name is vg_home, and consists of two physical
volumes each of 300M in size.

Question Disection:
The VG Name = ‘vg_home’.
the LV Name = ‘homeval’.
The LV size = 550 MB.
The VG size = 600 MB [combining 2 physical volumnes of each 300MB]
LVM Mount Point = /mnt/homeval.

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb
n
e
X --> sdbX
fullsize

n
Repeat steps
l for creating
X other logical
partitions
Size

t
Repeat steps
x for marking TYPE
8e for other logical
partitions as LVM
W

2. Create Physcial Volumne (PV)


# pvcreate /dev/sdbX /dev/sdbX
# pvdisplay OR # pvs

3. Create Volumne Group (VG)


# vgcreate vgname /dev/sdbX /dev/sdbX
# vgdisplay OR # vgs

4. Create Logical Volumne (LV)


# lvcreate –n lvname –L LVSize vgname
# lvdisplay OR # lvs

5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4

49
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

6. Create Mount Point Directory


# mkdir /mount_directory

7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory

8. Mount permanently / persistently


# blkid /dev/vgname/lvname
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /mount_directory fstype defaults 0 0

# mount –a
# reboot

9. Check
# lvdisplay /* Check if the LV is ~ 550MB or not */
# vgdisplay /* Check if the VG is ~ 600MB [300+300] or not */
# df –hT
# lsblk

DETAILED STEPS
1. Pre-checks
# lsblk
# fdisk –l
# df –hT

2. Make the remaining free space as EXTENDED with 2 LOGICAL partitions and Assign those 2 Logical
Partitions as type LVM.

# fdisk /dev/sdb

MAKE TWO LOGICAL PARTITIONS


1st PARTITION

Command (m for help): n n = new partition

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 8)

Adding logical partition 8 --> sdb8

Select (default p): l l = logical part.

First sector (5253120-41943039, default 5253120): PRESS ENTER

50
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Last sector, +sectors or +size{K,M,G} (5253120-41943039,


default 41943039): +300M

2nd PARTITION

Command (m for help): n n = new partition

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)

Select (default p): l l = logical part.

Adding logical partition 9 --> sdb9

First sector (5869568-41943039, default 5869568): PRESS ENTER

Last sector, +sectors or +size{K,M,G} (5869568-41943039,


default 41943039): +300M

Command (m for help): p P = print/display

Device Boot Start End Blocks Id System


/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 3147775 524288 82 Linux swap/Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 8e Linux LVM
/dev/sdb6 3676160 4200447 262144 8e Linux LVM
/dev/sdb7 4202496 5251071 524288 8e Linux LVM
/dev/sdb8 5253120 5867519 307200 83 Linux
/dev/sdb9 5869568 6483967 307200 83 Linux

MARK THE TWO PARTITIONS AS LVM


1st PARTITION

Command (m for help): t t = type


Partition number (1-3,5-9, default 9): 8 --> sdb8

Hex code (type L to list all codes): 8e 8e = Linux LVM

2nd PARTITION

Command (m for help): t

Partition number (1-3,5-9, default 9): 9 --> sdb9

Hex code (type L to list all codes): 8e 8e = Linux LVM

PRINT / DISPLAY PARTITION

Command (m for help): p

Device Boot Start End Blocks Id System


51
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

/dev/sdb1 2048 2099199 1048576 83 Linux


/dev/sdb2 2099200 3147775 524288 82 Linux swap/Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 8e Linux LVM
/dev/sdb6 3676160 4200447 262144 8e Linux LVM
/dev/sdb7 4202496 5251071 524288 8e Linux LVM
/dev/sdb8 5253120 5867519 307200 8e Linux LVM
/dev/sdb9 5869568 6483967 307200 8e Linux LVM

Command (m for help): w w = write / save

# partprobe

2. Create LVM Physical Volume — PV.

# pvcreate /dev/sdb8 /dev/sdb9

# pvdisplay OR # pvs

3. Create LVM Volume Group of name ‘vg_home’ — VG.

# vgcreate vg_home /dev/sdb8 /dev/sdb9

# vgdisplay OR # vgs

4. Create LVM Logical Volume of size 550 with name of ‘homeval’ — LV.

# lvcreate –n homeval –L 550M vg_home

# lvdisplay

--- Logical volume ---


LV Path /dev/vg_home/homeval
LV Name homeval
VG Name vg_home
LV Size 552.00 MiB
Block device 253:3

5. Format LVM — mkfs

# mkfs.ext4 /dev/vg_home/homeval

6. Create Mount Point

# mkdir /mnt/homeval

7. Mount MANUALLY

# mount -t ext4 /dev/vg_home/homeval /mnt/homeval/

CHECK & CONFIRM


# df -hT

52
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/vg_home-homeval ext4 528M 452K 500M 1% /mnt/homeval

8. Change the /etc/fstab file to mount PERSISTENTLY / PERMANENT

Get the partition UUID using:

# blkid /dev/vg_home/homeval
/dev/shazam/storage: UUID="740e0d88-e37a-4076-94e7-8f63e525bca4" TYPE="ext3"
Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:

# vim /etc/fstab

UUID=740e0d88-e37a-4076-94e7-8f63e525bca4 /mnt/homeval ext3 defaults 0 0


(save and exit the file using ESC + :wq!)

9. Mount All and Reboot

# mount –a

# reboot

8. FINACL CHECKING

# lvdisplay /* Check of the Lv is ~ 550M */

# vgdisplay /* Check if the vg is ~ 600M */

# df –hT

# lsblk

# fdisk -l

53
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 21 — [REDUCE LVM Partition]


Resize your logical volume homeval upto 250MB without loosing any data. (After resizing lvm will be
accepted between the range of 245MB to 255MB.

Question Disection:

FIRST TAKE NOTE, whether the question is asking REDUCE TO or REDUCE BY.
REDUCE TO is the final size we get after shrink while
REDUCE BY is the size to reduce from the LVM.

UPTO is same as REDUCE TO.

The VG Name = ‘vg_home’.


the LV Name = ‘homeval’.
LVM Mount Point = /mnt/homeval.

- Existing LV should be reduced by 250MB (from existing 552MB).

TASKS IN NUTSHELL
1. Check
# lvdisplay
# vgdisplay
# df -hT

2. Unmount the partition to resize


# umount /dev/vgname/lvname
OR
# umount /mount_directory

3. Resize LVM
-------- if the filesystem is XFS -------
# lvreduce –L size_to_reduce /dev/vgname/lvname /* REDUCE TO SIZE
[OR] lvreduce –L -size_to_reduce /dev/vgname/lvname /* REDUCE BY SIZE

-------- if the filesystem is EXT3/4 -------

# e2fsck –f /dev/vgname/lvname
# resize2fs /dev/vgname/lvname size_to_reduce
# lvreduce –L size_to_reduce /dev/vgname/lvname /* REDUCE TO SIZE
[OR] lvreduce –L -size_to_reduce /dev/vgname/lvname /* REDUCE BY SIZE
# resize2fs /dev/vgname/lvname

4. Mount
# mount -a

5. Checking

54
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# lvdisplay
# vgdisplay
# df –hT

DETAILED STEPS
1. Note the existing size of VG and LV using
# lvdisplay
# vgdisplay
# df -hT

# lvdisplay
--- Logical volume ---
LV Path /dev/vg_home/homeval
LV Name homeval
VG Name vg_home
LV Size 552.00 MiB --> 300M (552 – 250)

# vgdisplay
--- Volume group ---
VG Name vg_home
VG Size 592.00 MiB

# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_home-homeval ext3 528M 452K 500M 1% /mnt/homeval

2. Unmount the partition

# umount /mnt/homeval
OR
# umount /dev/vg_home/homeval

3. Resize LVM

If the file format type is XFS


# lvreduce –L 250M /dev/vg_home/homeval

If the file format type is EXT3/4


# e2fsck –f /dev/vg_home/homeval
# resize2fs /dev/vg_home/homeval 250M
# lvreduce –L 250M /dev/vg_home/homeval
# resize2fs /dev/vg_home/homeval

4. Mount

# mount –a

5. FINAL CHECKING

55
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# lvdisplay /* to check the lv size */

# vgdisplay /* to check the vg size */

# df -hT

# lvdisplay
--- Logical volume ---

LV Path /dev/vg_home/homeval
LV Name homeval
VG Name vg_home
LV Size 252.00 MiB
- currently set to 8192
Block device 253:3

# vgdisplay
--- Volume group ---
VG Name vg_home
VG Size 592.00 MiB

56
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

EXAM PRACTICE 22 — [LVM with CUSTOMIZED VG PHYSICAL EXTENT/PE]


Create a volumne group name as oraclevg which is having physical extent size of 8MiB. Create a logical
volume red_lvl of 100 extents assign ext (ext3/4) filesystem for red_lvl. red_lvl should be available
permanently on /mnt/data directory.

Question Disection:
The VG Name = ‘oraclevg’ of size > 8 x 100 eg. 1G and VG PE (Physical Extent) should be 8M
the LV Name = ‘red_lvl’ should be 8 x 100 = 800M
LVM Mount Point = /mnt/data.

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb

n
l
X
Size 8 X 100 = 800mb, so required size should be > 800MB

t
x
8e
W

2. Create Physcial Volumne (PV)


# pvcreate /dev/sdbX
# pvdisplay OR # pvs

3. Create Volumne Group (VG)


# vgcreate –s 8M vgname /dev/sdbX
# vgdisplay OR # vgs

4. Create Logical Volumne (LV)


# lvcreate –n lvname –L 800M vgname
OR
# lvcreate –n lv_name –l 100 vgname

5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4

6. Create Mount Point Directory


# mkdir /mount_directory

7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory

57
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

8. Mount permanently / persistently


# blkid /dev/vgname/lvname
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /mount_directory fstype defaults 0 0

# mount –a
# reboot

9. Check
# lvdisplay /* Check the LV size which should be 8 x 100 = 800M */
# vgdisplay /* Check the VG size which should be the partition size ie 1G AND its PE
should be 8M */
# df –hT
# lsblk

DETAILED STEPS
1. Create a partition of type LVM
# fdisk /dev/sdb

Command (m for help): n n = New Partition

Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)

Select (default p): l l = Logical Part.

Adding logical partition 10 ---> sdb10

First sector (6486016-41943039, default 6486016): PRESS ENTER

Last sector, +sectors or +size{K,M,G} (6486016-41943039, default


41943039): +1G As we need to extent the existing 8M to 100 times
ie. 800MB, we need to have partition of more than 800MB,
so 1G.

Command (m for help): t t = type

Partition number (1-3,5-10, default 10): 10 ie. sdb10

Hex code (type L to list all codes): 8e 8e = Type LVM

Command (m for help): p p = print/display

Device Boot Start End Blocks Id System

58
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

/dev/sdb1 2048 2099199 1048576 83 Linux


/dev/sdb2 2099200 3147775 524288 82 Linux swap / Solaris
/dev/sdb3 3147776 41943039 19397632 5 Extended
/dev/sdb5 3149824 3674111 262144 8e Linux LVM
/dev/sdb6 3676160 4200447 262144 8e Linux LVM
/dev/sdb7 4202496 5251071 524288 8e Linux LVM
/dev/sdb8 5253120 867519 307200 8e Linux LVM
/dev/sdb9 5869568 6483967 307200 8e Linux LVM
/dev/sdb10 6486016 8583167 1048576 8e Linux LVM

Command (m for help): w w = write/save

# partprobe

2. Create LVM Physical Volume — PV.

# pv /dev/sdb10

# pvdisplay OR # pvs

3. Create LVM Volume Group of name ‘oraclevg’ — VG.

# vgcreate –s 8M oraclevg /dev/sdb10

# vgdisplay OR # vgs

4. Create LVM Logical Volume of size 800M with name of ‘red_lvl’ — LV.

# lvcreate –n red_lvl –L 800M oraclevg /* for exact size */


OR
# lvcreate –n red_lvl -l 100 oraclevg /* for auto
multiplication size */

5. Format Fielsystem

# mkfs.ext3 /dev/oraclevg/red_lvl

6. Create Mount Point

# mkdir /mnt/data

7. Mount MANUALLY

# mount -t ext3 /dev/oraclevg/red_lvl /mnt/data/

CHECK & CONFIRM


# df -hT

Filesystem Type Size Used Avail Use% Mounted on


/dev/mapper/oraclevg-red_lvl ext3 772M 828K 731M 1% /mnt/data

59
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

8. Change the /etc/fstab file to mount PERSISTENTLY / PERMANENT

Get the partition UUID using:

# blkid /dev/oraclevg/red_lvl
/dev/shazam/storage: UUID="1def00ce-0a82-4d48-a374-cf0a7be74c7d" TYPE="ext3"
Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:

# vim /etc/fstab

UUID=1def00ce-0a82-4d48-a374-cf0a7be74c7d /mnt/data ext3 defaults 0 0


(save and exit the file using ESC + :wq!)

9. Mount All and Reboot

# mount –a

# reboot

8. FINACL CHECKING

# lvdisplay /* Check the LV size which should be 8 x 100 = 800M */

# vgdisplay /* Check the VG size which should be the partition size ie 1G AND its PE
should be 8M */
# df –hT

# lsblk

# fdisk -l

60
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

OTHER SIMILAR QUESTIONS


1. Physical partition,
- Create a new 100MB physical partition mounted under /Exam with ext4 filesystem.
(Note: because partition sizes are seldom exactly what is specified when they are created, any thing
within the range if 70 to 120MB is acceptable)

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb
n
p
1 --> sdb1
+100M
w
2. Make filesystem
# mkfs.ext4 /dev/sdb1

3. Create Mount Point Directory


# mkdir /Exam

4. Mount Manually
# mount –t ext4 /dev/sdb1 /Exam

5. Mount permanently / persistently


# blkid /dev/sdb1
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /Exam ext4 defaults 0 0

# mount –a
# reboot
6. Check
# df –hT
# lsblk

61
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

2. Swap Parition.
- Create a new 150MB swap partition filesystem.
(Note: because partition sizes are seldom exactly what is specified when they are created, any thing
within the range if 130 to 170MB is acceptable)

TASKS IN NUTSHELL
1. Check the SWAP structure and space
# free -m

2. Create physical partitions


# fdisk /dev/sdb
n
p
2 --> sdb2
+150M

t
82
w
3. Make SWAP
# mkswap /dev/sdb2
UUID=AAAABBBBBCCCC

4. Make SWAP ON and Check


# swapon /dev/sdb2
# free -m

5. Mount SWAP persistently / permanently on reboot


# swapoff /dev/sdb2

# vim /etc/fstab
UUID=AAAABBBBBCCCC swap swap defaults 0 0

# mount –a

6. Check
# free –m
# cat /proc/swaps

62
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

3. Resize LVM
- Resize the logical volume lvtest and its filesystem to 400MB.
Make sure that the filesystem contents remain intact.
(Note: because partition sizes are seldom exactly what is specified when they are created, any thing
within the range if 370 to 430MB is acceptable)

TASKS IN NUTSHELL
1. Create a logical partitions
# fdisk /dev/sdb

n
l
5 --> sdb5
+600M Anythin more than 400MB

T
5 --> sdbX
8e
W

3. Create Physcial Volumne (PV)


# pvcreate /dev/sdb5
# pvdisplay OR # pvs

4. Create Volumne Group (VG)


# vgextend vgtest /dev/sdb5
# vgdisplay OR # vgs

5. Create Logical Volumne (LV)


# lvcreate –n lvtest –L 600M vgtest
# lvdisplay OR # lvs

6. Make filesystem
# mkfs.ext4 /dev/vgtest/lvtest

7. Create Mount Point Directory


# mkdir /mntsdb5

7. Mount Manually
# mount –t ext4 /dev/vgtest/lvtest /mntsdb5

8. Mount permanently / persistently


# blkid /dev/vgtest/lvtest
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /mntsdb5 ext4 defaults 0 0

# mount –a

63
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

9. Unmount the partition to resize


# umount /dev/vgtest/lvtest
OR
# umount /mntsdb5

10. Resize LVM

# e2fsck –f /dev/vgtest/lvtest
# resize2fs /dev/vgtest/lvtest 400M
# lvreduce –L 400M /dev/vgtest/lvtest /* REDUCE TO SIZE
[OR] # lvreduce –L -196M /dev/vgtest/lvtest /* REDUCE BY SIZE
# resize2fs /dev/vgtest/lvtest

11. Mount
# mount -a

12. Checking
# lvdisplay

# vgdisplay

# df –hT

64
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

4. Creating logical volume.


- Create a New Physical Volume
- Create a New Volume Group in the name of vg0, vgextent is 16MB
- Create a New Logical Volumne in the Name of lv1 with the size of 50 extends and filesystem must vfat
then mount it under /lvm

TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb

n
l
7 --> sdb7
+1G 16 X 50 = 800mb, so required size should be > 800MB

T
7 --> sdb7
8e
W

2. Create Physcial Volumne (PV)


# pvcreate /dev/sdb7
# pvdisplay OR # pvs

3. Create Volumne Group (VG)


# vgcreate –s 16M vg0 /dev/sdb7
# vgdisplay OR # vgs

4. Create Logical Volumne (LV)


# lvcreate –n lv1 –L 800M vg0
OR
# lvcreate –n lv1 –l 50 vg0

5. Make filesystem
# mkfs.vfat /dev/vg0/lv1

6. Create Mount Point Directory


# mkdir /lvl

7. Mount Manually
# mount –t vfat /dev/vg0/lv1 /lvl

8. Mount permanently / persistently


# blkid /dev/vg0/lv1
UUID=AAAABBBBCCCC

# vim /etc/fstab
UUID=AAAABBBBCCCC /lvl vfat defaults 0 0

65
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

# mount –a
# reboot

9. Check
# lvdisplay /* Check the LV size which should be 8 x 100 = 800M */

# vgdisplay /* Check the VG size which should be the partition size ie 1G AND its PE
should be 16M */
# df –hT
# lsblk

66
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

TIPS & TRICKS

How to repair /etc/fstab file?


STEP 1: Restart the Server
STEP 2: In the OS selection screen,

SELECT the ‘Red Hat Enterprise Linux Server (3.10.0-327.e17.x86_64) 7.2 (Majpo)’ and then PRESS ‘e’.

NOTE: The screen stays for only 4 sec, so in order to pause in that screen , you should press UP and DOWN
arrow before it changes the screen. To make the mouse active on the screen and PAUSE the screen, click
CTRL + G or CTRL + ALT and then Click anywhere on the screen.

STEP 3: On the following screen…. Press DOWN arrow till you find line starting with with word “linux16 ……”,
go to end of that line [PRESS END Key] and give SPACE and type systemd.unit=emergency.target
after UTF-8 word and then press CTRL + X

STEP 4: On switch_root:/# prompt, give the following commands to mount the system

# mount

# mount –oremount,rw /

# mount

# vi /etc/fstab /* DO THE NECESSARY RECTIFICATIONS */

# mount –a

# reboot

[SEE THE BELOW SNAPSHOTS FOR BETTER UNDERSTANDING]

67
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER

68

Das könnte Ihnen auch gefallen