Saturday, February 15, 2014

Create LVM - a simple method...

Still need to fine tune...

[root@ram ~]# cat >vols
apps    1G
webs    1G

[root@ram ~]# cat vols | while read fs size
> do
> echo Filesystem is $fs
> echo Size is $size
> done
Filesystem is apps
Size is 1G
Filesystem is webs
Size is 1G


[root@ram ~]# cat vols | while read fs size
> do
>  lvcreate -L ${size} -n ${fs} test_vol
> mkfs.ext4 /dev/test_vol/${fs}
> mkdir /myFS
> mount /dev/test_vol/${fs} /myFS
> done
  Logical volume "apps" created
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
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

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

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
  Logical volume "webs" created
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
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (8192 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.
mkdir: cannot create directory `/myFS': File exists
[root@ram ~]# df -h /myFS
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/test_vol-webs
                     1008M   34M  924M   4% /myFS
[root@ram ~]#

No comments:

Post a Comment