How to group volumes together with LVM

When a huge capacity is allocated to the home directory and you want to combine it with the root volume!

Check the current situation

[root@cmst301 ~]# lvdisplay -C
  LV      VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home vg_cmst301 -wi-ao---- 197.68g
  lv_root vg_cmst301 -wi-ao----  50.00g
  lv_swap vg_cmst301 -wi-ao----   7.83g

Backup of target directory

[root@cmst301 ~]# cp -rp /home /home_bk

Comment out the following line in fstab

/dev/mapper/vg_cmst301-lv_home /home                   ext4    defaults        1 2

Unmount home directory

current situation


[root@cmst301 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
                       50G  6.0G   41G  13% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             477M   78M  374M  18% /boot
/dev/mapper/vg_cmst301-lv_home
                      195G  416M  185G   1% /home

Unmount


[root@cmst301 ~]# umount /home

Verification


[root@cmst301 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
                       50G  5.0G   42G  11% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             477M   78M  374M  18% /boot

Delete logical volume

[root@cmst301 ~]# lvremove /dev/vg_cmst301/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
  Logical volume "lv_home" successfully removed

Logical volume expansion

[root@cmst301 ~]# lvextend -L +200G /dev/mapper/vg_cmst301-lv_root
  Size of logical volume vg_cmst301/lv_root changed from 247.49 GiB (63357 extents) to 247.59 GiB (63382 extents).
  Logical volume lv_root successfully resized.

File system extension

[root@cmst301 ~]# resize2fs /dev/mapper/vg_cmst301-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_cmst301-lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 16
Performing an on-line resize of /dev/mapper/vg_cmst301-lv_root to 64903168 (4k) blocks.
The filesystem on /dev/mapper/vg_cmst301-lv_root is now 64903168 blocks long.

Check the expansion result

[root@cmst301 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
                      244G  5.0G  227G   3% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             477M   78M  374M  18% /boot

Recommended Posts

How to group volumes together with LVM
How to update with SQLAlchemy?
How to cast with Theano
How to separate strings with','
How to RDP with Fedora31
How to Delete with SQLAlchemy?
How to cancel RT with tweepy
Python: How to use async with
How to use virtualenv with PowerShell
How to deal with imbalanced data
How to install python-pip with ubuntu20.04LTS
How to deal with imbalanced data
How to get started with Python
How to deal with DistributionNotFound errors
How to get started with Django
How to Data Augmentation with PyTorch
How to calculate date with python
How to install mysql-connector with pip3
How to INNER JOIN with SQLAlchemy
How to install Anaconda with pyenv
How to authenticate with Django Part 2
How to authenticate with Django Part 3
[Blender] How to set shape_key with script
How to title multiple figures with matplotlib
How to get parent id with sqlalchemy
How to add a package with PyCharm
How to install DLIB with 2020 / CUDA enabled
How to use ManyToManyField with Django's Admin
How to use OpenVPN with Ubuntu 18.04.3 LTS
How to use Cmder with PyCharm (Windows)
How to prevent package updates with apt
How to work with BigQuery in Python
How to use Ass / Alembic with HtoA
How to deal with enum compatibility errors
How to do portmanteau test with python
How to search Google Drive with Google Colaboratory
How to download youtube videos with youtube-dl
How to use jupyter notebook with ABCI
How to power off Linux with Ultra96-V2
"How to pass PATH" to learn with homebrew
How to scrape websites created with SPA
How to use CUT command (with sample)
How to enter Japanese with Python curses
[Python] How to deal with module errors
How to install zsh (with .zshrc customization)
How to read problem data with paiza
How to use SQLAlchemy / Connect with aiomysql
How to get started with laravel (Linux)
How to install python3 with docker centos
How to use JDBC driver with Redash
How to selectively delete past tweets with Tweepy
How to upload with Heroku, Flask, Python, Git (4)
How to deal with memory leaks in matplotlib.pyplot
How to create sample CSV data with hypothesis
How to read a CSV file with Python 2/3
How to use GCP trace with open Telemetry
How to reduce GPU memory usage with Keras
How to debug with Jupyter or iPython Notebook
How to send a message to LINE with curl
How to deal with errors when hitting pip ②
[REAPER] How to play with Reascript in Python