Score:2

Use the whole disk instead of a partition as root dir

cn flag

My problem is that i have a ~300GB hdd (sda3) that i cannot use cause the / is not there.

How can i change that?

I think i installed lvm with the ubuntu server and this caused the problem. So in this case i can "merge" the partitions into each other is that right?

I hope my problem is understandable. Sorry if not. I cant use gui tools as gparted and so on. (this is a headless server, or it should be)

server@serverlaptop:~$ df -H
Filesystem                         Size  Used Avail Use% Mounted on
udev                               786M     0  786M   0% /dev
tmpfs                              167M  1.6M  165M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  106G   19G   82G  19% /
tmpfs                              832M  4.1k  832M   1% /dev/shm
tmpfs                              5.3M     0  5.3M   0% /run/lock
tmpfs                              832M     0  832M   0% /sys/fs/cgroup
/dev/loop0                          59M   59M     0 100% /snap/core18/2128
/dev/loop1                          67M   67M     0 100% /snap/core20/1778
/dev/loop2                          59M   59M     0 100% /snap/core18/2667
/dev/loop3                          74M   74M     0 100% /snap/lxd/21029
/dev/loop5                          97M   97M     0 100% /snap/lxd/24061
/dev/loop4                          53M   53M     0 100% /snap/snapd/17883
/dev/sda2                          2.1G  111M  1.9G   6% /boot
tmpfs                              167M     0  167M   0% /run/user/1000

server@serverlaptop:~$ lsblk 
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0  55.4M  1 loop /snap/core18/2128
loop1                       7:1    0  63.3M  1 loop /snap/core20/1778
loop2                       7:2    0  55.6M  1 loop /snap/core18/2667
loop3                       7:3    0  70.3M  1 loop /snap/lxd/21029
loop4                       7:4    0  49.6M  1 loop /snap/snapd/17883
loop5                       7:5    0  91.9M  1 loop /snap/lxd/24061
sda                         8:0    0 298.1G  0 disk 
├─sda1                      8:1    0     1M  0 part 
├─sda2                      8:2    0     2G  0 part /boot
└─sda3                      8:3    0 296.1G  0 part 
  └─ubuntu--vg-ubuntu--lv 253:0    0   100G  0 lvm  /
sr0                        11:0    1  1024M  0 rom  

The output i want: /dev/mapper/ubuntu--vg-ubuntu--lv 296G 19G xG y% /

Score:3
in flag

You are using LVM,the logical volume manager, this is great, do NOT change that ;)

Your Disk has 3 partitions, the third partition is your pysical volume, sudo pvs (physical volume show) will show you that.

This is part of a volume group (vg-ubuntu), which you can display by sudo vgs (volume group show).

On this volume group you have a logical volume, which you can display by sudo lvs (logical volume show).

On this logical volume you have your filesystem.

You can create a second logical volume by lvcreate -L SIZE -n LVNAME VOLUME_GROUP, eg. lvcreate -L 20G -n data vg-ubuntu, then create a filesystem with mkfs.ext4 /dev/vg-ubuntu/data.

You can extend your existing with lvextend -L +50G /dev/mapper/ubuntu--vg-ubuntu--lv, followed by extending the filesystem by resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv.

You can also create snapshots of your logical volume if you have some room left in your volume group, so i would recommend to only increase your logical volume to how much space you really need, NOT to the full space available in your volume group.

Remember you can always increase your volume size as long as you have space in your volume group.

Have fun

cn flag
Thank you! I cant start from somewhere. I really appreciate your time
in flag
Adding to this: It’s generally considered good practice to store whatever data a server is serving (be that files, databases, a website, or something else) on a separate filesystem from your root filesystem. This makes system recovery easier in most cases, makes it less likely that something misbehaving will cause the whole system to run out of disk space, and lets you better optimize the storage stack for your particular use case, and is the primary reason that many (possibly most?) major distros use less than the full size of the PV for the root LV when initially installed to LVM.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.