Ubuntu partitioning


New Member
May 24, 2019
Reaction score
Hi ,
I am new to linux . I have installed Ubuntu 19.04 in my laptop. I have manually partitioned the disks.
My HDD is having some unallocated space now. How can i partition the rest of the unallocated space on the HDD and do LVM configurations using Terminal commands
Below shows my disk partition

sudo parted /dev/sda print free

Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 1024MB 1023MB primary ext4 boot
1024MB 1026MB 1048kB Free Space
2 1026MB 112GB 111GB extended
5 1026MB 25,9GB 24,9GB logical ext4
6 25,9GB 48,3GB 22,4GB logical ext4
7 48,3GB 110GB 61,7GB logical ext4
8 110GB 112GB 2047MB logical linux-swap(v1)
3 112GB 145GB 33,1GB primary ext4
145GB 250GB 105GB Free Space

I want to partition the free space of 145GB as Primary and to configure LVM , using commandline

Hope I get help !! Thanks

If you want to expand your root partition you have to boot the live-USB you used to install Ubuntu. Then you have to search for a program called gparted. Open it, unmount the great partition in the middle, right klick on it -> resize and move - > take the partition on the right side and pull it to the maximum.
Press resize and move and then press the little hook to continue.
Partition Table: msdos
Hi @Sharonjose, and welcome. For future reference, if you have to re-do your entire hard drive, I would suggest that you would probably be better off to use a gpt partition table instead of msdos. The old msdos partition table structure only allows 4 primary partitions while gpt will allow (at least) 128 primary partitions. This is why you have so many logical partitions inside an extended partition. It seems that you are still okay right now since you don't seem to have Windows on your system taking up more primary spots.

Number Start End Size Type File system Flags
145GB 250GB 105GB Free Space
I'm not very familiar with the output you're showing us, but I don't think you have 145GB of free space, as you indicate. If I'm reading the output correctly, your free space begins at about the 145GB mark of your hard drive and continues to the 250GB mark (the end of the drive). 250-145=105GB of free space.

I understand that you want to create a new LVM partition/filesystem using the command line instead of gparted or other tools. I think you can do this, but I am not at all familiar with LVM. It is usually configured when installing a Linux distro, but I would guess that what you are asking can be done. I will try to research Google a little to see if I can help you more, or perhaps someone with better knowledge will jump in.

A word of caution: always backup up important data from your hard drive to another media (DVD, USB, cloud) before attempting to make major partition changes. Making a mistake from the command line can be very unforgiving! :eek:

There may be a problem using gpt partition-table with legacy bios.
Good point, @Peer! I have no experience with LVM, and I found on Google that I'm not going to get much smarter anytime soon. It is a very different system of managing disks and quite confusing to me. :confused::eek::D

So, when knowledge fails me, I will try anything on a spare computer... not afraid to break things. I have a legacy BIOS desktop and I booted a live Linux USB and ran Gparted to erase the hard disk and make it a GPT partition table. I formatted the disk as ext4, and there were no problems at this point.

Then I booted on a live Fedora 30 USB (the latest version of Fedora) because I know that distro favors LVM. It wouldn't install at first because there was no free space (formatted ext4 as I said above). So, I deleted the ext4 partition... but it was still set for GPT. I allowed the installer to run automatically, but it did tell me what it was doing.... using LVM, as I expected, but it also removed the GPT table and put the hard disk back to MBR (msdos) before installing. I am not sure why it needed to do that. Maybe @wizardfromoz will know more details about this.

@Sharonjose, we typically advise new Linux users not to use LVM, and this experiment helps to validate that advice. LVM is a different system, and not necessarily very friendly to newcomers (or old geezers like me). But still, you may well understand it better and prefer it... I can't judge that. Hopefully someone else will be able to guide you better and determine if you can (easily) use that free space for LVM, or not. Good luck!

So... I was right.
Legacy needs msdos and uefi gpt
So... I was right.
Legacy needs msdos and uefi gpt
Well, not quite, Young Wizard! :D I just erased Fedora, put the partition table back to GPT, and installed Linux Mint 19.1 (MATE). It is now up and running smoothly, and it is still using GPT. And again, this is a legacy BIOS desktop (2009)... UEFI is not available. I'm sure the Old Wizard (@wizardfromoz) can explain why this works.

Sorry, Chris... I mean "Old" in the nice way. :eek::eek::D:D

I have to go out for a bit but will be back (Aged Wizard hobbles off and disappears in a puff of smoke)
I have installed Ubuntu 19.04 in my laptop.
@Sharonjose, since you are rather new to Linux, you may also not be aware how Ubuntu versions work. The 19.04 that you installed is a "short term release"... meaning it has a very short life cycle of 9 months, and support for it ends in January 2020. The "19.04" means it was released in April 2019. There should be an upgrade path to the next new release, but it's something to keep in mind because your current system will stop receiving updates. We try to encourage new users to install "LTS" versions, which are "Long Term Support." The newest LTS Ubuntu is 18.04 (released April 2018) and it's life cycle is good through April 2023. Here's a chart showing Ubuntu's expected release cycles. Mostly mentioning this in case you do get into a position where you want to start over with your whole computer layout in order to more easily achieve a LVM system... if you do, you might choose the LTS Ubuntu 18.04 instead.

I'm still poking around the web looking at LVM. I have found that a LVM "pv" (physical volume) can use both a MBR or a GPT partition. That's encouraging, at least, but I don't know why my Fedora experiment failed to use GPT earlier. Again, LVM seems to be quite a complex system to set up, but if you learn it, I think it will be a very versatile method of disk management. Let me point you to a couple of websites that appear to be very good references for you to examine:

Arch Wiki: https://wiki.archlinux.org/index.php/LVM

HowToGeek: https://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/


Staff online

Members online