growing root partition

From cpwiki.net
Jump to: navigation, search
Check Point Profressional Services

Problem

insufficient disk space in /opt to apply an upgrade.

O.S. : secure platform (splat) or gaia

Check Point versions: multiple


Solution

Use available, unallocated disk space. Newer Check Point version use LVM. Check Point often doesn't allocate it all. This not a bad thing. It is a common, best practice with LVM. This allows admins to easily grow partitions as needed using the free disk space. If you allocated it all up front, but needed one partition bigger, you would have to shrink one to grow another. This is more complicated. With root, it can't be shrunk while the system is running(it can be grown as we are about to see).

Example

[Expert@chkpfw1:0]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_splat-lv_current
                     4.9G  3.6G  1.1G  77% /         <<< root does't have enough space for my 77.30 upgrade :(
/dev/hda1             289M   24M  251M   9% /boot
tmpfs                 217M     0  217M   0% /dev/shm
/dev/mapper/vg_splat-lv_log
                     6.8G  3.7G  2.9G  57% /var/log


Check the volumn groups for Free space

[Expert@chkpfw2:0]# vgdisplay | grep -i size
 VG Size               18.69 GB
 PE Size               32.00 MB
 Alloc PE / Size       384 / 12.00 GB
 Free  PE / Size       214 / 6.69 GB   <<< yay! I have some!

adding/growing the logical volume "container"

[Expert@chkpfw2:0]# lvresize -L +6.69GB vg_splat/lv_current
 Rounding up size to full physical extent 6.72 GB
 Extending logical volume lv_current to 11.72 GB
 Insufficient free space: 215 extents needed, but only 214 available

that failed... specifying the increase in GB is less precise. So, lets use "extents"

[Expert@chkpfw2:0]# lvresize -l +214 vg_splat/lv_current
 Extending logical volume lv_current to 11.69 GB
 Logical volume lv_current successfully resized

verifying new volume group size

[Expert@chkpfw2:0]# vgdisplay | grep -i -E "name|size"
 VG Name               vg_splat
 VG Size               18.69 GB
 PE Size               32.00 MB
 Alloc PE / Size       598 / 18.69 GB
 Free  PE / Size       0 / 0

growing the file system to fill the "container"

[Expert@chkpfw2:0]# resize2fs /dev/mapper/vg_splat-lv_current
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/vg_splat-lv_current is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mapper/vg_splat-lv_current to 3063808 (4k) blocks.
The filesystem on /dev/mapper/vg_splat-lv_current is now 3063808 blocks long.

viewing newly allocated disk space

[Expert@chkpfw2:0]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_splat-lv_current
                      12G  3.6G  7.2G  33% /
/dev/hda1             289M   24M  251M   9% /boot
tmpfs                 217M     0  217M   0% /dev/shm
/dev/mapper/vg_splat-lv_log
                     6.8G  2.2G  4.3G  34% /var/log

So, we grew root while the system had it mounted and was running from it. Thank you LVM!