So I’m very new to self hosting. When I set up Ubuntu server and jellyfin it formatted as a logical drive. I can’t for the life of me parse how I add the other terabytes worth of disks I have to the machine. Can someone eli5?

  • greyfox@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 days ago

    I am assuming this is the LVM volume that Ubuntu creates if you selected the LVM option when installing.

    Think of LVM like a more simple more flexible version of RAID0. It isn’t there to offer redundancy but it take make multiple disks aggregate their storage/performance into a single block device. It doesn’t have all of the performance benefits of RAID0, particularly with sequential reads, but in the cases of fileservers with multiple active users it can probably perform even better than a RAID0 volume would.

    The first thing to do would be to look at what volume groups you have. A volume group is one or more drives that creates a pool of storage that we can allocate space from to create logical volumes. Run vgdisplay and you will get a summary of all of the volume groups. If you see a lot of storage available in the ‘Free PE/Size’ (PE means physical extents) line that means that you have storage in the pool that hasn’t been allocated to a logical volume yet.

    If you have a set of OS disks an a separate set of storage disks it is probably a good idea to create a separate volume group for your storage disks instead of combining them with the OS disks. This keeps the OS and your storage separate so that it is easier to do things like rebuilding the OS, or migrating to new hardware. If you have enough storage to keep your data volumes separate you should consider ZFS or btrfs for those volumes instead of LVM. ZFS/btrfs have a lot of extra features that can protect your data.

    If you don’t have free space then you might be missing additional drives that you want to have added to the pool. You can list all of the physical volume which have been formatted to be used with LVM by running the pvs command. The pvs command show you each formatted drive and if they are associated with a volume group. If you have additional drives that you want to add to your volume group you can run pvcreate /dev/yourvolume to format them.

    Once the new drives have been formatted they need to be added to the volume group. Run vgextend volumegroupname /dev/yourvolume to add the new physical device to your volume group. You should re-run vgdisplay afterwards and verify the new physical extents have been added.

    If you are looking to have redundancy in this storage you would usually build an mdam array and then do the pvcreate on the volume created my mdadm. LVM is usually not used to give you redundancy, other tools are better for that. Typically LVM is used for pooling storage, snapshots, multiple volumes from a large device, etc.

    So one way or another your additional space should be in the volume group now, however that doesn’t make it usable by the OS yet. On top of the volume group we create logical volumes. These are virtual block devices made up of physical extents on the physical disks. If you run lvdisplay you will see a list of logical volumes that were created by the Ubuntu installer which is probably only one by default.

    You can create new logical volumes with the lvcreate command or extend the volume that is already there. Or resize the volume that you already have with lvresize. I see other posts already explained those commands in more detail.

    Once you have extended the logical volume (the virtual block device) you have to extend the filesystem on top of it. That procedure depends on what filesystem you are using on your logical volume. Likely resize2fs for ext4 by default in Ubuntu, or xfs_growfs if you are on XFS.

  • Dyskolos@lemmy.zip
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    3 days ago

    No time currently for a nice ELI5, but if you also need a solution now:

    sudo cfdisk -> resize to what's physically available -> save

    sudo pvresize /dev/sda<X> (x being the drive in question)

    sudo lvresize -t -v -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

    sudo lvreduce -t -L <SIZE> /dev/mapper/ubuntu--vg-ubuntu--lv

    No errors? Then remove -t

    sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

    This should be it on default Ubuntu server. Typically unintuitive linux-stuff, but hey 😁

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    4 days ago

    It didn’t format as a logical drive, a logical drive was created then partitioned, then formatted with whatever filesystem you chose. A logical drive is just an easy to “handle” or representation of storage that makes it easy to work with instead of having to directly address many devices at once. It’s like a grouping of things.

    That being said, you just need to expand the partition to use all available space: https://www.redhat.com/en/blog/resize-lvm-simple

  • As @catloaf says, you need to provide nor specific information.

    Did you use LVM? Or just btrfs? If the latter, adding space to a volume is trivial - a single, simple command. It’s a little more involved with LVM, but not crazy much so.

  • Pfeffy@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    2
    ·
    3 days ago

    If you can’t work it out from Google or documentation then it’s a waste of time for anybody else to try and teach you. Put in the work or pay someone for the help.