1

When I first created this virtual server with VMWare it was 16G, but that has proven to be insufficient space. So I recently resized it with GParted to 32G using the Live CD. Judging by the results using lsblk in the screenshot below it resized correctly, however, I still need to resize the active partition and I'm not sure how to do that. I would imagine that there has to be some unformatted space somewhere, but I don't see it.

Current Partition Info

What would be the best way to increase the active partition size so it uses the other 16G? The biggest hurdle searching for answers is my insufficient knowledge of Linux partitions leading to results that don't help much.

What is it specifically that I need to do? Resize the partition that's currently 14.8G? Where will the free space come from? Does unallocated/unformatted space not display with lsblk? Even some help using the proper terminology would be awesome so I can get better results.

A command line solution would be highly preferable to one that uses GParted, if possible, because using the Live CD requires the help of a guy that already has too much on his plate. My other option at this point is to go back and reinstall the server onto a new partition set to 32G from the outset, but then I would have to go and set up the server again from scratch and that's time-consuming.

  • Can you post the output of fdisk -l /dev/sda? – Josip Rodin Jun 18 '15 at 21:03
  • 2
    Please post text as text, not pictures. – ctrl-alt-delor Jun 18 '15 at 21:28
  • Terminology: magento--db--vg-root is the root partition. There is no “the active partition”. There can be active partitions, these are partitions that are currently active. – ctrl-alt-delor Jun 18 '15 at 21:31
  • Output from fdisk: codepen.io/Realto619/pen/qdPRBE – user3561924 Jun 18 '15 at 23:57
  • @richard Yeah, my bad. I thought about it before I even saw your comment eliciting an internal "D'oh!". It's hard to get Windows off the brain at times since I don't deal with Linux very often or as much as I did at one time. Need to get the brain thinking in those terms again because we switched the main website at work to Magento and I need a platform to develop for it, which is what brought me here to begin with... – user3561924 Jun 19 '15 at 0:05
0

You are using LVM2 (Logical Volume Manager). It manages the space of your sda5 partition. It splits your partition (=physical volume) into several (root and swap_1) logical volumes. The physical volume has a size of 31.8G (try command pvs). Your logical volume which resides inside the physical volume has a size of 14.8G (try command lvs). So there is free space to increase the size of your root volume.

What to do:
First you use lvextend to increase the size of your logical volume named magento--db--vg-root. Then you can use resize2fs to extend the volume's filesystem to the volume's new size.

Example:
1. Increase size of volume by 10G: (10G is just an example, use whatever fits your needs)

lvextend -L +10G /dev/mapper/magento--db--vg-root

2. Adapt size of filesystem:

resize2fs /dev/mapper/magento--db--vg-root

Warning: Make sure you are using lvextend -L +[...] with the PLUS sign. Without the PLUS sign you will possibly truncate your volume and lose data. See the man page for that:

-L, --size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE] Extend or set the logical volume size in units of megabytes. A size suffix of M for megabytes, G for gigabytes, T for ter- abytes, P for petabytes or E for exabytes is optional. With the + sign the value is added to the actual size of the logical vol- ume and without it, the value is taken as an absolute one.

Remark: Without further arguments resize2fs extends the filesystem to the size of the underlying volume. This all can be done online (with mounted filesystem).

  • Well played! It had been bugging me because I was thinking that I should have been able to figure out how to do this, but after seeing your solution I don't feel that way any longer. In all the searches that I did, I don't believe using lvextend ever came up. If I had sufficient reputation, I also would have voted up your answer. – user3561924 Jun 19 '15 at 10:20
  • If I may ask, why only 10G? There's still another 6G available from what I can tell. Can I repeat the same two commands and use +6G this time to use the remaining free space or is there a reason I might want to keep that space freed up? – user3561924 Jun 19 '15 at 10:28
  • (see Edit) You can choose an arbitrary value; +10G was just for illustration. The commands can be used multiple times. You don't need to keep some space unassigned free. But maybe it's wise the have a reserve. – bidifx Jun 19 '15 at 11:15

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.