I recently installed Ubuntu 19.04 and allocated 50 GB of the SSD to Ubuntu using LVM; the remaining 190 GB is not allocated to a partition. Now I use programs consuming a lot of RAM, such as Android Studio and other developer tools which take up space. Can I store and run those programs, by placing them in the free space, or if there is a method to extend the Ubuntu partition size without going through the whole installation process?
I'll start by saying that you should have good backups before doing any manipulation of your partitions and filesystems.
Since you used LVM during the install, you can grow the size of your current 50GB Logical Volume (LV).
Start by making a new partition of the size that you want to grow by, in the free space. You can use fdisk or gdisk from the terminal for this.
Next you'll use the
pvcreate command on the new partition to create a new physical volume (PV).
vgextend to add the new PV to your existing Volume Group (VG). Use
vgdisplay to see existing VGs.
Now there are more physical extents available within your VG that can be allocated to LVs. Use
lvextend to do this.
Finally, the "container" of your filesystem is now larger but you need to grow your existing filesystem to fill the now larger LV. If you used ext4, use
resize2fs and if you used xfs you'll instead use
You have a few options, but you seem to be asking about two things (heavy RAM usage, and file storage). I will address both.
Not enough RAM
If you don't have enough RAM, then adding a swap partition can help (you can also use a swap file, but partition is (I think) more efficient. Use gparted program, to add a swap partition.
More space for files
You can extend the current partition, or add a new partition. There are advantages to each strategy.
- With more partitions there is more opportunity to wast space (In the future these may be free space on the wrong partition), however there are ways to deal with this.
- Having a separate root and home partition, makes it easier to manage, when you upgrade the Operating System. You don't have to change the home partition.
- Adding a partition to the free space can be done easily (with gparted program).
- Resizing / extending a partition requires you to take it off-line, so for the root partition you will have to shutdown and use a live OS (boot from USB or CD, the gparted program, in the gparted distro is a good for this job).
- If you add a new partition, you way want to move all of the /home into it, and then mount it over /home.
I found out that Ubuntu offers an option to resize the partition size on disks. I could hence do it and upgrade my partition size to 150 gb