10

Recently; I did my first steps concerning Ubuntu and Ubuntu Server. For other Problems, there were good ways of trobleshooting but in this case I found nothing.

I installed Ubuntu Server on an old PC with a 1TB HDD. Previously, there was MINT installed but during the installation I wanted to overwrite this. Now I just have a 200 GB Partition. When I search for the disk, it is displayed correctly lsblk shows following:

sda                         8:0    0 931.5G  0 disk
├─sda1                      8:1    0     1M  0 part
├─sda2                      8:2    0     1G  0 part /boot
└─sda3                      8:3    0 930.5G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0   200G  0 lvm  /

When I tryfdisk -l it shows following (I left outloop1-loop4):

Disk /dev/loop5: 32.28 MiB, 33841152 bytes, 66096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors Disk model: ST1000LM024 HN-M Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 166EB4EB-E368-4D03-B844-654566C409B9

Device Start End Sectors Size Type /dev/sda1 2048 4095 2048 1M BIOS boot /dev/sda2 4096 2101247 2097152 1G Linux filesystem /dev/sda3 2101248 1953521663 1951420416 930.5G Linux filesystem

  • Welcome to Ask Ubuntu. Please take a screenshot of the app Gparted (use a desktop installation USB in the Try Ubuntu mode). Before taking the screenshot select the 1TB disk in question. Add the screenshot to this question. In this site we prefer that you copy and paste the text from the terminal rather than use screenshots for plain text of the terminal or console. – user68186 May 10 '21 at 20:03
  • 1
    Does this answer your question? How to resize partitions? – user535733 May 10 '21 at 20:28
  • Was LVM setup during install? (easiest way to find out is to run lsblk and see if you have something like ubuntu--vg-ubuntu--lv anywhere in the output) – easthighNerd May 11 '21 at 00:22
  • Output of fdisk -l. – Stephen Boston May 11 '21 at 03:11
  • @easthighNerd @Stephen Boston I added the information. When I find time to make a backup of my system, I am planning to try vgextend. Would you recommend that? And could you show methe right syntax for my case? – Kooni Wilke May 11 '21 at 09:54
  • @KooniWilke vgextend is used to extend your volume group (VG) to additional physical volumes (e.g., sdb1, if you add a new drive). I think you are looking for something like lvextend which resizes your logical volume (LV). – bfrguci May 19 '21 at 16:25

1 Answers1

24

By default, for whatever reason, when setting up a new Ubuntu Server install, it only allocates around 200GB of storage to the ubuntu--vg-ubuntu--lv logical volume by default, unless noticed and altered during install.

Here's how you can resize it to full capacity of the disk:

  1. See the current size of the logical volume before df -hT /dev/mapper/ubuntu--vg-ubuntu--lv

  2. Run a test first sudo lvresize -tvl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

  3. Resize the logical volume sudo lvresize -vl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

  4. Resize the filesystem sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv

  5. Check the size of the logical volume to see if everything went smooth df -hT /dev/mapper/ubuntu--vg-ubuntu--lv

  • I should make a backup right? And I have a simulation running (without a defined endpoint) and I would prefer to not stop it. Is this possible? The Testmode was successful – Kooni Wilke May 11 '21 at 10:01
  • @KooniWilke 1. Yes, I would recommend making a backup first, just in case. 2. You should be fine leaving your simulation running. – easthighNerd May 11 '21 at 10:04
  • A backup before any partitioning / filesystem changes is always well-advised, but in this case you won't need to stop your running jobs: Both operations can be done online while they keep running. – HuHa May 11 '21 at 10:04
  • 2
    It worked perfect. Thank you! – Kooni Wilke May 14 '21 at 11:17
  • 1
    Thank you, perfect answer. I thought during install that this was what it was doing but I just left everything as default just to see. Mine actually only used a default of 100GB of 500. I ran your commands and it resized to max of the drive. – Jay Croghan Nov 23 '22 at 07:06
  • Worked perfectly on Ubuntu server 22.04.4. Thank you! – Luis Aceituno Mar 09 '24 at 21:37