How to add new disk partition for Oracle Linux

I'm just installing Oracle Linux on VMware. I need to know how do I create new disk partition for Linux ? any guideline here ?

Who is Participating?
In my notes, I used to an if statement to check if the volume is present first. Add to fstab and mount it at the end.

mkdir /opt/oracle
mkdir /opt/orahome
shortname=`uname -n`
fdisk -lu $disk2 | grep -P "^Disk\s+\/dev\/sdb:"
if [ $? -eq 0 ]
	echo "$disk2 found"
mkdir /opt/apps
pvcreate /dev/sdb
vgcreate vg_$shortname /dev/sdb
lvcreate -vL +5G -n LogVol01 vg_$shortname
lvcreate -vl 100%FREE -n LogVol02 vg_$shortname
mkfs -t ext4 /dev/vg_$shortname/LogVol01 && echo /dev/vg_$shortname/LogVol01 /opt/oracle ext4 defaults,acl 1 2 >> /etc/fstab
mkfs -t ext4 /dev/vg_$shortname/LogVol02 && echo /dev/vg_$shortname/LogVol02 /opt/orahome ext4 defaults,acl 1 2 >> /etc/fstab
mount -a

Open in new window

use pvdisplay, vgdisplay, lvdisplay those will give you information on what your system currently has.
lvcreate is the command you will need to use provided the VolumeGroup you have which is returned/listed when you run vgdisplay has avaliable space

lvcreate -L <size_of_partition>G -n <name of LogicalVolume> <name of volume group  where this logical volume should be created. In your df -h it is VolGroup>
Once you do this you will have a /dev/mapper/VolGroup-<name of LogicalVolume>
you can then use mkfs.<file system type that you want> /dev/mapper/VolGroup-<name of LogicalVolume>
One the filesystem is creted on the newly created LogicalVolume, you can mount it where you want it
mount -t <file system type> /dev/mapper/VolGroup-<name of LogicalVolume> /<mount point>

not if you plan on overlaying an existing partition, you must first copy the data
mount <new logicalvolume> /mnt/test
cd /<location to be overlayed>
find . | cpio -pdvmu /mnt/test (this will clone the data including inodes)

if you provide more detail on what you actually want to achieve ..... response will be more precise to what you need/want to end up with.
looks like you've used the default 20GB disk option in VMWare, if there is enough space on the root volume you could just put it in there under it's own directory (or whatever the doc say), you dont necessarily have to create another partition as such.

however, if you do then you may need to reduce the amount of space used on root which will be time consuming or just add another disk in VMWare and then use vgcreate et al to create your partition, for example. (you can change this to suit your own needs, I'm not saying this is exactly what you want/need, check the docs for Oracle for recommendations)

fdisk /dev/sdb1
# Create a single partition here for the whole disk, make sure the partition type is 8e.

pvcreate /dev/sdb1 (or whatever is the new disk)
vgcreate oracle /dev/sdb1
lvcreate -n oraapp -L <size>G /dev/oracle
lvcreate -n oradata -L <size>G /dev/oracle
mkfs.ext3 /dev/oracle/oraapp
mkfs.ext3 /dev/oracle/oradata
mkdir -p /opt/oracle
mount /dev/oracle/oraapp /opt/oracle
mkdir -p /oradata
mount /dev/oracle/oradata /oradata
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.