LVM Creation


Some basics on LVM creation for RHEL/centOS

[gconklin@ntl-dev7 ~]$ sudo cat /proc/partitions
major minor  #blocks  name

8     0   76546048 sda
8     1    1020096 sda1
8     2   25599577 sda2
8     3    2096482 sda3
8     4          1 sda4
8     5    2048256 sda5
8     6   40789003 sda6
8    16   52428800 sdb
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/pvcreate /dev/sdb
Physical volume “/dev/sdb” successfully created
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/vgcreate vg_usr_local /dev/sdb
Volume group “vg_usr_local” successfully created
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/vgdisplay
— Volume group —
VG Name               vg_usr_local
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               50.00 GB
PE Size               4.00 MB
Total PE              12799 <—————— always leave 1 free PE
Alloc PE / Size       0 / 0
Free  PE / Size       12799 / 50.00 GB
VG UUID               sRxR6p-WxGd-4RI9-giHK-vyKa-rTn7-85CE2O
[gconklin@ntl-dev7 ~]$ sudo /usr/sbin/lvcreate -l 12798 vg_usr_local -n lv_usr_local
Logical volume “lv_usr_local” created
[gconklin@ntl-dev7 ~]$ sudo /sbin/mkfs.ext3 /dev/vg_usr_local/lv_usr_local
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6553600 inodes, 13105152 blocks
655257 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=16777216
400 block groups
32768 blocks per group, 32768 fragments per group
16384 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 (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[gconklin@ntl-dev7 ~]$ sudo /sbin/tune2fs -c 0 -i 0 -O dir_index -L /usr/local /dev/vg_usr_local/lv_usr_local
tune2fs 1.35 (28-Feb-2004)
Setting maximal mount count to -1
Setting interval between check 0 seconds
[gconklin@ntl-dev7 ~]$ sudo /sbin/tune2fs -l /dev/vg_usr_local/lv_usr_local
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name:   /usr/local
Last mounted on:          <not available>
Filesystem UUID:          e2ec42ed-5961-46f9-80a8-114027743b9e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              6553600
Block count:              13105152
Reserved block count:     655257
Free blocks:              12877967
Free inodes:              6553589
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Mon Feb 16 16:26:49 2009
Last mount time:          n/a
Last write time:          Mon Feb 16 16:29:40 2009
Mount count:              0
Maximum mount count:      -1
Last checked:             Mon Feb 16 16:26:49 2009
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      c4355538-c7a7-4bb9-8fac-eefdabb4d46d
Journal backup:           inode blocks
[gconklin@ntl-dev7 ~]$ sudo vi /etc/fstab
[gconklin@ntl-dev7 ~]$ sudo cat /etc/fstab
# This file is edited by fstab-sync – see ‘man fstab-sync’ for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/usr/local        /usr/local              ext3    defaults        1 2
/dev/vg_usr_local/lv_usr_local        /new              ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
LABEL=SWAP-sda3         swap                    swap    defaults        0 0
# Beginning of the block added by the VMware software
#.host:/                 /mnt/hgfs               vmhgfs  defaults,ttl=5     0 0
# End of the block added by the VMware software
/dev/hda                /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
[gconklin@ntl-dev7 ~]$ sudo mount -a
[gconklin@ntl-dev7 ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             981M  776M  156M  84% /
none                  125M  6.0M  119M   5% /dev/shm
/dev/sda5             2.0G  1.1G  784M  59% /usr
/dev/sda2              25G   23G     0 100% /usr/local
/dev/sda6              39G   20G   17G  55% /var
/dev/mapper/vg_usr_local-lv_usr_local
50G   85M   47G   1% /new

I left this on the end because I thik it is funny how inconsistant my notes are?  This is a totally different system… LOL 🙂
[root@clarkconnect /]# vgextend VolGroup00 /dev/hdb
Volume group “VolGroup00” successfully extended

Advertisements

, , , , , , , , , , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: