Beruflich Dokumente
Kultur Dokumente
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
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
STEP 6: Type the following command to create a new hidden file called .autorelabel
3
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
NOTE:
After successful login, give the following command to switch to graphical mode (permanent):
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
NOTE:
eno16777736 : Primary Ethernet connection
5
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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:
GENERAL.CONNECTION: --
Then first you have ADD the connection using using below command:
ipv4.address
6
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
ipv4.address "172.24.7.10/24"
ipv4.gateway "172.24.254.254"
[OR] ipv4.addresses
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
GATEWAY=172.24.254.254
# ip addr show
OR
# nmcli device show
# 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
# systemctl reboot
Check:
# hostnamectl status
# cat /etc/hostname
# ping 172.24.254.254
8
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# getenforce
# vim /etc/sysconfig/selinux
SELINUX=enforcing
# systemctl reboot
# getenforce
9
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
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
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
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
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
Check:
# cat /etc/passwd
# su – jean
# pwd
17
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
ANSWER
# grep brad /etc/passwd >> /root/grepoutput1
# cat /root/grepoutput1
ANSWER
19
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
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
TASKS IN NUTSHELL
1. Check the server time format is it in 24-hour format OR AM/PM format:
# which echo
# crontab -e
24 14 * * * /bin/echo Hello
21
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
TASKS IN NUTSHELL
1. Create a repository in /etc/yum.repos.d/
# touch /etc/yum.repos.d/base.repo
22
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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’.
8. Check if the older kernel details are there or not…should be there as we did UPDATE (not UPGRADE)
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
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.
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
24
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
classroom.example.com
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
26
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
TASKS IN NUTSHELL
1. Install Packages
# yum install sssd authconfig-gtk krb5-workstation –y
# authconfig-gtk # authconfig-gtk
27
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
1 1
28
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
TASKS IN NUTSHELL
1. Install autofs package
# yum install 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
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
20GB 20GB
Primary Partitions
sda1 / 500M sda2 / 19G
sda2
/boot / SWAP
/boot
500M 17G SWAP
2G
LVM LVM
30
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
4. Mount Manually
# mount –t fstype /dev/sdbX /mount_directory
# 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
31
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
# partprobe
# mkfs.ext4 /dev/sdb1
# mkdir /archive
5. Mount MANUALLY
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
# mount –a
# reboot
8. FINACL CHECKING
# df –hT
# lsblk
# fdisk -l
33
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
TASKS IN NUTSHELL
1. Check the SWAP structure and space
# free –m
# cat /proc/swaps
t
82
w
3. Make SWAP
# mkswap /dev/sdbX
UUID=AAAABBBBBCCCC
# 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
# cat /proc/swaps
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
# 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
# swapon /dev/sdb2
Enter (INSERT) the UUID in the /etc/fstab file for persistent/permanent mount:
# vim /etc/fstab
6. FINAL CHECKING
# free -m
Note: The total SWAP has increased from 2047 to 2559 = 512MB
# cat /proc/swaps
36
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4
37
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory
# 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
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
38
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
2nd PARTITION
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
39
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
2nd PARTITION
# partprobe
# pvdisplay OR # pvs
# vgdisplay OR # vgs
4. Create LVM Logical Volumne of size 400 (from total 512MB) with name of ‘storage’ — LV.
# lvdisplay
40
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# mkfs.xfs /dev/shazam/storage
# mkdir /storage
7. Mount MANUALLY
# 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
# mount –a
# reboot
8. FINACL CHECKING
# df –hT
# lsblk
# fdisk -l
41
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
n
l
X --> sdbX
Size
t
X
8e --> sdbX
w
42
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
6. Make filesystem
-------- if the filesystem is XFS -------
# fstype_growfs /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
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
43
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# partprobe
# pvcreate /dev/sdb7
CHECKING:
# vgdisplay
CHECKING:
# lvdisplay
44
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
LV Name storage
VG Name shazam
LV Size 700.00 MiB
Block device 253:2
# df –hT
NOTE:
Else if the file format would have been ext3/4, then the command
would have been:
# resize2fs /dev/shazam/storage
7. FINACL CHECKING
# df -hT
45
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
4. Make filesystem
-------- if the filesystem is XFS -------
# fstype_growfs /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
CHECKING:
# lvdisplay
# df –hT
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
VG Name shazam
VG Size 1012.00 MiB
# df -hT
48
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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
5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4
49
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory
# 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
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 8)
50
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
2nd PARTITION
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
2nd PARTITION
# partprobe
# pvdisplay OR # pvs
# vgdisplay OR # vgs
4. Create LVM Logical Volume of size 550 with name of ‘homeval’ — LV.
# lvdisplay
# mkfs.ext4 /dev/vg_home/homeval
# mkdir /mnt/homeval
7. Mount MANUALLY
52
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# 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
# mount –a
# reboot
8. FINACL CHECKING
# df –hT
# lsblk
# fdisk -l
53
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
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.
TASKS IN NUTSHELL
1. Check
# lvdisplay
# vgdisplay
# df -hT
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
# 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
# umount /mnt/homeval
OR
# umount /dev/vg_home/homeval
3. Resize LVM
4. Mount
# mount –a
5. FINAL CHECKING
55
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# 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
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
5. Make filesystem
# mkfs.fstype /dev/vgname/lvname
NOTE: fstype = xfs / etx3 / etx4
7. Mount Manually
# mount –t fstype /dev/vgname/lvname /mount_directory
57
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# 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
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
58
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# partprobe
# pv /dev/sdb10
# pvdisplay OR # pvs
# vgdisplay OR # vgs
4. Create LVM Logical Volume of size 800M with name of ‘red_lvl’ — LV.
5. Format Fielsystem
# mkfs.ext3 /dev/oraclevg/red_lvl
# mkdir /mnt/data
7. Mount MANUALLY
59
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# 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
# mount –a
# reboot
8. FINACL CHECKING
# 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
TASKS IN NUTSHELL
1. Create physical partitions
# fdisk /dev/sdb
n
p
1 --> sdb1
+100M
w
2. Make filesystem
# mkfs.ext4 /dev/sdb1
4. Mount Manually
# mount –t ext4 /dev/sdb1 /Exam
# 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
t
82
w
3. Make SWAP
# mkswap /dev/sdb2
UUID=AAAABBBBBCCCC
# 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
6. Make filesystem
# mkfs.ext4 /dev/vgtest/lvtest
7. Mount Manually
# mount –t ext4 /dev/vgtest/lvtest /mntsdb5
# vim /etc/fstab
UUID=AAAABBBBCCCC /mntsdb5 ext4 defaults 0 0
# mount –a
63
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
# 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
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
5. Make filesystem
# mkfs.vfat /dev/vg0/lv1
7. Mount Manually
# mount –t vfat /dev/vg0/lv1 /lvl
# 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
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
# mount –a
# reboot
67
May 2016 RHCSA | EXT200 EXAM PRACTICE PAPER
68