How to resolve - Another app is currently holding the yum lock; waiting for it to exit...
[Centos7-01 ~]# yum repolist
Loaded plugins: enabled_repos_upload, langpacks, package_upload, product-id, search-
: disabled-repos, subscription-manager
Existing lock /var/run/yum.pid: another copy is running as pid 3272.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 77 M RSS (515 MB VSZ)
Started: Wed Sep 27 08:57:19 2017 - 00:02 ago
State : Sleeping, pid: 3272
Another app is currently holding the yum lock; waiting for it to exit...
Step1:
# kill 3272
if does not work, hard kill
# kill -9 3272
But this also did not help... Next:
Step 2:
Found that there was old local repository active from the ISO monted to /mnt.
Please disable the old repository - yum repolist will show the details
[centOS7-01 ~]# yum-config-manager --disable "Centos 7.4"
Loaded plugins: langpacks, product-id
============================================================================ repo: InstallMedia ============================================================================
[InstallMedia]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7Server
baseurl = file:///mnt/
cache = 0
Output truncated......
[Centos7-01 ~]# yum repolist
Now please run below commands and install the packages of your choice.
[Centos7-01 ~]# yum clean all
[Centos7-01 ~]# yum update all
[Centos7-01 ~]# yum install ksh
That's it!
Wednesday, September 27, 2017
Thursday, August 17, 2017
CentOS 7 - Runlevel change
CentOS 7 - Runlevel change
Method one:
# systemctl get-default
multi-user.target
# systemctl set-default multi-user.target
# reboot
Second method:
# ls /lib/systemd/system/runlevel*target -l
lrwxrwxrwx. 1 root root 15 Aug 3 13:44 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Aug 3 13:44 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Aug 3 13:44 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Aug 3 13:44 /lib/systemd/system/runlevel6.target -> reboot.target
# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
# systemctl get-default
runlevel5.target
# reboot
Method one:
# systemctl get-default
multi-user.target
# systemctl set-default multi-user.target
# reboot
Second method:
# ls /lib/systemd/system/runlevel*target -l
lrwxrwxrwx. 1 root root 15 Aug 3 13:44 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Aug 3 13:44 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug 3 13:44 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Aug 3 13:44 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Aug 3 13:44 /lib/systemd/system/runlevel6.target -> reboot.target
# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
# systemctl get-default
runlevel5.target
# reboot
Thursday, August 3, 2017
find: paths must precede expression
[root@dns1 bashscripts]# find . -type f -name *.core -print
find: paths must precede expression: various1.core
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
[root@dns1 bashscripts]# find . -type f -name '*.core' -print
./various4.core
./various9.core
./various7.core
./various1.core
./various5.core
./various8.core
./various2.core
./various10.core
./various6.core
./various3.core
[root@dns1 bashscripts]# ls -l *.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various10.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various1.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various2.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various3.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various4.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various5.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various6.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various7.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various8.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various9.core
Note: Single quotes will stop wild cards from expanding the search.
find: paths must precede expression: various1.core
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
[root@dns1 bashscripts]# find . -type f -name '*.core' -print
./various4.core
./various9.core
./various7.core
./various1.core
./various5.core
./various8.core
./various2.core
./various10.core
./various6.core
./various3.core
[root@dns1 bashscripts]# ls -l *.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various10.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various1.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various2.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various3.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various4.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various5.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various6.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various7.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various8.core
-rw-r--r--. 1 root root 0 Apr 18 22:40 various9.core
Note: Single quotes will stop wild cards from expanding the search.
Tuesday, June 6, 2017
Quick port connectivity testing with nc and curl/Python
Using netcat
Quick way to test connectivity between two hosts via nc (concatenate and redirect sockets)
ncat is a feature packed network utility which reads and write data across network from the command line.
Note: hostA is server and hostB is client
hostA# nc -l 80
--> leave it running in a listening status
hostB# nc -vnz 80
OR if you are using any NAT ip address to reach to the internal network from outside world
Using curl and python.
On the server side run the
hostA# python -m SimpleHTTPServer 33101
Serving HTTP on 0.0.0.0 port 33101 ...
[06/Jun/2017 23:33:59] "GET / HTTP/1.1" 200 -
from hostB
hostb# curl -vs:33101
you will see the Rebuilt URL to the IP address of the server via specified port and connecting successfully followed by closing the connection
Quick way to test connectivity between two hosts via nc (concatenate and redirect sockets)
ncat is a feature packed network utility which reads and write data across network from the command line.
Note: hostA is server and hostB is client
hostA# nc -l 80
--> leave it running in a listening status
hostB# nc -vnz
OR if you are using any NAT ip address to reach to the internal network from outside world
Using curl and python.
On the server side run the
hostA# python -m SimpleHTTPServer 33101
Serving HTTP on 0.0.0.0 port 33101 ...
from hostB
hostb# curl -vs
you will see the Rebuilt URL to the IP address of the server via specified port and connecting successfully followed by closing the connection
Saturday, March 11, 2017
Local Yum repository - CentOS-6.7
Mount the CD/DVD ROM and copy the Packages directory
cp -r /media/CentOS_6.7_Final/Packages /Repository
rpm -ivh createrepo-0.9.9-24.el6.noarch
[root@master ~]# cat /etc/yum.repos.d/example.repo
[example]
name=Master server Repository
baseurl=file:///Repository
enabled=1
gpgcheck=0
* Now run the createrepo command on the newly created /Repository
[root@master ~]# createrepo /Repository
[root@master ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.vwtonline.net
* extras: centos.gbeservers.com
* updates: distro.ibiblio.org
repo id repo name status
base CentOS-6 - Base 5,062
example Master server Repository 3,150
extras CentOS-6 - Extras 39
puppetlabs-pc1 Puppet Labs PC1 Repository el 7 - i386 72
updates CentOS-6 - Updates 732
repolist: 9,055
cp -r /media/CentOS_6.7_Final/Packages /Repository
rpm -ivh createrepo-0.9.9-24.el6.noarch
[root@master ~]# cat /etc/yum.repos.d/example.repo
[example]
name=Master server Repository
baseurl=file:///Repository
enabled=1
gpgcheck=0
* Now run the createrepo command on the newly created /Repository
[root@master ~]# createrepo /Repository
[root@master ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.vwtonline.net
* extras: centos.gbeservers.com
* updates: distro.ibiblio.org
repo id repo name status
base CentOS-6 - Base 5,062
example Master server Repository 3,150
extras CentOS-6 - Extras 39
puppetlabs-pc1 Puppet Labs PC1 Repository el 7 - i386 72
updates CentOS-6 - Updates 732
repolist: 9,055
Wednesday, March 8, 2017
recursive function shell script for File System Monitoring
/opt/newdir file system is 92% full and we want to send an email to root once it goes above 90%
[root@dns1 shellscripts]# df -h /opt/newdir/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lvm--raid-myvol01
97M 84M 7.9M 92% /opt/newdir
[root@dns1 shellscripts]# df -h /opt/newdir/ | awk '{print $4}' | grep -v "Avail" | sed 's/%$//'
92
[root@dns1 shellscripts]# cat recursive_functions.sh
#!/bin/bash
# define first function
my_one() {
monitor_new_dir=`df -h /opt/newdir/ | awk '{print $4}' | grep -v "Avail" | sed 's/%$//'`
size=90
if [ $size -lt $monitor_new_dir ]
then
echo "Filesystem is $monitor_new_dir% full. Please take action"| mail -s "Do the clean up now" root
else
echo "You are good"
fi
my_two
}
my_two() {
echo This is second function
}
my_one
Here is the OutPut:
[root@dns1 shellscripts]# ./recursive_functions.sh
This is second function
[root@dns1 shellscripts]# mail
600 root Sat Mar 4 11:04 21/803 "Do the clean up now"
>N601 root Sat Mar 4 11:05 21/787 "Do the clean up now"
& 601
Message 601:
From root@dns1.example.com Sat Mar 4 11:05:02 2017
Return-Path:
From: root
Date: Sat, 04 Mar 2017 11:05:02 -0800
To: root@dns1.example.com
Subject: Do the clean up now
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
Status: R
Filesystem is 92% full. Please take action
[root@dns1 shellscripts]# df -h /opt/newdir/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lvm--raid-myvol01
97M 84M 7.9M 92% /opt/newdir
[root@dns1 shellscripts]# df -h /opt/newdir/ | awk '{print $4}' | grep -v "Avail" | sed 's/%$//'
92
[root@dns1 shellscripts]# cat recursive_functions.sh
#!/bin/bash
# define first function
my_one() {
monitor_new_dir=`df -h /opt/newdir/ | awk '{print $4}' | grep -v "Avail" | sed 's/%$//'`
size=90
if [ $size -lt $monitor_new_dir ]
then
echo "Filesystem is $monitor_new_dir% full. Please take action"| mail -s "Do the clean up now" root
else
echo "You are good"
fi
my_two
}
my_two() {
echo This is second function
}
my_one
Here is the OutPut:
[root@dns1 shellscripts]# ./recursive_functions.sh
This is second function
[root@dns1 shellscripts]# mail
600 root Sat Mar 4 11:04 21/803 "Do the clean up now"
>N601 root Sat Mar 4 11:05 21/787 "Do the clean up now"
& 601
Message 601:
From root@dns1.example.com Sat Mar 4 11:05:02 2017
Return-Path:
From: root
Date: Sat, 04 Mar 2017 11:05:02 -0800
To: root@dns1.example.com
Subject: Do the clean up now
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
Status: R
Filesystem is 92% full. Please take action
Sunday, March 5, 2017
Nestat socket states - from man page reference
[root@puppet-agent1 shellscript]# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1946/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1807/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2076/master
tcp 0 0 :::22 :::* LISTEN 1946/sshd
tcp 0 0 ::1:631 :::* LISTEN 1807/cupsd
tcp 0 0 ::1:25 :::* LISTEN 2076/master
udp 0 0 0.0.0.0:631 0.0.0.0:* 1807/cupsd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1772/dhclient
Recv-Q
The count of bytes not copied by the user program connected to this socket.
Send-Q
The count of bytes not acknowledged by the remote host.
Local Address
Address and port number of the local end of the socket. Unless the --numeric (-n) option is specified, the socket address is resolved
to its canonical host name (FQDN), and the port number is translated into the corresponding service name.
Foreign Address
Address and port number of the remote end of the socket. Analogous to "Local Address."
ESTABLISHED
The socket has an established connection.
SYN_SENT
The socket is actively attempting to establish a connection.
SYN_RECV
A connection request has been received from the network.
FIN_WAIT1
The socket is closed, and the connection is shutting down.
FIN_WAIT2
Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT
The socket is waiting after close to handle packets still in the network.
CLOSED
The socket is not being used.
CLOSE_WAIT
The remote end has shut down, waiting for the socket to close.
LAST_ACK
The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN
The socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listen option.
CLOSING
Both sockets are shut down but we still don't have all our data sent.
UNKNOWN
The state of the socket is unknown.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1946/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1807/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2076/master
tcp 0 0 :::22 :::* LISTEN 1946/sshd
tcp 0 0 ::1:631 :::* LISTEN 1807/cupsd
tcp 0 0 ::1:25 :::* LISTEN 2076/master
udp 0 0 0.0.0.0:631 0.0.0.0:* 1807/cupsd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1772/dhclient
Recv-Q
The count of bytes not copied by the user program connected to this socket.
Send-Q
The count of bytes not acknowledged by the remote host.
Local Address
Address and port number of the local end of the socket. Unless the --numeric (-n) option is specified, the socket address is resolved
to its canonical host name (FQDN), and the port number is translated into the corresponding service name.
Foreign Address
Address and port number of the remote end of the socket. Analogous to "Local Address."
The state of the socket. Since there are no states in raw mode and usually no states used in UDP, this column may be left blank. Normally this can be one of several values:
ESTABLISHED
The socket has an established connection.
SYN_SENT
The socket is actively attempting to establish a connection.
SYN_RECV
A connection request has been received from the network.
FIN_WAIT1
The socket is closed, and the connection is shutting down.
FIN_WAIT2
Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT
The socket is waiting after close to handle packets still in the network.
CLOSED
The socket is not being used.
CLOSE_WAIT
The remote end has shut down, waiting for the socket to close.
LAST_ACK
The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN
The socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listen option.
CLOSING
Both sockets are shut down but we still don't have all our data sent.
UNKNOWN
The state of the socket is unknown.
Saturday, March 4, 2017
puppet agent installation on Centos 6.5
First enable the puppet repository by installing the puppetlabs-release-6-10.noarch.rpm package
[root@puppet-agent ~]# rpm -ivh https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
Retrieving https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
warning: /var/tmp/rpm-tmp.FD1UUR: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
Preparing... ########################################### [100%]
1:puppetlabs-release ########################################### [100%]
[root@puppet-agent ~]# yum install puppet
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.gbeservers.com
* extras: mirrors.usinternet.com
* updates: centos-distro.cavecreek.net
puppetlabs-deps | 2.5 kB 00:00
puppetlabs-deps/primary_db | 27 kB 00:00
puppetlabs-products | 2.5 kB 00:00
puppetlabs-products/primary_db | 170 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package puppet.noarch 0:3.8.7-1.el6 will be installed
--> Processing Dependency: ruby >= 1.8.7 for package: puppet-3.8.7-1.el6.noarch
--> Processing Dependency: ruby >= 1.8 for package: puppet-3.8.7-1.el6.noarch
[root@puppet-agent ~]# rpm -ivh https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
Retrieving https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
warning: /var/tmp/rpm-tmp.FD1UUR: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
Preparing... ########################################### [100%]
1:puppetlabs-release ########################################### [100%]
[root@puppet-agent ~]# yum install puppet
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.gbeservers.com
* extras: mirrors.usinternet.com
* updates: centos-distro.cavecreek.net
puppetlabs-deps | 2.5 kB 00:00
puppetlabs-deps/primary_db | 27 kB 00:00
puppetlabs-products | 2.5 kB 00:00
puppetlabs-products/primary_db | 170 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package puppet.noarch 0:3.8.7-1.el6 will be installed
--> Processing Dependency: ruby >= 1.8.7 for package: puppet-3.8.7-1.el6.noarch
--> Processing Dependency: ruby >= 1.8 for package: puppet-3.8.7-1.el6.noarch
Out put truncated .....
[root@puppet-agent ~]# puppet --version
3.8.7
Configuration:
1. In the main section of the puppet.conf
[root@puppet-agent ~]# vi /etc/puppet/puppet.conf
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet
server = skywalker.example.com
2. Allow the firewall on port 8140 or disable it if you are just testing the puppet
3. Generate the client cert
[root@puppet-agent ~]# puppet agent -t
Info: Creating a new SSL key for puppet-agent.example.com
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for puppet-agent.example.com
Info: Certificate Request fingerprint (SHA256): 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled
4. ignore the error for "waitforcecert" we yet have to sign the client from the puppet master
[root@puppet-agent ~]# puppet cert list
Notice: Signed certificate request for ca
5. Display the cert from master
[root@skywalker puppet]# puppet cert list -a
"puppet-agent.example.com" (SHA256) 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6
6. Cert is signed now
[root@skywalker puppet]# puppet cert sign puppet-agent.example.com
Signing Certificate Request for:
"puppet-agent.example.com" (SHA256) 57:C0:26:83:1D:20:FB:46:03:91:50:47:12:CE:41:CE:D0:56:06:40:D8:E6:A7:67:D4:FD:E4:10:A0:AD:F8:E6
Notice: Signed certificate request for puppet-agent.example.com
Notice: Removing file Puppet::SSL::CertificateRequest puppet-agent.example.com at '/etc/puppetlabs/puppet/ssl/ca/requests/puppet-agent.example.com.pem'
7. now run - puppet agent -t
[root@puppet-agent ~]# puppet agent -t
Info: Caching certificate for puppet-agent.example.com
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for puppet-agent.example.com
output truncated ....
puppet agent is seen in the inventory of the puppet master to manage.
Thanks.
Friday, March 3, 2017
puppet agent Cert error - No route to the host
after installing the agent and trying to register the cert with the master server got the following error:
Resolution : Either allow client via firewall so that puppet master can talk to the client and vice versa
or stop the firewall and the error should go away.
Error: Could not request certificate: No route to host - connect(2)
Resolution : Either allow client via firewall so that puppet master can talk to the client and vice versa
or stop the firewall and the error should go away.
Error: Could not request certificate: No route to host - connect(2)
Friday, February 24, 2017
Centos 7 new logical volume
[root@centos7 ~]# uname -a
Linux centos7.example.com 3.10.0-327.el7.i686 #
[root@centos7 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cl_centos7 1 2 0 wz--n- 19.51g 40.00m
[root@centos7 ~]# lvcreate -L 10M -n vol01 cl_centos7
Rounding up size to full physical extent 12.00 MiB
Logical volume "vol01" created.
[root@centos7 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root cl_centos7 -wi-ao---- 17.47g
swap cl_centos7 -wi-ao---- 2.00g
vol01 cl_centos7 -wi-a----- 12.00m
[root@centos7 ~]# mkdir /devops01
[root@centos7 ~]# mkfs.ext4 /dev/cl_centos7/vol01
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
3072 inodes, 12288 blocks
614 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=12582912
2 block groups
8192 blocks per group, 8192 fragments per group
1536 inodes per group
Superblock backups stored on blocks:
8193
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
[root@centos7 ~]# mount /dev/cl_centos7/vol01 /devops01/
[root@centos7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl_centos7-root 18G 4.7G 13G 27% /
/dev/mapper/cl_centos7-vol01 11M 204K 9.6M 3% /devops01
Linux centos7.example.com 3.10.0-327.el7.i686 #
[root@centos7 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cl_centos7 1 2 0 wz--n- 19.51g 40.00m
[root@centos7 ~]# lvcreate -L 10M -n vol01 cl_centos7
Rounding up size to full physical extent 12.00 MiB
Logical volume "vol01" created.
[root@centos7 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root cl_centos7 -wi-ao---- 17.47g
swap cl_centos7 -wi-ao---- 2.00g
vol01 cl_centos7 -wi-a----- 12.00m
[root@centos7 ~]# mkdir /devops01
[root@centos7 ~]# mkfs.ext4 /dev/cl_centos7/vol01
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
3072 inodes, 12288 blocks
614 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=12582912
2 block groups
8192 blocks per group, 8192 fragments per group
1536 inodes per group
Superblock backups stored on blocks:
8193
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
[root@centos7 ~]# mount /dev/cl_centos7/vol01 /devops01/
[root@centos7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl_centos7-root 18G 4.7G 13G 27% /
/dev/mapper/cl_centos7-vol01 11M 204K 9.6M 3% /devops01
Subscribe to:
Posts (Atom)