[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


How to increase the filesystem in Linux without adding more disk

Posted on 2014-03-05
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 80

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 17

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 80

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.
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

LVL 13

Accepted Solution

Daniel Helgenberger earned 2000 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 80

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

649 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