Jump to content

Ubuntu Server says I am out of storage but I'm not..?

Joseph Stacklin
Go to solution Solved by Joseph Stacklin,

Okay. I'm dumb. So here is the steps I needed to take:

 

  1. Run LVExtend command: lvextend -l +50000 /dev/mapper/server0--vg-root 
    1. The + value is how much is free from the command VGDISPLAY
    2. The /dev/ value is the location of your LVM partition.
  2. Then Run the command: resize2fs /dev/mapper/server0--vg-root
    1. The /dev/ value is the location of your LVM partition.

And that's it!

 

root@server0:/home/joseph# resize2fs /dev/mapper/server0--vg-root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/server0--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 8, new_desc_blocks = 33
The filesystem on /dev/mapper/server0--vg-root is now 67594240 (4k) blocks long.

root@server0:/home/joseph# df -h
Filesystem                    Size  Used Avail Use% Mounted on
udev                          3.8G     0  3.8G   0% /dev
tmpfs                         777M  588K  777M   1% /run
/dev/mapper/server0--vg-root  254G   61G  182G  26% /
tmpfs                         3.8G     0  3.8G   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda1                     511M  6.1M  505M   2% /boot/efi
tmpfs                         777M     0  777M   0% /run/user/1000

 

I feel so dumb, but thank you @Electronics Wizardy for your help! 

Hey everyone. So on my homelab server I have a linux VM running Ubuntu. It has my websites hosted on it just for fun, not for profit. I started with a 64GB vDisk in Hyper-V but Linux said that it was full. So I attempted to create a new vDrive, copy the contents of the old vDrive to the new vDrive and then expand it to the whole size of the drive. This worked and I am able to boot the VM from the new drive, but Ubuntu is still saying that the / mount only has 99.3% free and is showing the size of the old drive. 

 

When I set it up originally I set everything up using LVM. I checked parted and it shows that the drive is there and mounted to / (see below):

 

(parted) print free
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 279GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   279GB   279GB                      lvm
        279GB   279GB   1032kB  Free Space

 

However the print list command shows the following:

 

(parted) print list
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 279GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  538MB  537MB  fat32              boot, esp
 2      538MB   279GB  279GB                     lvm


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/server0--vg-swap_1: 1028MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system     Flags
 1      0.00B  1028MB  1028MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/server0--vg-root: 67.2GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  67.2GB  67.2GB  ext4

 

Any assistance would be greatly appreciated to expanding this and getting this fixed.

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

what does df -h show?

 

I think its using lvm, and ubuntu server uses a 4gb partition for / by default on lvm, so you need to expand the lvm logical volume, then the file system

 

24 minutes ago, Joseph Stacklin said:

So I attempted to create a new vDrive, copy the contents of the old vDrive to the new vDrive and then expand it to the whole size of the drive

just saying, you can just expand a existing virtual disk in hyper-v(even hot if you want)

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Electronics Wizardy said:

what does df -h show?

 

root@server0:/home/joseph# df -h
Filesystem                    Size  Used Avail Use% Mounted on
udev                          3.8G     0  3.8G   0% /dev
tmpfs                         777M  588K  777M   1% /run
/dev/mapper/server0--vg-root   62G   61G     0 100% /
tmpfs                         3.8G     0  3.8G   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda1                     511M  6.1M  505M   2% /boot/efi
tmpfs                         777M     0  777M   0% /run/user/1000
Just now, Electronics Wizardy said:

 

just saying, you can just expand a existing virtual disk in hyper-v(even hot if you want)

I tried to expand the drive in HV but it still had similar results. I couldn't edit live tho as it said I had snapshots.

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Joseph Stacklin said:

root@server0:/home/joseph# df -h
Filesystem                    Size  Used Avail Use% Mounted on
udev                          3.8G     0  3.8G   0% /dev
tmpfs                         777M  588K  777M   1% /run
/dev/mapper/server0--vg-root   62G   61G     0 100% /
tmpfs                         3.8G     0  3.8G   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda1                     511M  6.1M  505M   2% /boot/efi
tmpfs                         777M     0  777M   0% /run/user/1000

I

Steps to make it bigger

 

1. Make the parittion bigger. Easy way is to delete the partition, then make a bigger one with the same number

 

2. Resize the lvm physical volume

 

3. increase the size of the lvm logical volume

 

4. resize the file system

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Electronics Wizardy said:

Steps to make it bigger

 

1. Make the parittion bigger. Easy way is to delete the partition, then make a bigger one with the same number

 

2. Resize the lvm physical volume

 

