Monday 27 October 2014

Increasing Space on Linux File System

Increasing Space on Linux File System


Add the harddisk

Login as root user

Determine the partitions available.

cat /proc/partitions
ls /dev/sd*

Some commands that can be used to find the disk details areas below


lsblk -a
sudo fdisk -l
fdisk -l | grep dev
findmnt
blkid
blkid -o list

You can list types of partitions with parted:

sudo parted /dev/sda print



Begin the repartitioning process using fdisk.

fdisk /dev/sdc

The sequence of answers is "n", "p", "1", "Return", "Return" and "w".

view the current physical volumes defined on the system.

pvdisplay

Use the pvcreate command to initialize the partition we created earlier as a physical volume. Type

pvcreate /dev/sdc1


use the vgdisplay command to view the current volume groups that might exist on your system.

vgdisplay

Assign the PV to the volume group using the vgextend command

vgextend vg_oracle12c /dev/sdc1

Now that we have some room in the VG

view the current LVs on the system

lvdisplay | less

The following command extends the logical volumne /dev/myvg/homevol to 12 gigabytes.

# lvextend -L12G /dev/myvg/homevol

The following command adds another gigabyte to the logical volume /dev/myvg/homevol.

# lvextend -L+1G /dev/myvg/homevol

The following command extends the logical volume called testlv to fill all of the unallocated space in the volume group myvg.

# lvextend -l +100%FREE /dev/myvg/testlv

lvextend -L+12280m /dev/vg_oracle12c/lv_root

Resize the partition using resize2fs to the maximum

resize2fs /dev/mapper/vg_oracle12c-lv_root

Set the size of the mount point to which the size should be increased. To Increase the total size of the File system to 40 GB type:

resize2fs /dev/mapper/vg_oracle12c-lv_root 40G



Deleting the partition

fdisk /dev/sdb

The sequence of answers is "d", "p", "w"

 

-----------------------------------------------------------------------------------------
How to Extending the Swap space 

swap resides on logical volume lv_swap which in part of a volume group. The next step is to verify if there is any space available on the volume group that can be allocated to swap volume:
use the below command to find the free space available on volume group.

#vgs

If the amount of space available is sufficient to meet additional swap requirements, turn off the swap and extend the swap logical volume to use the additional space:

#swapoff /dev/vg_orcl/lv_swap

To add 3GB to existing space:

#lvextend -L +3GB /dev/vg_orcl/lv_swap

To resize the space to 6.5GB:

lvextend -L6.5GB /dev/vg_orcl/lv_swap

Next, reformat the swap volume and turn the swap back on:

# mkswap /dev/vg_orcl/lv_swap

# swapon /dev/vg_orcl/lv_swap

Having made the changes, check that the swap space as increased:

# swapon -s


 

No comments:

Post a Comment