changes_Linux_Cloud_workshop.pdf

69
CentOS 6.5 Installation 1. Boot your system with CentOS bootable media or ISO, you’ll get following screen. CentOS Boot Menu 2. Check the media. You can Skip it.

Transcript of changes_Linux_Cloud_workshop.pdf

Page 1: changes_Linux_Cloud_workshop.pdf

CentOS 6.5 Installation

1. Boot your system with CentOS bootable media or ISO, you’ll get following screen.

CentOS Boot Menu

2. Check the media. You can Skip it.

Page 2: changes_Linux_Cloud_workshop.pdf

Media Check

3. CentOS Installer started.

Page 3: changes_Linux_Cloud_workshop.pdf

CentOS Installation

4. Language to choose during installation process.

Page 4: changes_Linux_Cloud_workshop.pdf

Language Selection

5. Select Keyboard type.

Page 5: changes_Linux_Cloud_workshop.pdf

Select Keyboard

Page 6: changes_Linux_Cloud_workshop.pdf

6. Select Storage Devices ‚Basic Storage Devices‛ and ‚Specialized Storage Devices (For advanced users)‛.

Select Storage Devices

7. Storage device warning, Click ‚Yes, discard any data‚.

Page 7: changes_Linux_Cloud_workshop.pdf

8. Give Hostname. Click on ‚Configure Network‛ button below if you want to configure network settings during installation. Same can be configure manually later on also.

Page 8: changes_Linux_Cloud_workshop.pdf

Set Hostname

9. Select location.

Page 9: changes_Linux_Cloud_workshop.pdf

10. Set root password.

Page 10: changes_Linux_Cloud_workshop.pdf

11. Select ‚Create Custom Layout‚ to edit file system manually.

Page 11: changes_Linux_Cloud_workshop.pdf

12. Selecting ‚Standard Partition‛

Page 12: changes_Linux_Cloud_workshop.pdf

13. Partitions review.

Page 13: changes_Linux_Cloud_workshop.pdf

14. Format Warnings. Click ‚Format‛ which will erase existing data.

Page 14: changes_Linux_Cloud_workshop.pdf

Device Formatting

Page 15: changes_Linux_Cloud_workshop.pdf

15. Writing storage configuration to disk.

16. Formatting drive.

Page 16: changes_Linux_Cloud_workshop.pdf

Formatting Devices

17. Bootloader installation confirmation. Check ‚Use a boot loader password‛ box if you would like to give bootloader password.

18. Choose Desktop to install.

Page 17: changes_Linux_Cloud_workshop.pdf

19. The installation has begun.

20. Relax… Installation is still in progress. Have a cup of coffee to get it 100%.

Page 18: changes_Linux_Cloud_workshop.pdf

21. Installation is complete. Eject media and click on ‚reboot‚.

Page 19: changes_Linux_Cloud_workshop.pdf

22. Login Screen.

Page 20: changes_Linux_Cloud_workshop.pdf

23. CentOS 6.5 Desktop.

Page 21: changes_Linux_Cloud_workshop.pdf

Linux Directory Structure (File System Structure)

Page 22: changes_Linux_Cloud_workshop.pdf

1. / - Parent Directory

Only root user has write privilege under this directory.

2. /bin – User Binaries

Contains the list of commands that can be used by Normal user and Super user.

Page 23: changes_Linux_Cloud_workshop.pdf

For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries

Contains the list of commands that can be used ONLY by Super user.

For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files

Contains default configuration files required to install servers and other services.

For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files

Contains device files. Provides the information of devices connected to the machine. For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information

Contains information about system process. This contains information about running process. For example:

/proc/{pid} directory contains information about the process with that particular pid.

7. /var – Variable Files

var stands for variable files. This includes — system log files (/var/log); packages and

database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

Page 24: changes_Linux_Cloud_workshop.pdf

8. /tmp – Temporary Files

Directory that contains temporary files created by system and users.

Files under this directory are deleted when system is rebooted.

9. /usr – User Programs

Contains binaries, libraries, documentation, and source-code for second level programs.

/usr/bin contains binary files for user programs. /usr/sbin contains binary files for system administrators.

/usr/lib contains libraries for /usr/bin and /usr/sbin /usr/local contains users programs that you install from source.

For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories

Home directories for all users to store their personal files. For example: /home/john, /home/nikita

11. /boot – Boot Loader Files

Contains boot loader related files. Kernel initrd, vmlinux, grub files are located under /boot For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-

generic

12. /lib – System Libraries

Contains library files that supports the binaries located under /bin and /sbin

Library filenames are either ld* or lib*.so.* For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications

opt stands for optional.

Page 25: changes_Linux_Cloud_workshop.pdf

Third party applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory

Temporary or Permanent mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices

Temporary mount directory for removable devices. For examples, /media/cdrom for CD-ROM; /media/floppy for floppy

drives; /media/cdrecorder for CD writer

16. /srv – Service Data

srv stands for service. Contains server specific services related data. For example, /srv/cvs contains CVS related data.

Basic Linux Commands

To know present loggedin user

[vimals@linkshare ~]$ whoami

vimals

To find present working directory

[vimals@linkshare ~]$ pwd

/home/vimals

To list the files and directories

Page 26: changes_Linux_Cloud_workshop.pdf

[vimals@linkshare /]$ ls

bin boot dev etc home lib lib64 lost+found media misc mnt

net opt proc root sbin selinux srv sys tmp u01 usr var

To enter into home directory of user

