Operating System - Linux
1753424 Members
4508 Online
108793 Solutions
New Discussion юеВ

Re: Expand Linux Partition.

 
varian_1
Advisor

Expand Linux Partition.

Hi,

I have Linux Mail server, the mail box partition is running out of space. I have added the new LUN to this partition using concatenation, but please let us know how to expand partition from OS side.

Thanks & Regards

Walter
6 REPLIES 6
Van den Broeck Tijl
Valued Contributor

Re: Expand Linux Partition.

I sure hope you are using LVM and not plain partitions.

Expanding with an LVM is easy:
- Add LUN to box.
- Verify box has seen the new LUN (ie. dmesg and logs)
- pvcreate /dev/disk/
- vgextend /dev/disk/
- now use lvextend to extend your data partitions, for example, to add 20G: lvextend -L +20G /dev/disk/vgsan/maildata
- depending upon the filesystem & distribution(actually the version & config of mke2fs and kernel (>= 2.6.12) is important) used, you can use online or offline resizing. For offline resizing you'll need to stop your mailsoftware & umount the /dev/vgsan/maildata device
* Online ReiserFS 3.6: resize_reiserfs /dev/vgsan/maildata
* Online Ext3: resize2fs /dev/vgsan/maildata (this Ext3 option is very dependant upon your distribution, wheter the original filesystem was created with the necessary online resize options: sparse_super,filetype,resize_inode)
* ext2resize also exists, but afaik it is going end of life, use the replacement from e2fsprogs: resize2fs.
* Offline Ext2/3: just run resize2fs /dev/vgsan/maildata
Ivan Ferreira
Honored Contributor

Re: Expand Linux Partition.

>>> I have added the new LUN to this partition using concatenation

Are you using a hardware RAID, MD devices (mdadm-raidtools) or LVM?

Can you post the output of:

fdisk -l
df
vgdisplay -v

And the name of the file system that you want to extend.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Patrick Terlisten
Honored Contributor

Re: Expand Linux Partition.

Hell Walter,

as Ivan already wrote we need some additional informations about you're enviroment.

There are different ways. If you're not using LVM, but RAID Controllers with local disks, you can try to expand the array. Then you can expand the filesystem. Remember: The free space after expanding an array is at the end of the disk. So if you're filesystem is not the last parition on that array, you can't expand it.

The most filesystems that you can use with linux can be extended, some online, some offline. I always try to do this kind of work in a maintenance window with a tested backup in my back. ;)

Best regards,
Patrick
Best regards,
Patrick
varian_1
Advisor

Re: Expand Linux Partition.

Hi All,

Thanks for the reply, I do not have LVM but has RAID configured, also I found on net that "resiz2fs" is good command to expand the partition.

Please let us know is it the only command or is there any other alternative good command ?

Thanks & Regards

Walter
Patrick Terlisten
Honored Contributor

Re: Expand Linux Partition.

Hello Walter,

if you're using an RAID Controller, you can expand the array with additional disks. After that check the new size of the logical drive with fdisk. The command resize2fs is only for ext2/3.

Before you can resize, you should unmount the volume and check it with fsck. After that you can resize it. Check the manpage of resize2fs.

Best regards,
Patrick
Best regards,
Patrick
Vitaly Karasik_1
Honored Contributor

Re: Expand Linux Partition.

In many cases I'll suggest to add new partition and mount it as /var or /home instead of increasing existing "/" partition.
What is your current partitioning scheme?
Can you send us "mount" and "du / | sort -rn | head -20" output?