How to Reclaim Free Space for Linux Root Partition using Zerofree

This article discussed about how we can reclaim the free space for linux root partition that was implemented using thin provisioned disks in Linux VMware virtual machine (VM). Common advantages by implementing thin provisioned disks in VMware is the administrator are able to over-allocate storage because the provisioned thin disks consume only the space used. The concept of thin provisioning disk disregard either the operating system running on Linux or Windows. However, by using thin provisioned disks, you will find that vmdk file size still expands over the time whenever you install, uninstall or delete applications in VM. You will noticed that the vmdk file size does not shrink or return to its previous size. When this happens to the linux VM, we need to use zerofree utility to reclaim and shrink the free space. The following steps is mainly to reclaim free space for linux root partition, tested in CentOS 7 and RHEL 7.

1. Install “zerofree” on your virtualbox guest machine.

2. Run this command to boot into rescue mode :

# systemctl rescue

3. In the rescue mode, enter root password :

4. Mount the root partition as read-only. Then run zerofree command. Once zerofree command complete, kindly reboot the VM.

reclaim-freespace-zerofree-1

# mount -o remount, ro /dev/mapper/centos-root
# zerofree -v /dev/mapper/centos-root

5. Do a virtual clone V2V using vCenter or vmkfstool command. You will notice the vmdk size reduce to only the space used.

How to Add a New Hard Disk Without Rebooting on CentOS 7/ RHEL 7

Normally when you have added new storage to a running Virtual machine, you probably won’t see the new storage automatically.

This is because the SCSI bus to which the storage devices are connected needs to be rescanned to make the new hardware visible.

As a system administrator, to maintain the linux server uptime is very important and it is better to add a new hard disk without reboot the server.

There is one simple command to rescan the SCSI Bus and add SCSI Devices. The command will trigger the linux rescan scsi bus device on the system.

The following steps has been tested on CentOS 7, RHEL 7 and Oracle Linux 7.

Steps to Add a New Hard Disk Without Rebooting on CentOS 7/ RHEL 7

1. Add the new 20GB vdisk from the ESXi or vCenter :

Add a New Hard Disk Without Reboot

2. Show current disk and partition :

