Difference between revisions of "HowTo Resize The "root" File System Using LVM"
(→Initialize Disk or Disk Partition for LVM Usage) |
(→Initialize Disk or Disk Partition for LVM Usage) |
||
Line 42: | Line 42: | ||
dd if=/dev/zero of=/dev/sdb bs=512 count=1 | dd if=/dev/zero of=/dev/sdb bs=512 count=1 | ||
− | We will use the entire disk (/dev/sdb) for LVM using the following '''pvcreate''' command: | + | We will use the entire disk (/dev/sdb) for LVM using the following '''pvcreate''' command to initialize a Physical Volume: |
pvcreate /dev/sdb; | pvcreate /dev/sdb; | ||
+ | |||
+ | == Add the Physical Volume To An Existing Volume Group == | ||
+ | We will now add the newly created Physical Volume: '''/dev/sdb''' to the '''nst22''' Volume Group. | ||
+ | |||
+ | vgextend 'nst22' /dev/sdb |
Revision as of 09:03, 26 May 2016
Contents
Overview
This page demonstrates how to resize the root file system by increasing it's size by 2GB using the Logical Volume Manager (LVM). This will be done without rebooting the NST system. The follow environment exists:
- The root file system is under LVM control shown using the System Storage Manager (ssm):
[root@nst22 ~]# ssm list; ----------------------------------------------------------- Device Free Used Total Pool Mount point ----------------------------------------------------------- /dev/sda 20.00 GB PARTITIONED /dev/sda1 500.00 MB /boot /dev/sda2 0.00 KB 19.51 GB 19.51 GB nst22 ----------------------------------------------------------- ------------------------------------------------- Pool Type Devices Free Used Total ------------------------------------------------- nst22 lvm 2 2.00 GB 19.51 GB 21.50 GB ------------------------------------------------- ------------------------------------------------------------------------------------ Volume Pool Volume size FS FS size Free Type Mount point ------------------------------------------------------------------------------------ /dev/nst22/root nst22 17.51 GB xfs 17.50 GB 5.88 GB linear / /dev/nst22/swap nst22 2.00 GB linear /dev/sda1 500.00 MB ext4 500.00 MB 288.89 MB part /boot ------------------------------------------------------------------------------------
- The root file sytem is of type xfs
[root@nst22 ~]# mount | grep root; /dev/mapper/nst22-root on / type xfs (rw,relatime,attr2,inode64,noquota)
Demonstration
We will now show a sequence of commands to accomplish resizing the root file system by 2GB. Our NST system is a Virtual Machine (VM) running under the VMware Fusion Hypervisor. Behind the scenes we created a new virtual disk of size 2GB (/dev/sdb). On a physical system we could of used a whole disk or a disk partition for this demonstration.
The root file system size is currently 17.50GB. Our goal is to increase the root file system to a total of 19.50GB.
Initialize Disk or Disk Partition for LVM Usage
One can either us a whole disk or a disk partion for LVM:
- To use a disk partition: Use a partition tool (fdisk, cfdisk, gparted, etc...) to create the disk partition for LVM.
- To use the whole disk: Make sure the partition table is cleared out:
dd if=/dev/zero of=/dev/sdb bs=512 count=1
We will use the entire disk (/dev/sdb) for LVM using the following pvcreate command to initialize a Physical Volume:
pvcreate /dev/sdb;
Add the Physical Volume To An Existing Volume Group
We will now add the newly created Physical Volume: /dev/sdb to the nst22 Volume Group.
vgextend 'nst22' /dev/sdb