[vimals@linkshare /]$ cd /home/vimals

To create multiple directories

[vimals@linkshare ~]$ mkdir Dir1 Dir2 Dir3

To create a directory

[vimals@linkshare ~]$ mkdir Directory

To enter into the directory

[vimals@linkshare ~]$ cd Directory

[vimals@linkshare Directory]$ mkdir sub_directory

To come out of the directory

[vimals@linkshare Directory]$ cd ..

To create parent directory

[vimals@linkshare ~]$ mkdir -p world/asia/india/hyd

To list the recursive directories

Page 27: changes_Linux_Cloud_workshop.pdf

[vimals@linkshare ~]$ ls -R world

world:

asia

world/asia:

india

world/asia/india:

hyd

world/asia/india/hyd:

[vimals@linkshare ~]$ cd world/asia/india/hyd/

To move one step behind

[vimals@linkshare hyd]$ cd ..

To move two steps behind

[vimals@linkshare india]$ cd ../..

[vimals@linkshare world]$

To create empty file

[vimals@linkshare ~]$ touch emp_file

To create multiple empty files

[vimals@linkshare ~]$ touch emp_file1 emp_file2 emp_file3

Page 28: changes_Linux_Cloud_workshop.pdf

To create a file with “cat”

[vimals@linkshare ~]$ cat > myfile.txt

Hi... Happy New Year 2015..!!!!

To read the contents of the file

[vimals@linkshare ~]$ cat myfile.txt

Hi... Happy New Year 2015..!!!!

To append the file

[vimals@linkshare ~]$ cat >> myfile.txt

Wishing you a better start for the Career..!!

[vimals@linkshare ~]$ cat myfile.txt

Hi... Happy New Year 2015..!!!!

Wishing you a better start for the Career..!!

Copy Command

[vimals@linkshare ~]$ cat file1.txt

This is Record ONE..

[vimals@linkshare ~]$ cat file2.txt

This is Record TWO..

Copying source to destination

Page 29: changes_Linux_Cloud_workshop.pdf

Note: Data in destination file is overwritten with the source file

[vimals@linkshare ~]$ cp file1.txt file2.txt

[vimals@linkshare ~]$ cat file1.txt

This is Record ONE..

[vimals@linkshare ~]$ cat file2.txt

This is Record ONE..

Copying the data without overwriting

[vimals@linkshare ~]$ cat > file1

This is file1

[vimals@linkshare ~]$ cat > file2

This is file2

[vimals@linkshare ~]$ cat file1 >> file2

[vimals@linkshare ~]$ cat file1

This is file1

[vimals@linkshare ~]$ cat file2

This is file2

This is file1

COPYING directories

Page 30: changes_Linux_Cloud_workshop.pdf

[student@gss Desktop]$ mkdir Dir_1 [student@gss Desktop]$ cd Dir_1/ [student@gss Dir_1]$ touch d1 d2 d3 [student@gss Dir_1]$ cd .. [student@gss Desktop]$ mkdir Dir_2 [student@gss Desktop]$ cd Dir_2 [student@gss Dir_2]$ touch e1 e2 e3 [student@gss Dir_2]$ cd .. [student@gss Desktop]$ cp -rv Dir_1 Dir_2 `Dir_1' -> `Dir_2/Dir_1' `Dir_1/d2' -> `Dir_2/Dir_1/d2' `Dir_1/d3' -> `Dir_2/Dir_1/d3' `Dir_1/d1' -> `Dir_2/Dir_1/d1' To copy multiple files into a Directory [student@gss Desktop]$ touch file1 file2 file3 file4 [student@gss Desktop]$ mkdir Boook [student@gss Desktop]$ cp file1 file2 file3 file4 Boook/ [student@gss Desktop]$ cd Boook/ [student@gss Boook]$ ls file1 file2 file3 file4 To copy All files to Directory [student@gss Desktop]$ cp * Boook/

Page 31: changes_Linux_Cloud_workshop.pdf

MOVE command

[vimals@linkshare ~]$ cat > Linux

This is a Linux classroom.

[vimals@linkshare ~]$ cat > Selenium

This is a selenium classroom

Moving linux to Selenium

[vimals@linkshare ~]$ mv Linux Selenium

[vimals@linkshare ~]$ ls

Selenium

To rename a directory/file

[vimals@linkshare ~]$ ls

Mydir1 Mydir2

Renaming Mydir1 to New_name_Mydir3

[vimals@linkshare ~]$ mv Mydir1 New_name_Mydir3

[vimals@linkshare ~]$ ls

Mydir2 New_name_Mydir3

Page 32: changes_Linux_Cloud_workshop.pdf

List[ls] commands: Version of ls [student@gss Desktop]$ ls --version ls (GNU coreutils) 8.4 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Richard M. Stallman and David MacKenzie. Display ALL information about Files/Directories [student@gss Desktop]$ ls -l total 16 -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt Display File size in Human readable format total [student@gss Desktop]$ ls -lh 16K -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt Display the details of directory [student@gss Desktop]$ mkdir dir

Page 33: changes_Linux_Cloud_workshop.pdf

[student@gss Desktop]$ ls -ld dir/ drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir/ Display files and Directories w.r.t last modification time in Reverse Order [student@gss Desktop]$ ls -ltr total 20 -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir Display Hidden files [student@gss Desktop]$ ls -a . .. dir first.txt fourth.txt second.txt third.txt Display without Hidden files [student@gss Desktop]$ ls -A dir first.txt fourth.txt second.txt third.txt Display inode numbers [student@gss Desktop]$ ls -il total 20 654352 drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir 654290 -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt 654318 -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt 654345 -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt 654348 -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt Display inode numbers in human readable format [student@gss Desktop]$ ls -ilh total 20K 654352 drwxrwxr-x. 2 student student 4.0K Feb 15 20:43 dir 654290 -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt 654318 -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt

