Increasing the size of a disk



  • As I am a relative newcomer to Linux administration, and most power users suffer from the curse of knowledge, occasionally I run across issues that are so trivial to the experts that it's difficult for me to find help for them. In case it would help someone else in the future, I thought I would post this particular one here.

    I use both Borzel's excellent XCP-ng Center as well as XOA to administer my systems, but in this case was using XOA. What I needed to do was increase the size of the disk being used by a VM running Ubuntu from 4GB to 24GB. Easy, right? I just change that in XOA and I'm done. Of course, that wasn't all there was to it, as the VM doesn't recognize the additional space.

    Thinking (in ignorance) that there was a problem with my XOA, I chatted with Jon in support. I'm sure he must be convinced that I'm an idiot, but he was kind enough to explain to me that there were additional steps involved to get the allocated space to be recognized by the VM. He suggested a couple of places to read up on this that didn't end up having what I needed, but I eventually found the correct procedure here:

    https://www.rootusers.com/lvm-resize-how-to-increase-an-lvm-partition/

    Hopefully that will be of assistance to someone else in the future.


  • Admin

    Basically, extending a virtual disk is like (if it were possible) extending a physical disk. It's the first step, but then you need to extend the filesystem.

    Obviously, extending the filesystem will depend on what you use: LVM, "regular" partitions, etc.



  • I have a much better understanding of how that works now, thank you Olivier. My compliments to Jon, once he overcame his surprise at how little I knew, he was kind enough to point me in the right direction.



  • @LEB-ID Thank you so much for posting this. I came here to create a new post for asking this exact thing. Not wanting to create a duplicate post, I tried searching "increase disk size". The aptly named topic of your post was the first thing that popped up. Much appreciated.



  • @LEB-ID said in Increasing the size of a disk:

    as the VM doesn't recognize the additional space.

    the same will be in any other hypervizor and operating system - you need to extend the partition by yourself. This issue is not about xcp/xoa at all. You need to dig the net and read about resizing partitions.

    About increasing disk size in case of windows is easy - you just go to the disk management and expand last partition to increase space. Easy. In linux for example debian its not that easy because debian often will create swap partition at the end of disk 😄 that a trap for resizing. Thus I always use swap in linux as a file like in windows.

    About ubuntu - launch gparted and look at the partition after CDI resize - will that be as easy like in windows?

    And I will advise You one thing - stop using LVM - go for thin storage.



  • Quite welcome, @mhrsolanki2020 . I am a frequent searcher for knowledge, so happy to be able to pass along something helpful.

    And @akurzawa , I'm aware it's not an issue with XCP/XOA, it was, as I said, my own ignorance. Just hoping to help other folks out in the future. Thank you for the advice about LVM, in this case it just happened to be what was originally running on the VM.


Log in to reply