Solved

How to increase the filesystem in Linux without adding more disk

Posted on 2014-03-05
6
769 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
[X]
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
6 Comments
 
LVL 78

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 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!!!
0
 
LVL 78

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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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 78

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

691 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