Solved

How to increase the filesystem in Linux without adding more disk

Posted on 2014-03-05
6
729 Views
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

/dev/mapper/vg_db1mmcpd-lv_db1mmcpd_data
                      210G   31G  169G  16% /DEV/DB2db1mmcpd/data
/dev/mapper/vg_maxmmcpd-lv_maxmmcpd_mgmt
                      9.9G  3.2G  6.3G  34% /DEV/DB0maxmmcpd/redoctl
/dev/mapper/vg_maxmmcpd-lv_maxmmcpd_data
                       46G   43G  444M  99% /DEV/DB1maxmmcpd/data
/dev/mapper/vg_maxproto-lv_proto_data
                       50G   47G  8.0M 100% /DEV/DB2maxproto/data
/dev/mapper/vg_maxproto-lv_proto_archive
                      9.9G  151M  9.2G   2% /DEV/DB1maxproto/archive
/dev/mapper/vg_maxproto-lv_proto_redo
                      5.0G  3.1G  1.6G  67% /DEV/DB0maxproto/redoctl
0
Comment
Question by:oo_tatang
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:arnold
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.
0
 
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!!!
0
 
LVL 76

Expert Comment

by:arnold
ID: 39908935
You actually will have to shift data all the way up to the volume groups.
Pvdisplay
Vgdisplay
Lvdisplay.

Lv shifting is within the same volume group.
Volume group space shifting can only be done within the same PV.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 13

Accepted Solution

by:
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:
vg_maxmmcpd-lv_maxmmcpd_data
vg_maxproto-lv_proto_data


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.
0
 
LVL 76

Expert Comment

by:arnold
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.
0
 
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

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now