Filesystem partition utilization

Hello everybody!

I am trying to figure out and understand the filesystem better.
Right now I’m struggeling with how I can utilize the rest of the space on my harddrive.
I did a fresh Debian install(Linux 10 (buster)) yesterday and opted out of any desktop enviroment (it’s my first linux install without any GUI), I then opted for the LVM partitioning scheme and manually wrote in 30% for the install.

lsblk

martin@deb-grl:/home/shares$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 243M 0 part /boot
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 465.5G 0 part
├─deb–grl–vg-root 254:0 0 23.3G 0 lvm /
├─deb–grl–vg-swap_1 254:1 0 3.9G 0 lvm [SWAP]
├─deb–grl–vg-var 254:2 0 9.3G 0 lvm /var
├─deb–grl–vg-tmp 254:3 0 1.8G 0 lvm /tmp
└─deb–grl–vg-home 254:4 0 115.3G 0 lvm /home

df

df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 387M 27M 360M 7% /run
/dev/mapper/deb–grl–vg-root 23G 981M 21G 5% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 236M 49M 176M 22% /boot
/dev/mapper/deb–grl–vg-tmp 1.8G 5.4M 1.6G 1% /tmp
/dev/mapper/deb–grl–vg-var 9.2G 262M 8.4G 3% /var
/dev/mapper/deb–grl–vg-home 114G 60G 48G 56% /home
tmpfs 387M 0 387M 0% /run/user/1000

fdisk

fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000AAKX-0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbd50257d

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 976771071 976269314 465.5G 5 Extended
/dev/sda5 501760 976771071 976269312 465.5G 8e Linux LVM

The device (500GB) seem properly identified and I see that sda5 is larger than the folders under it. I thought that /home would simply expand with use.
Trying to navigate to sda5 or adding folders there yields “No such file or directory”

Maybe my googleFu is not the strongest, the answers I have found on forums are more about users trying to share removeable media in samba or just simply losing their media or mount path/directory.
Rather than me spinning up the bootloader and reformatting the drive I am hoping this can be a learning experience in the filesystem :slight_smile:

I am trying to figure out and understand the filesystem better.

LVM is not your filesystem. :slight_smile:

You can think of LVM as “extended partitioning”. Once the partitions are created, you still need to create filesystems before the space can be used. The installer does this step for you, but it still has to happen.

Filesystems themselves take up disk space to store their metadata, and the ext family of filesystems reserve an additional 5% of space using the debian-installer defaults.

20G seems like a lot of overhead, but it’s not too far off from your 30%.

Final note, the Debian installer acts on unclaimed space, not total space. “All remaining space” would be 100% in the installer, not the percentage of the total disk space.

Other useful output when dealing with lvm would be vgdisplay, lvdisplay and pvdisplay.

@Snaresoul it sounds like searching “LVM tutorial” or similar might be helpful to get you oriented - no disrespect intended; none of us start out knowing this stuff.

Your fdisk output shows you have a 465 GiB disk, which is also 500 GB (binary Gibibytes vs. decimal Gigabytes). You have a small boot partition, plus a 465 GiB LVM partition embedded within an “extended” partition of the same size. Your LVM logical drives use space in the LVM partition.

Your df output shows there is a VG (Volume Group) “dev-grl-vg” in which several LVs (Logical Volumes) have been created: root, tmp, var, and home. These roughly correspond to traditional physical partitions, but their sizes can be adjusted. /home will not grow automatically, but you can manually allocate more space to it (or to /, /tmp, or /var).

Run “sudo vgdisplay” to display information about the Volume Group, and look for the line “Free PE / Size” which will display the amount of unallocated space within the VG. That should be roughly 220 GiB if my math is correct.

Search terms like “linux lvm extend lv” to learn how to allocate some of that free space to the /home logical volume, and to update the /home file system to make use of the additional space.

There is some risk when doing any file system work, so make backups of any important data beforehand.

Wishing you success.

Fantastic! Thank you both very much!

vgdisplay

— Volume group —
VG Name deb-grl-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
Act PV 1
VG Size <465.52 GiB
PE Size 4.00 MiB
Total PE 119173
Alloc PE / Size 39325 / 153.61 GiB
Free PE / Size 79848 / <311.91 GiB
VG UUID 3FwNbB-WMkQ-Xktc-ViKB-zLkg-E9Gd-qSWsN8

I will delve into some LVM guides today during work breaks :slight_smile:
I just woke up but this should be cool, LVM seem very handy from what little reading I’ve done now in this pre coffee state.
And a lot cooler than a filesystem like I had missunderstood it to be.

Great success. Posting an update for anyone finding this from googling my describtion.

After reading up and learning a lot (really cool and very useful) about LVM, later making my first stumbling steps I was ready to mount my new lv.

Size matters

Created the lv, got confirmation and realized I made a 300k drive instead of 300GB.
Was good though I got to try to remove and redo it the correc way.

Mounting

I don’t know if it’s becouse I’m stuck in a windows mind set or if I’m just slow. But it did’t really click that I not only had to mount the drive(lv), but that I also had to select where to mount it.
Then I was attempting to make a folder on the lv, after that kept failing me I tried mounting the drive to itself and create the folder in the same command.

Correct command

Eventually I realized that I should define what to mount, and where to mount it:

root@deb-grl:/home/martin# mount /dev/mapper/deb–grl–vg-lager /home/lagret

#lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 ext2 b2054bd3-6d23-4682-9a67-b0c68d2f8e5f 175.1M 20% /boot
├─sda2
└─sda5 LVM2_member 4VcvGE-RXLU-hoM7-rZjf-wIty-MM8i-jz1Ff2
├─deb–grl–vg-root ext4 273b4fed-4cc8-4043-bf36-e0fb93f97548 20.7G 4% /
├─deb–grl–vg-swap_1 swap 8a27ab1f-1384-42fc-ad02-b3a4eff40df1 [SWAP]
├─deb–grl–vg-var ext4 3d21380d-3110-423e-8baf-31d58ec4ceb6 8.4G 3% /var
├─deb–grl–vg-tmp ext4 2b2524d8-3213-4ba4-ac95-43b03d4e904c 1.6G 0% /tmp
├─deb–grl–vg-home ext4 23b9b56b-0381-4e90-8de5-17e7b1d875b5 20G 77% /home
└─deb–grl–vg-lager ext4 3f5cadac-d6cb-4ba5-a547-3015bd2cb470 279.2G 0% /home/lagret

This was all great practice, I want to make another attempt without using google. The goal would be to unmount, shrink the size, make an additional lv (in essense splitting this one in two), and mount these.

Thank you again @imhigh.today and @Caped_Kibitzer for sending me down the right path.

2 Likes