Page 34: changes_Linux_Cloud_workshop.pdf

654345 -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt 654348 -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt Display inode number of a directory [student@gss Desktop]$ ls -ild dir/ 654352 drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir/ Sort files or Dir's by size [student@gss Desktop]$ ls -lS total 20 drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt Sort files or Dir's by size in human readable format [student@gss Desktop]$ ls -lSh total 20K drwxrwxr-x. 2 student student 4.0K Feb 15 20:43 dir -rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt -rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt -rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt -rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt

Wordcount

[vimals@linkshare ~]$ cat > wordcount

This is a workday.

This is a salesforce.

This is a Selenium Testing.

Page 35: changes_Linux_Cloud_workshop.pdf

To Count Characters including special symbols

[vimals@linkshare ~]$ wc -c wordcount

79 wordcount

To Count Lines

[vimals@linkshare ~]$ wc -l wordcount

7 wordcount

To Count words

[vimals@linkshare ~]$ wc -w wordcount

13 wordcount

To find date

[vimals@linkshare ~]$ date

Tue Jan 6 23:12:54 IST 2015

To view calender

[vimals@linkshare ~]$ cal

January 2015

Su Mo Tu We Th Fr Sa

Page 36: changes_Linux_Cloud_workshop.pdf

1 2 3

4 5 6 7 8 9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

25 26 27 28 29 30 31

To view calender of specific month of a year

[vimals@linkshare ~]$ cal 05 2015

May 2015

Su Mo Tu We Th Fr Sa

1 2

3 4 5 6 7 8 9

10 11 12 13 14 15 16

17 18 19 20 21 22 23

24 25 26 27 28 29 30 31

To perform calculations

[vimals@linkshare ~]$ bc

bc 1.06.95

Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software

Foundation, Inc.

Page 37: changes_Linux_Cloud_workshop.pdf

This is free software with ABSOLUTELY NO WARRANTY.

