Solution for growing / extending your Linux filesystem (Fedora 29)

Discussion in 'Linux Virtual Machine' started by DavidW36, Nov 20, 2018.

  1. DavidW36

    DavidW36 Bit poster

    Messages:
    3
    I ran into a problem I'm sure most people have dealt with: what to do when you didn't initially create a big enough virtual hard disk, and you're running out of space. Well, just using the Parallels configuration to increase the disk capacity wasn't enough, because Fedora doesn't automatically resize itself to fit. So, this is what I had to do. Be aware that this was done with the most recent version of Fedora, and might be different based on other Linux distributions. Also, you have to read the referenced URLs below very carefully or you could really mess up your VM.

    First, here are the reference articles that helped me the most. Read them carefully.
    [1] https://www.tecmint.com/extend-and-reduce-lvms-in-linux/
    [2] https://access.redhat.com/documenta...x/6/html/storage_administration_guide/xfsgrow

    These are the steps I took:
    1. Shut down your VM
    2. Parallels > (configuration) > Hardware > Hard Disk > Advanced Settings > Properties > (increase to desired size) > [x] Expanding disk
    3. Start up your VM
    4. Install the partition management tool "gparted": sudo dnf install gparted
    5. Run it: sudo gparted
    6. You should see the newly available space. Drag your (in my case, root) filesystem to the right to take up all the newly available space.
    7. Save your changes: Edit > Apply all operations
    8. At this point, Linux now has the new space free, but it isn't available (assigned) yet.
    9. Use the instructions for "Logical Volume Extending" in link [1] as a reference, as the following instructions are just examples, and your command arguments will differ.
    10. Use the vgs, pvscan, lvdisplay, and vgdisplay commands to collect the necessary information, per the above, so you know what your command arguments will be.
    11. Use the lvextend command to extend your filesystem. This can be done on a mounted filesystem - you just don't want to shrink a mounted filesystem. As an example, I executed this: lvextend -l +28142 /dev/fedora_imac-osx-plls-fedora29/root
    12. Now you have to resize the filesystem to fit the extension. Do not use the resize2fs command as described in [1] if your filesystem is xfs, which mine was (and probably is for most Parallels Linux guest OS cases).
    13. Instead, resize using the xfs_growfs command mentioned in link [2], which can also be done on a mounted filesystem. Since I extended my root volume, my command was simply: xfs_growfs /
    14. Restart your VM (Probably not necessary, but I did this.)
    15. At this point doing a df -h shows that Linux now recognizes and can use the new space, as does viewing (in Linux): Settings > Details > About
    Hope this helps people. I spent a long time pulling my hair out on this, and even opened up a support ticket for it. However, spending a little more time on it, I was able to figure it out.
     

Share This Page