How to increase the filesystem in Linux without adding more disk

Posted on 2014-03-05
Last Modified: 2014-03-08
How can I increase the filesystem from the following full filesystems. Please itemize every step like lvreduce from some fs and lvextend etc...

1. /dev/mapper/vg_maxmmcpd-lv_maxmmcpd_data
                       46G   43G  444M  99% /DEV/DB1maxmmcpd/data

2. /dev/mapper/vg_maxproto-lv_proto_data
                       50G   47G  8.0M 100% /DEV/DB2maxproto/data

                      210G   31G  169G  16% /DEV/DB2db1mmcpd/data
                      9.9G  3.2G  6.3G  34% /DEV/DB0maxmmcpd/redoctl
                       46G   43G  444M  99% /DEV/DB1maxmmcpd/data
                       50G   47G  8.0M 100% /DEV/DB2maxproto/data
                      9.9G  151M  9.2G   2% /DEV/DB1maxproto/archive
                      5.0G  3.1G  1.6G  67% /DEV/DB0maxproto/redoctl
Question by:oo_tatang
  • 3
  • 2
LVL 77

Expert Comment

ID: 39908391
You can use lvresize -L -20G from the 169GB partition

You can the allocate the space
lvresize -L +8G to the large partitions
Add some MB to the others.

If you do not resolve what the data is and how it grows, you will have to rebalance it in the bear future.

Make sure you have good backups just in case.
LVL 16

Expert Comment

by:Gerald Connolly
ID: 39908731
It would be a lot easier to add some more disk, i know thats an easy statement to make, not knowing your config or circumstances.

You could afford to move 120GB from your 210GB partition and add 30GB to your 4 big partitions and alleviate your space shortage.

But make sure you have a full backup before you do anything!!!
LVL 77

Expert Comment

ID: 39908935
You actually will have to shift data all the way up to the volume groups.

Lv shifting is within the same volume group.
Volume group space shifting can only be done within the same PV.
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

LVL 13

Accepted Solution

Daniel Helgenberger earned 500 total points
ID: 39909032
Please correct my assumptions:

You have two volume groups, vg_maxmmcpd and vg_maxproto.

You want to extent these LV's:

To make any other statements we need to know the number (if any) of free pysical extents in both volume groups. Please provide the output of vgdisplay, here an example. Look for 'Free PE / Size':
$ su -c 'vgdisplay'
  --- Volume group ---
  VG Name               vg_server
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               95,64 GiB
  PE Size               4,00 MiB
  Total PE              24485
  Alloc PE / Size       23205 / 90,64 GiB
  Free  PE / Size       1280 / 5,00 GiB
  VG UUID               6Pf6wX-WXzt-qyeV-WpKH-XmaZ-dzis-bjXPx0

Open in new window

If there are enough free PE's then you can extend your LV's on a running system with basically one command:

$ su -c 'lvextend --size +20GB --resizefs /dev/mapper/vg_maxmmcpd-lv_maxmmcpd_data'
$ su -c 'lvextend --size +20GB --resizefs /dev/mapper/vg_maxproto-lv_proto_data'

Open in new window

Note I: This is an example. It will only work if you have more then 20GB in free PE's on each volume group.

Note II: The '-r' / '--resizefs' option is very handy as it resizes the file system along with the LV. Depending on your lvm2 version, this option might not be available. The --resize does work both ways (extending / shrinking) but in case of shrinking the whole process cannot be done on a mounted filesystem; you need to unmount it first.

If you have none or not enough free physical extents in one or both volume groups, you need to shrink existing volumes. The following example will shift 5GB from vg_maxproto-lv_proto_archive to vg_maxproto-lv_proto_data, assuming there are no open file hanldes on /DEV/DB1maxproto/archive:
$ su -
# umount /DEV/DB1maxproto/archive
# lvextend --size -5GB --resizefs /dev/mapper/vg_maxproto-lv_proto_archive
# mount /DEV/DB1maxproto/archive
# lvextend --size +5GB --resizefs /dev/mapper/vg_maxproto-lv_proto_data

Open in new window

If this does not work, for instance you have not enough room in both your VG's, will be much more complicated. It means moving physical volumes (PV's) from one VG to another. This means a downtime, backup and so on.
It is much easier to add more disk space.
LVL 77

Expert Comment

ID: 39909622
Did not notice (looked too closely) it, but there are three Volume groups.
 The one Daniel listed and vg_db1mmcpd which has the 169GB  of currently Free space.
And this is the only LV on this VG.
The other LVs that are running out of space are on different groups.  Some on the same VG where there is an LV with 6.3GB of free space.  
vg_maxmmcpd-lv_maxmmcpd_data can be resized with free space from vg_maxmmcpd-lv_maxmmcpd_mgmt

The others, have to take space from vg_maxproto-lv_proto_archive that has 9.2GB

One option depending on where the 169GB is and its purpose, shuffling the partitions might be simpler.
Shrink the 210GB To the space you need it to be.80GB
add additional volumes larger than the large ones on the. i.e. a 50GB and 49GB create two  65gb partitions.

Make sure nothing is running as to not overwrite.
Then use find . | cpio to copy the data from the existing to the newly created.  Then remount the newly created in place where the old ones were.

The issue is that the original two 49/50GB are on two separate VG suggesting their on different "disks" with this change, you will concentrate all these presumably DATA partitions on the same "disks".  IF this system is high Input/Output (read/write to disks), the performance of the system could be impacted and not in a positive direction.
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39914926
The one Daniel listed and vg_db1mmcpd which has the 169GB  of currently Free space.
And this is the only LV on this VG.

Not necessarily without any more info, and my first statement was wrong - it should read three VG's. 'vg_db1mmcpd' might have some currently unmounted volumes (like snapshots).

However, if you do need to change the underlying PV's then you should move them to one volume group.
Different VG's on one physical system cause only trouble if you want to extend volumes and should IMHO only be used to separate different types of disks (like slow and fast) - though even there you can create LV's on any PV you like with lvcreate; lets assume /dev/sdd is a fast RAID LUN with 500GB and you want that as a special fast volume in your vg_database:
# pvcreate /dev/sdd
# vgextend vg_database /dev/sdd
# lvcreate -n lv_fastdisk -L 500GB vg_database /dev/sdd

Open in new window


Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Squid Connection Pools 3 68
AWS CLI - Issue with name display 2 72
Linux hostname change 2 71
VLC Video Player No Longer Works after installing HandBrake, Fedora 25 5 205
Fine Tune your automatic Updates for Ubuntu / Debian
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question