Tools Index

LVM

Read Raid Setup, the only thing you will need outside system is: "Patience, Pizza, and your favorite caffeinated beverage.". Arch Wiki article about Sofware RAID and LVM.

LVM or Logic Volume Manager bring one more layer, read Lvm made easy. Partitions under lvm are easy to be resized, moved and there is a tool to help encrypt. There is more freedom to name physical disk names exp; production, development, backups...

Basic idea behind RAID is to deal with independent disks as an array of drives. Raid 0 uses two or more disks as one, with performance gains without fault-tolerance. From raid 1 to 6 they offer diferent fault tolerance mechanisms.

Until now "from install" there is only one partition, it is good idea to have a system with diferent partitions for each propos. If is a "fresh install";

        # cd /iso/crux/opt/
        # pkgadd lvm2#2.02.107-1.pkg.tar.xz
        #
        

1. LVM Partition

There is no need to create a partition with fdisk or parted if all device will be used for lvm, just pvcreate against the device (pvcreate /dev/sda).

Create a LVM partition with parted;

        parted --script ${DEV} \
                unit mib \
                mkpart primary 1000 4000 \
                set 1 lvm on
        

2. Create physical volume

         # pvcreate /dev/sdb3
          Physical volume "/dev/sdb3" successfully created
        

3. Create volume group

        # vgcreate vg_system /dev/sdb3
          Volume group "vg_system" successfully created
        # vgcreate homevg /dev/sdb4
          Volume group "homevg" successfully created
        #
        

3.1. Search Volume Groups

        # vgscan
          Reading all physical volumes.  This may take a while...
          Found volume group "homevg" using metadata type lvm2
          Found volume group "vg_system" using metadata type lvm2
        #
        

4. Create logical volume

        # lvcreate -L 15G -n distfileslv vg_system
          Logical volume "distfileslv" created.
        # lvcreate -L 8G -n packageslv vg_system
          Logical volume "packageslv" created.
        # lvcreate -L 4G -n swaplv vg_system
          Logical volume "swaplv" created.
        # lvcreate -L 80G -n homelv homevg
          Logical volume "homelv" created.
        #
        
        # mkfs.ext4 /dev/vg_system/distfileslv
        # mkfs.ext4 /dev/vg_system/packageslv
        # mkswap /dev/vg_system/swaplv
        # mkfs.ext4 /dev/homevg/homelv
        

4.1. Activate Deactivate

Deactivate logical volumes;

        # lvchange -a -n /dev/vg_system/packageslv
        # lvchange -a -n /dev/vg_system/distfileslv
        # swapoff /dev/vg_system/sawplv
        # lvchange -a -n /dev/vg_system/swaplv
        

Deactivate volume group;

         # vgchange -a n vg_system
         0 logical volume(s) in volume group "vg_system" now active
         #
        

Activate volume group;

        # vgchange -a y vg_system
          3 logical volume(s) in volume group "vg_system" now active
        #
        

5. Maintenance

Resize

First umount all lvm partitions;

        # pvs
        
        # pvresize /dev/sdb
        
        # vgs
        
        # lvresize --resizefs --size +25GB /dev/mapper/vg_system-lv_ports
        
        # vgs
        

7. Encryption

Tools Index

This is part of the Tribu System Documentation. Copyright (C) 2020 Tribu Team. See the file Gnu Free Documentation License for copying conditions.