3. increase the size of the lvm logical volume

 

4. resize the file system

 

Unfortunately since the partition is the live data partition I cannot delete the partition without data loss. Is there any way to make a live resize. Kinda one of the reasons I chose LVM was because of the promise of easier partition management.

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Joseph Stacklin said:

 

Unfortunately since the partition is the live data partition I cannot delete the partition without data loss. Is there any way to make a live resize. Kinda one of the reasons I chose LVM was because of the promise of easier partition management.

you can delete the partition and make the new one without any data loss, and you can do it all hot(might need a reboot to reckonize)

 

Also get backups of that vm going so a error doesn't cause data loss

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Electronics Wizardy said:

you can delete the partition and make the new one without any data loss, and you can do it all hot(might need a reboot to reckonize)

What commands should I use? I'm sorry I'm still trying to learn all aspects of the system

2 minutes ago, Electronics Wizardy said:

Also get backups of that vm going so a error doesn't cause data loss

Snapshot is in place :)

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Joseph Stacklin said:

What commands should I use? I'm sorry I'm still trying to learn all aspects of the system

Snapshot is in place :)

partition part, use a partition manager like gdisk or fdisk.

 

Then delete the big data partition(i think 3 in this case). Then make a new partition, same number, but as big as possible. Then reboot

 

Wanna try that first?

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Electronics Wizardy said:

partition part, use a partition manager like gdisk or fdisk.

 

Then delete the big data partition(i think 3 in this case). Then make a new partition, same number, but as big as possible. Then reboot

 

Wanna try that first?

 

Actually was a lot easier than that. Just had to enter the following command and LVM extended the partition.

 

lvextend -l +50000 /dev/mapper/server0--vg-root

 

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

Okay. So still after reboot didn't work. It shows in the command vgdisplay the following:

 

root@server0:/home/joseph# vgdisplay
  --- Volume group ---
  VG Name               server0-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <259.50 GiB
  PE Size               4.00 MiB
  Total PE              66431
  Alloc PE / Size       66255 / <258.81 GiB
  Free  PE / Size       176 / 704.00 MiB
  VG UUID               zu43RL-qesE-HjTk-ML36-31I5-EAKQ-Q4I5gJ

 

But the drive size still thinks that drive which is mounted on / is 64GB

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Electronics Wizardy said:

partition part, use a partition manager like gdisk or fdisk.

 

Then delete the big data partition(i think 3 in this case). Then make a new partition, same number, but as big as possible. Then reboot

 

Wanna try that first?

So I have zero idea how to use gdisk or fdisk in cli since I'm using server.

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

34 minutes ago, Electronics Wizardy said:

partition part, use a partition manager like gdisk or fdisk.

 

Then delete the big data partition(i think 3 in this case). Then make a new partition, same number, but as big as possible. Then reboot

 

Wanna try that first?

When I enter the following I get an error.

 

root@server0:/home/joseph# resize2fs /dev/sda2
resize2fs 1.44.1 (24-Mar-2018)
resize2fs: Device or resource busy while trying to open /dev/sda2
Couldn't find valid filesystem superblock.

 

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

Okay. I'm dumb. So here is the steps I needed to take:

 

  1. Run LVExtend command: lvextend -l +50000 /dev/mapper/server0--vg-root 
    1. The + value is how much is free from the command VGDISPLAY
    2. The /dev/ value is the location of your LVM partition.
  2. Then Run the command: resize2fs /dev/mapper/server0--vg-root
    1. The /dev/ value is the location of your LVM partition.

And that's it!

 

root@server0:/home/joseph# resize2fs /dev/mapper/server0--vg-root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/server0--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 8, new_desc_blocks = 33
The filesystem on /dev/mapper/server0--vg-root is now 67594240 (4k) blocks long.

root@server0:/home/joseph# df -h
Filesystem                    Size  Used Avail Use% Mounted on
udev                          3.8G     0  3.8G   0% /dev
tmpfs                         777M  588K  777M   1% /run
/dev/mapper/server0--vg-root  254G   61G  182G  26% /
tmpfs                         3.8G     0  3.8G   0% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
tmpfs                         3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda1                     511M  6.1M  505M   2% /boot/efi
tmpfs                         777M     0  777M   0% /run/user/1000

 

I feel so dumb, but thank you @Electronics Wizardy for your help! 

Mainline: MacBook Air M1 Display(s): Acer K272HUL; VIOTEK - GNV32DB Keyboard/Mouse: Logitech M720/K780 Sound: AirPods 3 Operating System: MacOS Phone: iPhone 13 Pro (Graphite)

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×