0

We have a CentOS server that has 2TB of disk. When we got the server for "god knows why" the partitions were like so:

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0  1.8T  0 disk 
├─sda1          8:1    0    2M  0 part 
├─sda2          8:2    0   28G  0 part /
├─sda3          8:3    0  9.3G  0 part [SWAP]
└─sda4          8:4    0  1.8T  0 part 
  ├─vg00-usr  253:0    0   20G  0 lvm  /usr
  ├─vg00-var  253:1    0   20G  0 lvm  /var
  └─vg00-home 253:2    0   15G  0 lvm  /home

What we really use is vg00-var, the rest I am not even sure what they do or why they exist. This being said sda4 has 1.8T associated to it and we want to move all the free space to vg00-var in a way that it wont disrupt the current site(s) that are sitting there.

I have checked a lot of posts but none seem to tackle this specific scenario (this being said I am no expert in this field).

Can someone please help?

Thank you.

  • Could you provide also: the filesystem type used by the various partitions, CentOS version and a "vgs" command output ? – Ouki May 20 at 11:33
  • My current feeling is that lvm free space should be moooore than enough to do whatever you want to do with /var ^^ – Ouki May 20 at 11:34
1
lvextend --resizefs --size 40g /dev/vg00/var

Chose a size a bit over expected use, from your capacity planning. Reducing a file system is much more difficult, impossible in fact for XFS.

This layout is actually rather sane. Data volume /var is on LVM to provide flexibility. Volume group space is mostly unallocated, allowing extend and create volumes without resizing LUNs or repartitioning.

| improve this answer | |
0

The "want to move all the free space" is a bit vague, but if what you mean is to give all the free size to /var, I would use vgs to show me the current allocatable free size on that vg00 volume group, and proceed with John's recommendation to perform an lvextend. You either specify the size you want the filesystem to be in the end (in John's sample, 40g), or if you want to add in stages, you can specify the additional size with a plus sign: +40g ..this will add 40g to the 20g, resulting on a 60g filesystem.

I also like John's use of a single command line, instead of splitting the commands in two (lvextend, and resize2fs).

When you are done, use vgs again to see how much space you now have available, and df /var to see the filesystem new size.

BTW, you need to be root to be able to run some of the above commands.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.