Ubuntu Server 20.04.2 LTS: Merge partitions

Discussion in 'Installation/Configuration' started by canju, Jul 26, 2021.

  1. canju

    canju New Member

    Hello everyone,
    i have a problem and i hope u can help me with that.
    Iam running a Linux server Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-80-generic x86_64) where the /var partition is full. This server is primary running as a database server (MariaDB).

    lsblk output:
    Code:
    NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop0           7:0    0  99.4M  1 loop /snap/core/11316
    loop1           7:1    0  61.7M  1 loop /snap/core20/1026
    loop2           7:2    0  68.2M  1 loop /snap/lxd/21039
    loop3           7:3    0  89.1M  1 loop /snap/core/8268
    loop4           7:4    0  68.2M  1 loop /snap/lxd/21023
    loop5           7:5    0  61.8M  1 loop /snap/core20/1081
    sda             8:0    0   931G  0 disk
    ├─sda1          8:1    0     2M  0 part
    ├─sda2          8:2    0    28G  0 part /
    ├─sda3          8:3    0   9.3G  0 part [SWAP]
    └─sda4          8:4    0 893.8G  0 part
      ├─vg00-usr  253:0    0    10G  0 lvm  /usr
      ├─vg00-var  253:1    0    10G  0 lvm  /var
      └─vg00-home 253:2    0    10G  0 lvm  /home
    
    Is it possible to merge the /usr, /var and /home partitions, so that this "directories" arent capped by 10GB anymore and have acces to the full size of sda4 (893.8G) without reinstalling the whole Linux?

    Some additional infos
    df output:
    Code:
    Filesystem            1K-blocks     Used Available Use% Mounted on
    udev                   32790920        0  32790920   0% /dev
    tmpfs                   6567224   189848   6377376   3% /run
    /dev/sda2              28702716  9278088  19424628  33% /
    /dev/mapper/vg00-usr   10255636  3835320   5879644  40% /usr
    tmpfs                  32836116        4  32836112   1% /dev/shm
    tmpfs                      5120        0      5120   0% /run/lock
    tmpfs                  32836116        0  32836116   0% /sys/fs/cgroup
    /dev/mapper/vg00-home  10255636    36888   9678076   1% /home
    /dev/mapper/vg00-var   10255636 10239252         0 100% /var
    /dev/loop0               101760   101760         0 100% /snap/core/11316
    /dev/loop1                63232    63232         0 100% /snap/core20/1026
    /dev/loop2                69888    69888         0 100% /snap/lxd/21039
    /dev/loop3                91264    91264         0 100% /snap/core/8268
    /dev/loop4                69888    69888         0 100% /snap/lxd/21023
    /dev/loop5                63360    63360         0 100% /snap/core20/1081
    tmpfs                   6567220        0   6567220   0% /run/user/0
    tmpfs                   6567220        0   6567220   0% /run/user/1000
    
    fdisk -l output
    Code:
    Disk /dev/loop0: 99.38 MiB, 104202240 bytes, 203520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop1: 61.75 MiB, 64729088 bytes, 126424 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop2: 68.17 MiB, 71475200 bytes, 139600 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop3: 89.9 MiB, 93417472 bytes, 182456 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop4: 68.17 MiB, 71475200 bytes, 139600 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop5: 61.79 MiB, 64770048 bytes, 126504 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/sda: 931 GiB, 999653638144 bytes, 1952448512 sectors
    Disk model: MR9440-8i  
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 65536 bytes / 65536 bytes
    Disklabel type: gpt
    Disk identifier: E86C3264-9A03-43DE-862A-00F27310B0F8
    
    Device        Start        End    Sectors   Size Type
    /dev/sda1      2048       6143       4096     2M BIOS boot
    /dev/sda2      6144   58593279   58587136    28G Linux filesystem
    /dev/sda3  58593280   78125055   19531776   9.3G Linux swap
    /dev/sda4  78125056 1952446463 1874321408 893.8G Linux LVM
    
    Disk /dev/mapper/vg00-usr: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 65536 bytes / 65536 bytes
    
    Disk /dev/mapper/vg00-var: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 65536 bytes / 65536 bytes
    
    Disk /dev/mapper/vg00-home: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 65536 bytes / 65536 bytes
    
    If its possible I would be really happy if someone could guide me through the commands it needs.

    Best,
    canju
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    It is, you would boot from a rescue disk and start shuffling things around, eg. move the /usr files into a subdir of the current "usr" filesystem, then move /home files over there under another subdir so as to combine /usr and /home on one lvm; then enlarge the "usr" lvm/filesystem with the space of the old "home" lvm, and move /var files into a subdir there, delete the then-unused "var" lvm and increase the size of the single remaining "usr" lvm/filesystem to max size; then setup bind mount points for the actual /usr, /var and /home directories.

    You risk data loss of course, so start with good backups, take it slow, and if you really need it, consider hiring some experienced help.
     
    Chris_UK likes this.

Share This Page