LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is there a way to use the Free Space on Parted "Print Free" to extend root partition? (https://www.linuxquestions.org/questions/linux-newbie-8/is-there-a-way-to-use-the-free-space-on-parted-print-free-to-extend-root-partition-4175603570/)

Kenince 04-10-2017 10:06 AM

Is there a way to use the Free Space on Parted "Print Free" to extend root partition?
 
Hello Experts,

My root partition is running low on space but using parted, I see that I have 10GB of free space on my disk. Is there a way I can use it to extend the root partition?

My setup is as below:

df -h

Code:


[root@srvr-dev ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      6.9G  5.6G  972M  86% /
tmpfs                127G  46G  81G  36% /dev/shm
/dev/xvda1            243M  75M  156M  33% /boot
/dev/mapper/VolGroup00-LogVol02
                      97M  5.6M  87M  7% /shared_agent_instance_home
/dev/mapper/VolGroup01-LogVol00
                      349G  105G  226G  32% /u01

When I run "fdisk -l" I get...

Code:

[root@srvr-dev ~]# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c520c

    Device Boot      Start        End      Blocks  Id  System
/dev/xvda1  *          1          32      256000  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2              32        1305    10223616  8e  Linux LVM

Disk /dev/xvdb: 408.0 GB, 408021893120 bytes
255 heads, 63 sectors/track, 49605 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009e5e9

    Device Boot      Start        End      Blocks  Id  System
/dev/xvdb1              1      46200  371093750  83  Linux

Disk /dev/mapper/VolGroup00-LogVol01: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup00-LogVol00: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup01-LogVol00: 380.0 GB, 379995553792 bytes
255 heads, 63 sectors/track, 46198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup00-LogVol02: 104 MB, 104857600 bytes
255 heads, 63 sectors/track, 12 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

on parted I get...

Code:

[root@srvr-dev ~]# parted
GNU Parted 2.1
Using /dev/mapper/VolGroup00-LogVol02
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/xvda
Using /dev/xvda
(parted) print free
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End    Size    Type    File system  Flags
        32.3kB  1049kB  1016kB          Free Space
 1      1049kB  263MB  262MB  primary  ext4        boot
 2      263MB  10.7GB  10.5GB  primary              lvm
        10.7GB  21.5GB  10.7GB          Free Space

At the moment I am unable to install any package, the repo fills up the remaining 1GB on the root partition and all my systems hang.

Thanks in advance.

rtmistler 04-10-2017 10:31 AM

I would recommend you try gparted which will give you a UI based interface to do this. And yes, unpartitioned space can be added to an existing partition.

Kenince 04-10-2017 11:29 AM

@rtmistler,

Thanks for your response.

Unfortunately, I am not in a position to run the g-parted live CD on this server (It's a VM on exalytics). Trying to install gparted as an application failed because I can't install any package on the server before it fills up the root partition.

Is there a way I can do this with fdisk or with parted?

crazyhawk 04-10-2017 03:21 PM

Resizing partitions is possible in general, but I'm not sure if/how it works together with LVM. So just to be sure, you could use the partitioning tool of your choice (I use cfdisk when I can't use gparted, but fdisk or parted should work as well) to create one or more partitions from the free space, and then add them to the LVM you have setup.

I quite like this LVM howto: https://www.howtoforge.com/linux_lvm

crazyhawk 04-10-2017 03:24 PM

Tweaking the system you are running might not be the best idea ever though.. Doesn't exalytics have some admin tools you can access from a web browser or something?

syg00 04-10-2017 05:31 PM

This is exactly what LVM was invented for. You need to use LVM commands to see how much space is available in your current environment
Code:

vgs
lvs

This may show you have some unallocated space in the vg you can use immediately. For the free space, you need to create a partition out of that, then make that a (LVM) pv, add that to the VolGroup00, then extend the root lv.
Best guide I know of is the LVM admin guide from Redhat - you may need to consider the RHEL6 version instead, but commands at this level haven't changed.


All times are GMT -5. The time now is 05:54 PM.