CentOS 6.4 Adding a filesystem to an existing volume group example


This page assumes that a physical volume and volume group has already been created.

Steps for setting up a new volume group are included on this page:


Step 1 Create the new logical volume

This shows the steps of adding a filesystem "apps" of 70Gb to an existing volume group syb_vol_group1.

Calling the new logical volume "apps_lv":

Command line is:
lvcreate -L 70GB -n apps_lv syb_vol_group1

[root@linuxdev var]# lvcreate -L 70GB -n apps_lv syb_vol_group1
  Logical volume "apps_lv" created
The created logical volume is shown:
[root@linuxdev var]# ls -l /dev/syb_vol_group1/apps*
lrwxrwxrwx 1 root root 7 Nov 11 10:43 /dev/syb_vol_group1/apps_lv -> ../dm-9

Step 2 Run mkfs

Command line is:
mkfs -t ext3 /dev/syb_vol_group1/apps_lv

[root@linuxdev var]# mkfs -t ext3 /dev/syb_vol_group1/apps_lv
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
4587520 inodes, 18350080 blocks
917504 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
560 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,
        4096000, 7962624, 11239424

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

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@linuxdev var]# ls -l /dev/mapper/syb_vol_group1-apps*
lrwxrwxrwx 1 root root 7 Nov 11 10:43 /dev/mapper/syb_vol_group1-apps_lv -> ../dm-9

"/dev/mapper/syb_vol_group1-apps_lv" is used in the mkfs command shown below.

Step 3 Make directory for the mount point "apps"

mkdir /var/apps

[root@linuxdev var]# mkdir /var/apps

Step 4 Mount the filesystem on the mount point

Command line is:
mount /dev/mapper/syb_vol_group1-apps_lv /var/apps

[root@linuxdev var]# mount /dev/mapper/syb_vol_group1-apps_lv /var/apps
[root@linuxdev var]#

Check the filesystem has mounted with:
df -k

[root@linuxdev var]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
                      51606140   9637180  39347520  20% /
tmpfs                  1832168        76   1832092   1% /dev/shm
/dev/sda1               495844     66179    404065  15% /boot
                      59490444  41338288  15130128  74% /home
                      72248648    184216  68394416   1% /var/apps

Step 5 Add the filesystem to the fstab file

Add a line to the bottom of file /etc/fstab which will be read on system restart.
/dev/mapper/syb_vol_group1-apps_lv /var/apps ext3 defaults 0 0

Push Symbol. Push Symbol. Door logos

Alastair Cook email:
cookalastair @ btinternet.com

Page created - 11th Nov 2016

Push Pull Door