[root@centos7 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 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 label type: dos
Disk identifier: 0x0006b96a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62914559    30944256   8e  Linux LVM

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/centos-root: 29.5 GB, 29536288768 bytes, 57688064 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

3. Identify host bus number :

[root@centos7 ~]# ls /sys/class/scsi_host/
host0  host1  host2

4. Rescan the SCSI Bus to Add a SCSI Devices :

[root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

4. Verify the disk and partiton and make sure 20GB has been added. In this case, the following line appeared “Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors” and confirmed that 20GB has been added without reboot the server :

[root@centos7 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 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 label type: dos
Disk identifier: 0x0006b96a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62914559    30944256   8e  Linux LVM

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/centos-root: 29.5 GB, 29536288768 bytes, 57688064 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 /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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

4 lvcreate Command Examples on Linux

Logical volume management (LVM) is a widely-used technique and extremely flexible disk management scheme. It basically contain three basic command :

a. Creates the physical volumes using pvcreate
b. Create the volume group and add partition into volume group using vgcreate
c. Create a new logical volume using lvcreate

lvm-diagram1

The following examples focus on the command to create a logical volume in an existing volume group, lvcreate. lvcreate is the command do allocating logical extents from the free physical extent pool of that volume group. Normally logical volumes use up any space available on the underlying physical volumes on a next-free basis. Modifying the logical volume will frees and reallocates space in the physical volumes. The following lvcreate command has been tested on linux CentOS 5, CentOS 6, CentOS 7, RHEL 5, RHEl 6 and RHEL 7 version.

4 lvcreate Command Examples on Linux :

1. The following command creates a logical volume 15 gigabytes in size in the volume group vg_newlvm :

[root@centos7 ~]# lvcreate -L 15G vg_newlvm

2. The following command creates a 2500 MB linear logical volume named centos7_newvol in the volume group
vg_newlvm, creating the block device /dev/vg_newlvm/centos7_newvol :

[root@centos7 ~]# lvcreate -L 2500 -n centos7_newvol vg_newlvm

3. You can use the -l argument of the lvcreate command to specify the size of the logical volume in extents. You can also use this argument to specify the percentage of the volume group to use for the logical volume. The following command creates a logical volume called centos7_newvol that uses 50% of the total space in volume group vg_newlvm :

[root@centos7 ~]# lvcreate -l 50%VG -n centos7_newvol vg_newlvm

4. The following command creates a logical volume called centos7_newvol that uses all of the unallocated space in the volume group vg_newlvm :

[root@centos7 ~]# lvcreate --name centos7_newvol -l 100%FREE vg_newlvm

To see more lvcreate command options, issue the following command :

[root@centos7 ~]# lvcreate --help
  lvcreate: Create a logical volume

lvcreate
        [-A|--autobackup {y|n}]
        [-a|--activate [a|e|l]{y|n}]
        [--addtag Tag]
        [--alloc AllocationPolicy]
        [--cachemode CacheMode]
        [-C|--contiguous {y|n}]
        [-d|--debug]
        [-h|-?|--help]
        [--ignoremonitoring]
        [--monitor {y|n}]
        [-i|--stripes Stripes [-I|--stripesize StripeSize]]
        [-k|--setactivationskip {y|n}]
        [-K|--ignoreactivationskip]
        {-l|--extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
         -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
        [-M|--persistent {y|n}] [--major major] [--minor minor]
        [-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core|mirrored}|--corelog}]]
        [-n|--name LogicalVolumeName]
        [--noudevsync]
        [-p|--permission {r|rw}]
        [--[raid]minrecoveryrate Rate]
        [--[raid]maxrecoveryrate Rate]
        [-r|--readahead ReadAheadSectors|auto|none]
        [-R|--regionsize MirrorLogRegionSize]
        [-T|--thin  [-c|--chunksize  ChunkSize]
          [--discards {ignore|nopassdown|passdown}]
          [--poolmetadatasize MetadataSize[bBsSkKmMgG]]]
          [--poolmetadataspare {y|n}]
        [--thinpool ThinPoolLogicalVolume{Name|Path}]
        [-t|--test]
        [--type VolumeType]
        [-v|--verbose]
        [-W|--wipesignatures {y|n}]
        [-Z|--zero {y|n}]
        [--version]
        VolumeGroupName [PhysicalVolumePath...]

lvcreate
        { {-s|--snapshot} OriginalLogicalVolume[Path] |
          [-s|--snapshot] VolumeGroupName[Path] -V|--virtualsize VirtualSize}
          {-T|--thin} VolumeGroupName[Path][/PoolLogicalVolume]
                      -V|--virtualsize VirtualSize}
        [-c|--chunksize]
        [-A|--autobackup {y|n}]
        [--addtag Tag]
        [--alloc AllocationPolicy]
        [-C|--contiguous {y|n}]
        [-d|--debug]
        [--discards {ignore|nopassdown|passdown}]
        [-h|-?|--help]
        [--ignoremonitoring]
        [--monitor {y|n}]
        [-i|--stripes Stripes [-I|--stripesize StripeSize]]
        [-k|--setactivationskip {y|n}]
        [-K|--ignoreactivationskip]
        {-l|--extents LogicalExtentsNumber[%{VG|FREE|ORIGIN}] |
         -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
        [--poolmetadatasize MetadataVolumeSize[bBsSkKmMgG]]
        [-M|--persistent {y|n}] [--major major] [--minor minor]
        [-n|--name LogicalVolumeName]
        [--noudevsync]
        [-p|--permission {r|rw}]
        [-r|--readahead ReadAheadSectors|auto|none]
        [-t|--test]
        [--thinpool ThinPoolLogicalVolume[Path]]
        [-v|--verbose]
        [--version]
        [PhysicalVolumePath...]

How to Remove Volume Group and Physical Volume on LVM

icon-redhatlinuxBasically, adding and removing LVM will always involves these three logical “layers” which are Physical volumes (pv), Volume groups (vg) and Logical volumes (lv). This post assumed that the Logical volumes haven’t created. In certain situation, linux administrators are required to remove the existing Physical Volume or Volume Group only. It is possible to perform the required task if that system administrator has the right skill on linux. The steps as below :

1. Display the physical volumes and Volume Group using pvdisplay command :

[root@centos63 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_data
  PV Size               4.99 GiB / not usable 2.41 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              1278
  Free PE               1278
  Allocated PE          0
  PV UUID               qTmTeq-8qoL-xxEk-Dj5V-zOjl-vEag-P6Jl7L

2. Remove the Volume Group using vgremove command :

[root@centos63 ~]# vgremove vg_data
  Volume group "vg_data" successfully removed

3. Remove Physical Volume using pvremove command :

[root@centos63 ~]# pvremove /dev/sdb1
  Labels on physical volume "/dev/sdb1" successfully wiped

Additional Note :
How to Remove a Logical Volume on CentOS 6.3/RHEL6

How to Remove a Logical Volume on CentOS 6.3/RHEL6

In previous post, i have cover the steps to create additional Logical volume manager (LVM). In certain situation, linux administrator is required to remove the existing logical volume. It is possible to perform the required task if that system administrator has the right skill on linux. Otherwise, they will put themselves and the organization in the disaster or risk as this working with the system’s data. This post assumed centos63_vol has been created and will be remove later. In summary, removing a logical volume (centos63_vol) will involve the following processes:

a) Unmount the LV
b) Remove the LV
c) Update /etc/fstab

1. Begin by listing all the logical volumes on the system :

[root@centos63 ~]# lvs
  LV           VG          Attr     LSize Pool Origin Data%  Move Log Copy%  Convert
  lv_root      vg_centos63 -wi-ao-- 5.54g
  lv_swap      vg_centos63 -wi-ao-- 1.97g
  centos63_vol vg_data     -wi-ao-- 4.99g

2. Check current disk layout and find where centos63_vol is mounted :

[root@centos63 ~]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos63-lv_root
                      5.5G  2.2G  3.1G  41% /
tmpfs                 504M     0  504M   0% /dev/shm
/dev/sda1             485M   65M  395M  15% /boot
/dev/mapper/vg_data-centos63_vol
                      5.0G  139M  4.6G   3% /mydata

3. View current /etc/fstab value :

[root@centos63 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sun Jul 15 20:17:38 2012
#
# 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
#
/dev/mapper/vg_centos63-lv_root /                       ext4    defaults        1 1
UUID=2217c7b1-4467-4c81-8596-c3ee7758e2cc /boot                   ext4    defaults        1 2
/dev/mapper/vg_centos63-lv_swap 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/vg_data/centos63_vol /mydata                       ext4    defaults        1 1

4. Unmount centos63_vol (mounted at /mydata) :

[root@centos63 ~]# umount /mydata

5. Verify that centos63_vol has unmounted :

[root@centos63 ~]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos63-lv_root
                      5.5G  2.2G  3.1G  41% /
tmpfs                 504M     0  504M   0% /dev/shm
/dev/sda1             485M   65M  395M  15% /boot

6. Remove the logical volume /dev/mapper/vg_data-centos63_vol :

[root@centos63 ~]# lvremove /dev/mapper/vg_data-centos63_vol
Do you really want to remove active logical volume centos63_vol? [y/n]: y
  Logical volume "centos63_vol" successfully removed

7. Verify the logical volume has been removed :

[root@centos63 ~]# lvs
  LV      VG          Attr     LSize Pool Origin Data%  Move Log Copy%  Convert
  lv_root vg_centos63 -wi-ao-- 5.54g
  lv_swap vg_centos63 -wi-ao-- 1.97g
[root@centos63 ~]#

8. Update /etc/fstab to reflect the removal of the file system :

[root@centos63 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Jul 15 20:17:38 2012
#
# 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
#
/dev/mapper/vg_centos63-lv_root /                       ext4    defaults        1 1
UUID=2217c7b1-4467-4c81-8596-c3ee7758e2cc /boot                   ext4    defaults        1 2
/dev/mapper/vg_centos63-lv_swap 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

How to Create Additional LVM on RHEL 6/CentOS 6

Most of the linux administrator facing run out of disk space to store data and sometimes there is another request for them to create additional logical volume manager(LVM) for new system or to store data. It is possible to perform this task if that system administrator has the right skill on linux. Otherwise, they will put themselves and the organization in the disaster or risk as working with the system’s data is on of the most critical job that must be perform with the right steps and skills. In this post, i will show how to create additional LVM on Red Hat Enterprise Linux 6 (RHEL 6) system. This step may apply to CentOS 6.0. CentOS 6.1 and CentOS 6.2.

1. By typing the mount command with no arguments shows us all currently mounted filesystems

[root@rhel6 ~]# mount
/dev/mapper/VolGroup-lv_root 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)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

2. Print the current partition table of the hard disk :

[root@rhel6 ~]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000690f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1567    12069888   8e  Linux LVM

Disk /dev/dm-0: 10.2 GB, 10242490368 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/sdb: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

3. Create new partition for /dev/sdb using below command :

[root@rhel6 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x1adc0629.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

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
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

4. Convert this disk into a physical volume :

[root@rhel6 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

Display the physical volume :

[root@rhel6 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup
  PV Size               11.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              2946
  Free PE               0
  Allocated PE          2946
  PV UUID               tzxpC7-70n1-OuUQ-kMfT-H627-VHAA-kroHvm

  "/dev/sdb1" is a new physical volume of "12.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name
  PV Size               12.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               SoWQ5U-CmmA-tjIY-KDh0-H3gU-qVpa-tx4n6n

5. With the physical volume created we now need to create new volume group for it. In this case i will give the volume group name VolGroup_rhel6 :

[root@rhel6 ~]# vgcreate VolGroup_rhel6 /dev/sdb1
  Volume group "VolGroup_rhel6" successfully created

Display the volume group

[root@rhel6 ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup_rhel6
  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               11.99 GiB
  PE Size               4.00 MiB
  Total PE              3070
  Alloc PE / Size       0 / 0
  Free  PE / Size       3070 / 11.99 GiB
  VG UUID               mg2I2s-8u5l-Mjm7-oKrQ-yYJ3-yzaO-mq2u9v

  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               11.51 GiB
  PE Size               4.00 MiB
  Total PE              2946
  Alloc PE / Size       2946 / 11.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               uROlLN-3aef-Cb7G-rJ8W-EyY0-aDaf-TyeE5T

6. Create logical volumes with the name of rhelvol into VolGroup_rhel6 volume group :

[root@rhel6 ~]# lvcreate --name rhelvol -l 100%FREE VolGroup_rhel6
  Logical volume "rhelvol" created

Display logical volume :

[root@rhel6 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup_rhel6/rhelvol
  VG Name                VolGroup_rhel6
  LV UUID                o3RQMB-O3Lu-TB2h-7pSm-A2kI-sh1W-rXb1Ce
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                11.99 GiB
  Current LE             3070
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_root
  VG Name                VolGroup
  LV UUID                1f4tl8-rCgZ-yI9J-xCsI-Hrh2-5DUS-DJF5N2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                9.54 GiB
  Current LE             2442
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_swap
  VG Name                VolGroup
  LV UUID                Kpw601-Wcvj-EM8b-FJnh-v2f6-5CqT-rV2JdT
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             504
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

7. Creating a file with the mke2fs command :

[root@rhel6 ~]# mke2fs -j /dev/VolGroup_rhel6/rhelvol
[root@rhel6 ~]# mke2fs -j /dev/VolGroup_rhel6/rhelvol
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3143680 blocks
157184 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rhel6 ~]# e2label /dev/VolGroup_rhel6/rhelvol /opt
[root@rhel6 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Jan  4 03:41:29 2012
#
# 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
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
/dev/VolGroup_rhel6/rhelvol /opt                       ext4    defaults        1 1
UUID=0e03e7c9-6971-4783-8fb9-fc251febf486 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap 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
[root@rhel6 /]# mount /opt
[root@rhel6 /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      9.4G  2.1G  6.9G  23% /
tmpfs                 504M     0  504M   0% /dev/shm
/dev/sda1             485M   29M  432M   7% /boot
/dev/mapper/VolGroup_rhel6-rhelvol
                       12G  159M   12G   2% /opt

Type the mount command with no arguments to shows the updated mounted filesystems. /dev/mapper/VolGroup_rhel6-rhelvol now exist at the bottom :

[root@rhel6 ~]# mount
/dev/mapper/VolGroup-lv_root 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)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/VolGroup_rhel6-rhelvol on /opt type ext4 (rw)