Wednesday, February 15, 2012

How to create Logical Volumes and Filesystems


Quick and Dirty Example here.
In our last example, we created a volume group vg03. It had thee disk, we expanded it to 4 because we planned proper capacity.
Our volume group now consists of 4 disks.
We are asked to create an approximately 10 GB files system in this SAN based volume group.
vgdisplay /dev/vg03
vgdisplay -v /dev/vg03
< Insert vgdisplay example here>
HP vgdisplay documentation link (Note this tends to change. I can’t help it if HP breaks the links)
This will show an empty volume group as we have not created any logical volumes
pvdisplay /dev/dsk/c10d0t1
… repeat for other disks …
Make sure nothing is on them.
Turns out 10 GB will fit quite nicely on a single disk. Since this is a SAN based disk, we need not worry here about raid configuration. If you are hosting an oracle rdbms, you should make sure the SAN admin sets up data, index and rollback as raid 1 or raid 10 to insure good performance.
lvcreate /dev/vg03
# Creates an empty logical volume on vg03. Uses default naming.
You can also do it this way if you like names.
lvcreate /dev/vg03 -n mydata
lvextend -L 10240 /dev/vg03/mydata /dev/dsk/c10t0d1
# This command creates an approximately 1024 MB logical volume and defines the disk it goes on. Always define the disk. Don’t let LVM or SAM decide where your data is going to go. Plan in advance. Note that LVM for Linux which is a feature port and not a binary recompile does let you define size 10 GB or 10240 MB. Still waiting for that feature on LVM for HP-UX.
newfs -F vxfs -o largefiles /dev/vg03/rmydata
Why largefiles? Databases are big and the default limit on a file size in a file system is 2 GB. That is too small. I almost always set up my file systems these days for largefiles unless the file system itself is less than 2 GB
# Create a mount point.
mkdir /mydata
# mount it.
mount /dev/vg03/mydata /mydata
# This does not set an optimal JFS logging and recovery options, but that is a different article
bdf
# See if its there and the right capacity.
Next article: Edit /etc/fstab and set permanent mount options.
NOTE: This article needs to be checked and have vgdisplay and pvdisplay and other examples inserted into it.

No comments: