This procedure describes how to set a new volume group and file systems on a Red Hat Enterprise Linux system.
First, we'll need to make sure that there is storage available on the system that can be allocated to a new volume group. For this purpose,
run the lsblk command:
In the output, for example, you may see:# lsblk | grep disk
In the example above, the system has two SCSI devices (that start with "sd"), called sda and sdb. Device sda is 60 GB, and device sdb is 5 TB.# lsblk | grep disk fd0 2:0 1 4K 0 disk sda 8:0 0 60G 0 disk sdb 8:16 0 5T 0 disk
Next, run this command:
It will provide you with a tree-like output showing all the disks available on the system, and any partitions (listed as "part") and logical volumes (listed as "lvm") configured on those disks. For the sake of this example, we'll assume that on device sdb there are no partitions and or logical volumes configured, and thus is available.# lsblk -a
Also, for the sake of this example, we'll assume that we'll want to set up a few file systems for an Oracle environment, called /u01, /u02, /u03, /u04 and /u05, and that we'll want to have these file systems configured within a volume group called "oracle".
List the volume groups already configured on the system:
Make sure there isn't already a volume group present that is called oracle.# vgs
Now, let's create a new volume group called oracle, using device sdb:
We can now use the "vgs" and "pvs" commands to list the volume groups and the physical volumes on the system. Note in the output that you now can see that a volume group called "oracle" is present, and that disk /dev/sdb is configured in volume group "oracle".# vgcreate oracle /dev/sdb Physical volume "/dev/sdb" successfully created. Volume group "oracle" successfully created
Now create the logical volumes. A logical volume is required for us to create the file systems in later on. We'll be creating the following logical volumes:
- u01lv of 100 GB for the use of the /u01 file system
- u02lv of 1.5 TB for the use of the /u02 file system
- u03lv of 1.5 TB for the use of the /u03 file system
- u04lv of 1.5 TB for the use of the /u04 file system
- u05lv of 300 GB for the use of the /u05 file system
Now it's time to create the file systems. We'll be using the standard XFS type of file system:# lvcreate -n u01lv -L 100G oracle # lvcreate -n u02lv -L 1.5T oracle # lvcreate -n u03lv -L 1.5T oracle # lvcreate -n u04lv -L 1.5T oracle # lvcreate -n u05lv -L 300G oracle # lvs | grep oracle u01lv oracle -wi-a----- 100.00g u02lv oracle -wi-a----- 1.50t u03lv oracle -wi-a----- 1.50t u04lv oracle -wi-a----- 1.50t u05lv oracle -wi-a----- 300.00g
And now that the file systems have been created on top of the logical volumes, we can mount the file systems. To ensure that file systems are mounted at the time that the system boots up, it's best to add the new file systems to file /etc/fstab. Add the following lines to that file:# mkfs.xfs /dev/oracle/u01lv # mkfs.xfs /dev/oracle/u02lv # mkfs.xfs /dev/oracle/u03lv # mkfs.xfs /dev/oracle/u04lv # mkfs.xfs /dev/oracle/u05lv
Make sure the folders of the mount points exist by creating them:/dev/oracle/u01lv /u01 xfs defaults,noatime 0 0 /dev/oracle/u02lv /u02 xfs defaults,noatime 0 0 /dev/oracle/u03lv /u03 xfs defaults,noatime 0 0 /dev/oracle/u04lv /u04 xfs defaults,noatime 0 0 /dev/oracle/u05lv /u05 xfs defaults,noatime 0 0
Now mount all the file systems at once:# mkdir /u01 # mkdir /u02 # mkdir /u03 # mkdir /u04 # mkdir /u05
And then verify that the file systems are indeed present:# mount -a
And that's it. The file systems have been created, and these file systems will persist during a system reboot.# df -h | grep u0 /dev/mapper/oracle-u01lv 100G 33M 100G 1% /u01 /dev/mapper/oracle-u02lv 1.5T 33M 1.5T 1% /u01 /dev/mapper/oracle-u03lv 1.5T 33M 1.5T 1% /u01 /dev/mapper/oracle-u04lv 1.5T 33M 1.5T 1% /u01 /dev/mapper/oracle-u05lv 300G 33M 300G 1% /u01
If you found this useful, here's more on the same topic(s) in our blog:
- Determining memory DIMMs for Linux systems
- Vpath commands
- Report the end result of a TSM backup
- BCV issue with Solution Enabler
- EMC PowerPath key installation
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?