For details type `warranty'.

2+2

4

Quit

EDITORS

Vim is an editor to create or edit a text file.

There are three modes in vim. One is the command mode, second is the insert mode followed by Execution mode.

In the command mode, user can move around the file, delete text, etc.

In the insert mode, user can insert text. In Execution mode, user can save and quit the file.

Changing mode from one to another

From command mode to insert mode PRESS a/A/i/I/o/O

From insert mode to command mode PRESS Esc (escape key)

From command mode to execution mode PRESS shift+:

Insert Mode:

i Insert a text at current cursor position

Page 38: changes_Linux_Cloud_workshop.pdf

I Insert text at the beginning of the line

a Append text after a current cursor position

A Append text to the end of current line

o Open up a new line below the current line and add text there

O Open up a new line above the current line and add text there

Command Mode

yw: To copy a word

yy: To copy a line

nyy: To copy ‘n’ lines

dw: To delete a word

dd: To delete a line

ndd: To delete ‘n’ lines

p: To paste

u: To undo

ctrl+r: To redo

G: To move to last line of a file

nG: To move to nth line of a line

w: move forward word by word

b: move backward word by word

Page 39: changes_Linux_Cloud_workshop.pdf

/search-name: to search a word. E.g: To search for the word hello use

/hello

Execute Mode

:q To quit from a file without saving

:q! To quit with force

:w To save a file without quitting

:w! To save with force

:wq To save and quit

:wq! To save and quit with force

:1,$s/find a word/replace with new word

Managing linux partitions with Fdisk To view the list of partitions [root@gss ~]# fdisk -cul Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0001bc6a Device Boot Start End Blocks Id System /dev/sda1 * 2048 411647 204800 83 Linux /dev/sda2 411648 51611647 25600000 83 Linux

Page 40: changes_Linux_Cloud_workshop.pdf

/dev/sda3 51611648 53708799 1048576 82 Linux swap / Solaris To view the help menu [root@gss ~]# fdisk -cu /dev/sda Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): n ######### To create a NEW Partition ######### Command action e extended p primary partition (1-4) e ### Press ‚e‛ to create a EXTENDED Partition #### Selected partition 4 First sector (53708800-62914559, default 53708800): PRESS ENTER BUTTON Using default value 53708800 Last sector, +sectors or +size{K,M,G} (53708800-62914559, default 62914559): PRESS ENTER BUTTON Using default value 62914559

Page 41: changes_Linux_Cloud_workshop.pdf

Command (m for help): p ### To view the list of available partitions #### Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0001bc6a Device Boot Start End Blocks Id System /dev/sda1 * 2048 411647 204800 83 Linux /dev/sda2 411648 51611647 25600000 83 Linux /dev/sda3 51611648 53708799 1048576 82 Linux swap / Solaris /dev/sda4 53708800 62914559 4602880 5 Extended Command (m for help): w ### To save #### Restart the machine for the kernel update ### MANDATORY ### [root@gss Desktop]#reboot Creating Logical Partitions [root@gss Desktop]# fdisk -cu /dev/sda Command (m for help): n First sector (54122496-62914559, default 54122496): PRESS ENTER BUTTON Using default value 54122496 Last sector, +sectors or +size{K,M,G} (54122496-62914559, default 62914559): +200M Format the partition with File Systeem [root@gss ~]# mkfs -t ext4 /dev/sda5 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks

Page 42: changes_Linux_Cloud_workshop.pdf

51200 inodes, 204800 blocks 10240 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 25 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 36 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@gss ~]# mkfs -t ext4 /dev/sda6 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 51200 inodes, 204800 blocks 10240 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 25 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Page 43: changes_Linux_Cloud_workshop.pdf

To create a Mount Point [root@gss ~]# mkdir /mnt/fdisk_partition Mounting Partition “/dev/sda5” on /mnt/fdisk_partition [root@gss ~]# mount /dev/sda5 /mnt/fdisk_partition/ Creating files under Mount Point [root@gss ~]# cd /mnt/fdisk_partition/ [root@gss fdisk_partition]# touch hello.txt hi.txt whoami.txt [root@gss fdisk_partition]# ls hello.txt hi.txt lost+found whoami.txt [root@gss fdisk_partition]# reboot In Temporay Mounting: Files are not found after the rebooting the machine [root@gss ~]# cd /mnt/fdisk_partition/ [root@gss fdisk_partition]# ls [root@gss fdisk_partition]# Permanent Mounting with “fstab” [root@gss /]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Mon Feb 3 17:44:09 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info #

Page 44: changes_Linux_Cloud_workshop.pdf

UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 / ext4 defaults 1 1 UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot ext4 defaults 1 2 UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/sda6 /mnt/fdisk_permanentpartition ext4 defaults 0 0 To update the fstab table [root@gss /]# mount -a [root@gss /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 25G 6.6G 17G 29% / tmpfs 504M 228K 504M 1% /dev/shm /dev/sda1 194M 27M 158M 15% /boot /dev/sr0 3.6G 3.6G 0 100% /media/CentOS_6.4_Final /dev/sda6 194M 5.6M 179M 4% /mnt/fdisk_permanentpartition [root@gss /]# reboot [root@gss /]# cd /mnt/fdisk_permanentpartition/ [root@gss fdisk_permanentpartition]# ls data1.txt data2.txt data3.txt To create a swap partition

Page 45: changes_Linux_Cloud_workshop.pdf

[root@gss /]# mkswap /dev/sda5 Setting up swapspace version 1, size = 204796 KiB no label, UUID=c1588cbc-7534-4150-bd9e-4693c986008a [root@gss /]# swapon /dev/sda5 [root@gss /]# swapon -s Filename Type Size Used Priority /dev/sda3 partition 1048568 0 -1 /dev/sda5 partition 204792 0 -2 [root@gss /]# swapoff /dev/sda5 [root@gss /]# swapon -s Filename Type Size Used Priority /dev/sda3 partition 1048568 0 -1 [root@gss ~]# vim /etc/fstab # /etc/fstab # Created by anaconda on Mon Feb 3 17:44:09 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 / ext4 defaults 1 1 UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot ext4 defaults 1 2 UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0

Page 46: changes_Linux_Cloud_workshop.pdf

proc /proc proc defaults 0 0 /dev/sda6 swap swap defaults,pri=10 0 0 [root@gss ~]# mount -a [root@gss /]# swapon -a [root@gss /]# reboot [root@gss /]# swapon -s Filename Type Size Used Priority /dev/sda3 partition 1048568 0 -1 /dev/sda5 partition 204792 0 10 To encrypt a partition [root@gss ~]# cryptsetup luksFormat /dev/sda5 WARNING! ======== This will overwrite data on /dev/sda5 irrevocably. Are you sure? (Type uppercase yes): YES Enter LUKS passphrase: redhat Verify passphrase: redhat [root@gss ~]# cryptsetup luksOpen /dev/sda5 gss Enter passphrase for /dev/sda5: redhat [root@gss ~]# mkdir /mnt/disk_lock [root@gss ~]# mkfs -t ext4 /dev/mapper/gss mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0)

Page 47: changes_Linux_Cloud_workshop.pdf

Stride=0 blocks, Stripe width=0 blocks 25168 inodes, 100352 blocks 5017 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 13 block groups 8192 blocks per group, 8192 fragments per group 1936 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 31 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@gss ~]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Mon Feb 3 17:44:09 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 / ext4 defaults 1 1 UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot ext4 defaults 1 2 UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0

Page 48: changes_Linux_Cloud_workshop.pdf

sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/mapper/gss /mnt/disk_lock ext4 defaults 0 0 [root@gss ~]# vim /etc/crypttab gss /dev/sda5 [root@gss ~]# mount -a [root@gss ~]# reboot To remove the encryption [root@gss Desktop]# umount /mnt/disk_lock/ [root@gss Desktop]# vim /etc/fstab ### Remove the entries ##### [root@gss Desktop]# vim /etc/crypttab #### Remove the entries #### [root@gss Desktop]# cryptsetup luksClose gss [root@gss ~]# reboot **************************************************************************************************************************** ************* LVM Configuration *********** /dev/sda5 53710848 53915647 102400 83 Linux /dev/sda6 53917696 54122495 102400 83 Linux /dev/sda7 54124544 54226943 51200 83 Linux [root@gss ~]# pvcreate /dev/sda{5,6,7} WARNING: LUKS signature detected on /dev/sda5. Wipe it? [y/n] y Wiping LUKS signature on /dev/sda5. Physical volume "/dev/sda5" successfully created Physical volume "/dev/sda6" successfully created Physical volume "/dev/sda7" successfully created [root@gss ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda5 lvm2 a-- 100.00m 100.00m /dev/sda6 lvm2 a-- 100.00m 100.00m /dev/sda7 lvm2 a-- 50.00m 50.00m [root@gss ~]# pvdisplay "/dev/sda5" is a new physical volume of "100.00 MiB"

Page 49: changes_Linux_Cloud_workshop.pdf

--- NEW Physical volume --- PV Name /dev/sda5 VG Name PV Size 100.00 MiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID Se3k9Y-vZPY-OBOM-44Go-4wHO-DgEx-vFFvrj "/dev/sda6" is a new physical volume of "100.00 MiB" --- NEW Physical volume --- PV Name /dev/sda6 VG Name PV Size 100.00 MiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID BoREd6-dPby-tqzW-CyD3-gxhd-5w2E-Hc2Gki "/dev/sda7" is a new physical volume of "50.00 MiB" --- NEW Physical volume --- PV Name /dev/sda7 VG Name PV Size 50.00 MiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID KU6pQp-y4VJ-jAPg-UG1e-hgAB-7IC4-C54DKl ************************************************************************ creating volumeGroup

Page 50: changes_Linux_Cloud_workshop.pdf

[root@gss ~]# vgcreate vol_grp1 /dev/sda5 Volume group "vol_grp1" successfully created [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 0 0 wz--n- 96.00m 96.00m [root@gss ~]# vgdisplay --- Volume group --- VG Name vol_grp1 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 96.00 MiB PE Size 4.00 MiB Total PE 24 Alloc PE / Size 0 / 0 Free PE / Size 24 / 96.00 MiB VG UUID 8FOigJ-0PrC-WIBy-Rwuw-9aUW-C230-H47u52 [root@gss ~]# vgdisplay vol_grp1 --- Volume group --- VG Name vol_grp1 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0

Page 51: changes_Linux_Cloud_workshop.pdf

Max PV 0 Cur PV 1 Act PV 1 VG Size 96.00 MiB PE Size 4.00 MiB Total PE 24 Alloc PE / Size 0 / 0 Free PE / Size 24 / 96.00 MiB VG UUID 8FOigJ-0PrC-WIBy-Rwuw-9aUW-C230-H47u52 [root@gss ~]# vgcreate vol_grp2 /dev/sda6 Volume group "vol_grp2" successfully created [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 0 0 wz--n- 96.00m 96.00m vol_grp2 1 0 0 wz--n- 96.00m 96.00m [root@gss ~]# vgdisplay vol_grp2 --- Volume group --- VG Name vol_grp2 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 96.00 MiB PE Size 4.00 MiB Total PE 24 Alloc PE / Size 0 / 0 Free PE / Size 24 / 96.00 MiB VG UUID Qrxh79-KcD1-LE0e-c316-fngY-7hAk-p7cYFy

Page 52: changes_Linux_Cloud_workshop.pdf

[root@gss ~]# vgcreate vol_grp3 /dev/sda7 Volume group "vol_grp3" successfully created [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 0 0 wz--n- 96.00m 96.00m vol_grp2 1 0 0 wz--n- 96.00m 96.00m vol_grp3 1 0 0 wz--n- 48.00m 48.00m [root@gss ~]# vgdisplay vol_grp3 --- Volume group --- VG Name vol_grp3 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 48.00 MiB PE Size 4.00 MiB Total PE 12 Alloc PE / Size 0 / 0 Free PE / Size 12 / 48.00 MiB VG UUID LeGp3O-Ku5k-4M8q-yNyR-mvRL-RzSU-Iy9Yqk ***************************************************** To Create Logical Volume [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 0 0 wz--n- 96.00m 96.00m vol_grp2 1 0 0 wz--n- 96.00m 96.00m vol_grp3 1 0 0 wz--n- 48.00m 48.00m [root@gss ~]# lvcreate -L +50M -n log_vol1 vol_grp1

Page 53: changes_Linux_Cloud_workshop.pdf

Rounding up size to full physical extent 52.00 MiB Logical volume "log_vol1" created [root@gss ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-a---- 52.00m [root@gss ~]# lvdisplay --- Logical volume --- LV Path /dev/vol_grp1/log_vol1 LV Name log_vol1 VG Name vol_grp1 LV UUID utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt LV Write Access read/write LV Creation host, time gss.com, 2014-05-31 16:26:22 +0530 LV Status available # open 0 LV Size 52.00 MiB Current LE 13 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@gss ~]# lvdisplay /dev/vol_grp1/log_vol1 --- Logical volume --- LV Path /dev/vol_grp1/log_vol1 LV Name log_vol1 VG Name vol_grp1 LV UUID utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt LV Write Access read/write LV Creation host, time gss.com, 2014-05-31 16:26:22 +0530 LV Status available # open 0 LV Size 52.00 MiB Current LE 13 Segments 1 Allocation inherit

Page 54: changes_Linux_Cloud_workshop.pdf

Read ahead sectors auto - currently set to 256 Block device 253:0 [root@gss ~]# lvcreate -L +50M -n log_vol2 vol_grp2 Rounding up size to full physical extent 52.00 MiB Logical volume "log_vol2" created [root@gss ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-a---- 52.00m log_vol2 vol_grp2 -wi-a---- 52.00m [root@gss ~]# lvdisplay --- Logical volume --- LV Path /dev/vol_grp2/log_vol2 LV Name log_vol2 VG Name vol_grp2 LV UUID goVxt0-QsKS-QfoC-Hcif-LC7n-juLS-JnF7gn LV Write Access read/write LV Creation host, time gss.com, 2014-05-31 16:29:30 +0530 LV Status available # open 0 LV Size 52.00 MiB Current LE 13 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Path /dev/vol_grp1/log_vol1 LV Name log_vol1 VG Name vol_grp1 LV UUID utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt LV Write Access read/write LV Creation host, time gss.com, 2014-05-31 16:26:22 +0530

Page 55: changes_Linux_Cloud_workshop.pdf

LV Status available # open 0 LV Size 52.00 MiB Current LE 13 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 [root@gss ~]# lvdisplay /dev/vol_grp2/log_vol2 --- Logical volume --- LV Path /dev/vol_grp2/log_vol2 LV Name log_vol2 VG Name vol_grp2 LV UUID goVxt0-QsKS-QfoC-Hcif-LC7n-juLS-JnF7gn LV Write Access read/write LV Creation host, time gss.com, 2014-05-31 16:29:30 +0530 LV Status available # open 0 LV Size 52.00 MiB Current LE 13 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 **************************************************** Format the logical volume [root@gss ~]# mkfs -t ext4 /dev/vol_grp1/log_vol1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 13328 inodes, 53248 blocks

Page 56: changes_Linux_Cloud_workshop.pdf

2662 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=54525952 7 block groups 8192 blocks per group, 8192 fragments per group 1904 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@gss ~]# mkfs -t ext4 /dev/vol_grp2/log_vol2 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 13328 inodes, 53248 blocks 2662 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=54525952 7 block groups 8192 blocks per group, 8192 fragments per group 1904 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 29 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Page 57: changes_Linux_Cloud_workshop.pdf

************************************************************ Creating mount point for volume groups [root@gss ~]# mkdir /mnt/vol_grp1 [root@gss ~]# mkdir /mnt/vol_grp2 ***************************************************************** Permanently mounting the volume groups [root@gss ~]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Mon Feb 3 17:44:09 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 / ext4 defaults 1 1 UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot ext4 defaults 1 2 UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/mapper/vol_grp1-log_vol1 /mnt/vol_grp1 ext4 defaults 0 0

Page 58: changes_Linux_Cloud_workshop.pdf

/dev/mapper/vol_grp2-log_vol2 /mnt/vol_grp2 ext4 defaults 0 0 [root@gss ~]# mount -a [root@gss ~]# mount /dev/sda2 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /dev/sr0 on /media/CentOS_6.4_Final type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=0400,dmode=0500) /dev/mapper/vol_grp1-log_vol1 on /mnt/vol_grp1 type ext4 (rw) /dev/mapper/vol_grp2-log_vol2 on /mnt/vol_grp2 type ext4 (rw) ************************************************************************* To resize the Logical Volume [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 1 0 wz--n- 96.00m 44.00m vol_grp2 1 1 0 wz--n- 96.00m 44.00m [root@gss ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-ao--- 52.00m log_vol2 vol_grp2 -wi-ao--- 52.00m

Page 59: changes_Linux_Cloud_workshop.pdf

[root@gss ~]# lvresize -L +20M /dev/vol_grp1/log_vol1 Extending logical volume log_vol1 to 72.00 MiB Logical volume log_vol1 successfully resized [root@gss ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-ao--- 72.00m log_vol2 vol_grp2 -wi-ao--- 52.00m [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 1 0 wz--n- 96.00m 24.00m vol_grp2 1 1 0 wz--n- 96.00m 44.00m [root@gss ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 25G 3.2G 20G 15% / tmpfs 504M 228K 504M 1% /dev/shm /dev/sda1 194M 27M 158M 15% /boot /dev/sr0 3.6G 3.6G 0 100% /media/CentOS_6.4_Final /dev/mapper/vol_grp1-log_vol1 51M 4.9M 43M 11% /mnt/vol_grp1 /dev/mapper/vol_grp2-log_vol2 51M 4.9M 43M 11% /mnt/vol_grp2 [root@gss ~]# resize2fs /dev/vol_grp1/log_vol1 resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/vol_grp1/log_vol1 is mounted on /mnt/vol_grp1; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/vol_grp1/log_vol1 to 73728 (1k) blocks. The filesystem on /dev/vol_grp1/log_vol1 is now 73728 blocks long. [root@gss ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 25G 3.2G 20G 15% /

Page 60: changes_Linux_Cloud_workshop.pdf

tmpfs 504M 228K 504M 1% /dev/shm /dev/sda1 194M 27M 158M 15% /boot /dev/sr0 3.6G 3.6G 0 100% /media/CentOS_6.4_Final /dev/mapper/vol_grp1-log_vol1 70M 5.1M 62M 8% /mnt/vol_grp1 /dev/mapper/vol_grp2-log_vol2 51M 4.9M 43M 11% /mnt/vol_grp2 ***************************************************************** To reduce the logical volume [root@gss ~]# umount /dev/vol_grp1/log_vol1 or [root@gss ~]# umount /mnt/vol_grp1 [root@gss ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 25G 3.2G 20G 15% / tmpfs 504M 228K 504M 1% /dev/shm /dev/sda1 194M 27M 158M 15% /boot /dev/sr0 3.6G 3.6G 0 100% /media/CentOS_6.4_Final /dev/mapper/vol_grp2-log_vol2 51M 4.9M 43M 11% /mnt/vol_grp2 [root@gss ~]# fsck -f /dev/vol_grp1/log_vol1 fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010) fsck.ext2: Is a directory while trying to open /dev/vol_grp1 The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2

Page 61: changes_Linux_Cloud_workshop.pdf

filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device> [root@gss ~]# resize2fs -p /dev/vol_grp1/log_vol1 30M resize2fs 1.41.12 (17-May-2010) Please run 'e2fsck -f /dev/vol_grp1/log_vol1' first. [root@gss ~]# lvreduce -L 30M /dev/vol_grp1/log_vol1 Rounding size to boundary between physical extents: 32.00 MiB WARNING: Reducing active logical volume to 32.00 MiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce log_vol1? [y/n]: y Reducing logical volume log_vol1 to 32.00 MiB Logical volume log_vol1 successfully resized [root@gss ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-a---- 32.00m log_vol2 vol_grp2 -wi-ao--- 52.00m ************************************* Mount the logical volume again [root@gss ~]# mount -a ********************************** Removing LV, VG and PV [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vol_grp1 1 1 0 wz--n- 96.00m 64.00m vol_grp2 1 1 0 wz--n- 96.00m 44.00m vol_grp3 1 0 0 wz--n- 48.00m 48.00m [root@gss ~]# lvs

Page 62: changes_Linux_Cloud_workshop.pdf

LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert log_vol1 vol_grp1 -wi-a---- 32.00m log_vol2 vol_grp2 -wi-ao--- 52.00m [root@gss ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda5 vol_grp1 lvm2 a-- 96.00m 64.00m /dev/sda6 vol_grp2 lvm2 a-- 96.00m 44.00m /dev/sda7 vol_grp3 lvm2 a-- 48.00m 48.00m Vim /etc/fstab ################REMOVE THE FOLLOWING LINES FROM THE FILE AND SAVE IT################# /dev/mapper/vol_grp1-log_vol1 /mnt/vol_grp1 ext4 defaults 0 0 /dev/mapper/vol_grp2-log_vol2 /mnt/vol_grp2 ext4 defaults 0 0 [root@gss ~]# lvremove /dev/vol_grp1/log_vol1 Do you really want to remove active logical volume log_vol1? [y/n]: y Logical volume "log_vol1" successfully removed [root@gss ~]# vgremove vol_grp1 Volume group "vol_grp1" successfully removed [root@gss ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda5 lvm2 a-- 100.00m 100.00m /dev/sda6 vol_grp2 lvm2 a-- 96.00m 44.00m /dev/sda7 vol_grp3 lvm2 a-- 48.00m 48.00m [root@gss ~]# pvremove /dev/sda5 Labels on physical volume "/dev/sda5" successfully wiped [root@gss ~]# lvremove /dev/vol_grp2/log_vol2 Do you really want to remove active logical volume log_vol2? [y/n]: y Logical volume "log_vol2" successfully removed [root@gss ~]# vgremove vol_grp2 Volume group "vol_grp2" successfully removed [root@gss ~]# pvremove /dev/sda6 Labels on physical volume "/dev/sda6" successfully wiped

Page 63: changes_Linux_Cloud_workshop.pdf

******************************************************************** [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vg1 1 1 0 wz--n- 96.00m 64.00m vg2 1 1 0 wz--n- 96.00m 44.00m [root@gss ~]# vgextend vg1 /dev/sda7 No physical volume label read from /dev/sda7 Physical volume "/dev/sda7" successfully created Volume group "vg1" successfully extended [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vg1 2 1 0 wz--n- 144.00m 112.00m vg2 1 1 0 wz--n- 96.00m 44.00m [root@gss ~]# vgreduce vg1 /dev/sda7 Removed "/dev/sda7" from volume group "vg1" [root@gss ~]# vgs VG #PV #LV #SN Attr VSize VFree vg1 1 1 0 wz--n- 96.00m 64.00m vg2 1 1 0 wz--n- 96.00m 44.00m [root@gss ~]# vgcreate vg3 /dev/sda7 Volume group "vg3" successfully created [root@gss ~]# vgmerge vg1 vg3 Volume group "vg3" successfully merged into "vg1" [root@gss ~]# vgsplit vg1 vg3 /dev/sda7 New volume group "vg3" successfully split from "vg1" ***************************************************************

Page 64: changes_Linux_Cloud_workshop.pdf

USER AND GROUP ADMINISTRATION *************************************************************** ***-*********************************** CREATING USERS AND GROUPS ******************************************* [root@gss ~]# useradd centos [root@gss ~]# passwd centos Changing password for user centos. New password: Retype new password: passwd: all authentication tokens updated successfully. -------------------------------------------------------------- [root@gss ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin rtkit:x:499:497:RealtimeKit:/proc:/sbin/nologin avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin pulse:x:498:496:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin

Page 65: changes_Linux_Cloud_workshop.pdf

haldaemon:x:68:68:HAL daemon:/:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin apache:x:48:48:Apache:/var/www:/sbin/nologin saslauth:x:497:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin abrt:x:173:173::/etc/abrt:/sbin/nologin rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin gdm:x:42:42::/var/lib/gdm:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin student:x:500:500::/home/student:/bin/bash centos:x:501:501::/home/centos:/bin/bash ----------------------------------------------------------------------------- [root@gss ~]# cat /etc/shadow root:$6$lJlCBi9cCMDewWga$QI2AfHrMrvfqFO9HiH/GYy5CdFKh.3gnCuJ87nasjPUpdRpx3ja6y9yu7Zd666cfw7rW4J5loVmX0flOFXPUh1:16104:0:99999:7::: bin:*:15628:0:99999:7::: daemon:*:15628:0:99999:7::: adm:*:15628:0:99999:7::: lp:*:15628:0:99999:7::: sync:*:15628:0:99999:7::: shutdown:*:15628:0:99999:7::: halt:*:15628:0:99999:7::: mail:*:15628:0:99999:7::: uucp:*:15628:0:99999:7::: operator:*:15628:0:99999:7::: games:*:15628:0:99999:7::: gopher:*:15628:0:99999:7::: ftp:*:15628:0:99999:7::: nobody:*:15628:0:99999:7::: dbus:!!:16104:::::: usbmuxd:!!:16104:::::: vcsa:!!:16104:::::: rpc:!!:16104:0:99999:7::: rtkit:!!:16104:::::: avahi-autoipd:!!:16104::::::

Page 66: changes_Linux_Cloud_workshop.pdf

pulse:!!:16104:::::: haldaemon:!!:16104:::::: ntp:!!:16104:::::: apache:!!:16104:::::: saslauth:!!:16104:::::: postfix:!!:16104:::::: abrt:!!:16104:::::: rpcuser:!!:16104:::::: nfsnobody:!!:16104:::::: gdm:!!:16104:::::: sshd:!!:16104:::::: tcpdump:!!:16104:::::: student:$6$G1zJyUfcwV8cIsFV$hzpxmKL7rEkcXfiYbYY6JVhNT8K4O0NH9Ro1XM92YUTgNuH8eCYMwcJ/FNekbkurAWoc9VgJ1npYTJBwDpN2P.:16107:0:99999:7::: centos:$6$.h/1EAQB$j7Y7Cce82PjDXuGpPCZv5uukXWB.q1hntgsEZO7xXPrm3AQUQZSUK2iBNHxi.MeRxd0f9of5gqsy1mxxXfRYH0:16222:0:99999:7::: ------------------------------------------------------------------ CREATING USER WITH USER ID [root@gss ~]# useradd -u 505 narendra [root@gss ~]# passwd narendra Changing password for user narendra. New password: BAD PASSWORD: it is too simplistic/systematic BAD PASSWORD: is too simple Retype new password: passwd: all authentication tokens updated successfully. [root@gss ~]# grep narendra /etc/passwd narendra:x:505:505::/home/narendra:/bin/bash [root@gss ~]# usermod -u 510 narendra [root@gss ~]# grep narendra /etc/passwd narendra:x:510:505::/home/narendra:/bin/bash --------------------------------------------------------------------- [root@gss ~]# useradd -c "PM of INDIA" modi [root@gss ~]# grep modi /etc/passwd modi:x:511:511:PM of INDIA:/home/modi:/bin/bash

Page 67: changes_Linux_Cloud_workshop.pdf

[root@gss ~]# usermod -c "NARENDRA_MODI PM OF INDIA" modi [root@gss ~]# grep modi /etc/passwd modi:x:511:511:NARENDRA_MODI PM OF INDIA:/home/modi:/bin/bash ----------------------------------------------------------------------- [root@gss /]# useradd -d /home/NAMO narendra_modi [root@gss /]# grep narendra_modi /etc/passwd narendra_modi:x:512:512::/home/NAMO:/bin/bash [root@gss /]# usermod -d /home/NAMO_PM narendra_modi [root@gss /]# grep narendra_modi /etc/passwd narendra_modi:x:512:512::/home/NAMO_PM:/bin/bash ---------------------------------------------------------------------- [root@gss /]# useradd -s /bin/bash Harsha [root@gss /]# grep Harsha /etc/passwd Harsha:x:513:513::/home/Harsha:/bin/bash [root@gss /]# usermod -s /sbin/nologin Harsha [root@gss /]# grep Harsha /etc/passwd Harsha:x:513:513::/home/Harsha:/sbin/nologin ------------------------------------------------------------------ [root@gss /]# usermod -L centos [root@gss /]# su - centos Password: su: incorrect password [root@gss /]# usermod -U centos [root@gss /]# su - centos Password: [centos@gss ~]$ ------------------------------------------------------- [root@gss /]# userdel Harsha

Page 68: changes_Linux_Cloud_workshop.pdf

[root@gss home]# ls centos Harsha NAMO student [root@gss /]# userdel -r centos [root@gss /]# cd /home [root@gss home]# ls NAMO student --------------------------------------------------------- [root@gss /]# usermod -l Newname Oldname --------------------------------------------------------- [root@gss /]# groupadd sales_GSS [root@gss /]# grep sales_GSS /etc/group sales_GSS:x:501: [root@gss /]# groupadd -g 575 finance_GSS [root@gss /]# grep finance_GSS /etc/group finance_GSS:x:575: [root@gss /]# groupmod -n newgrp_name oldgrp_name [root@gss /]# gpasswd -a tom servicedesk_GSS Adding user tom to group servicedesk_GSS [root@gss /]# grep servicedesk_GSS /etc/group servicedesk_GSS:x:501:tom [root@gss /]# gpasswd -d tom servicedesk_GSS Removing user tom from group servicedesk_GSS [root@gss /]# grep servicedesk_GSS /etc/group servicedesk_GSS:x:501:

Page 69: changes_Linux_Cloud_workshop.pdf

[root@gss /]# gpasswd -M tom,dick,harry servicedesk_GSS [root@gss /]# grep servicedesk_GSS /etc/group servicedesk_GSS:x:501:tom,dick,harry