• List of iSCSI Mutual CHAP Posts by OS
  • Tools and Utilities for Windows
  • Unix and Linux Distros

slice2

slice2

Monthly Archives: August 2022

HOWTO Remove /home logical volume and add that space to the root partition

07 Sunday Aug 2022

Posted by Slice2 in Linux

≈ Leave a comment

Tags

Linux

You have a host with too much space allocated to /home and you need to remove and reallocate it to the root partition. This may be because there are no human users on this server and you just have or need service accounts. Backup any files you need from /home before you start.

1) Get the list of mounted file systems.
> df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.1M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/rl-root 37G 27G 11G 71% /
/dev/mapper/rl-home 19G 189M 18G 2% /home
/dev/sda1 1014M 342M 673M 34% /boot
vboxshare 477G 104G 373G 22% /media/sf_vboxshare
tmpfs 374M 12K 374M 1% /run/user/42
tmpfs 374M 0 374M 0% /run/user/0

2) Get the filesystem type. In this case it’s xfs. This informs a later step.
> lsblk -f | grep home
└─rl-home xfs 9fd41fcd-e123-40b8-8461-7500b9aaa023 /home

3) Get the volume details. Note the values for LV Path and LV Size.
> lvdisplay /dev/rl/home
— Logical volume —
LV Path /dev/rl/home
LV Name home
VG Name rl
LV UUID z2Kg70-xYsg-Cx11-ROoj-Fl5T-g0Pb-wuksJ9
LV Write Access read/write
LV Creation host, time ryl8, 2022-07-29 14:57:34 -0400
LV Status available
# open 1
LV Size 18.05 GiB
Current LE 4622
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 8192
Block device 253:2

4) Copy any files you need out of /home. Then unmount it as root, not su – root from another user.
> umount /home

5) Using the LV PATH value from lvdisplay above, remove the logical volume for /home.
> lvremove /dev/rl/home
Do you really want to remove active logical volume rl/home? [y/n]: y
Logical volume “home” successfully removed.

6) Make sure the volume is free in the VFree column.
> vgs -v
VG Attr Ext #PV #LV #SN VSize VFree VG UUID VProfile
rl wz–n- 4.00m 1 2 0 <59.00g 18.05g l6h9Zk-Ue9m-7oPJ-iPJK-XdRy-yfqD-zI56bB

7) Extend the free space to the root partition.
a) Extend the root logical volume to take up the free space you just made available.
> lvextend -l +100%FREE /dev/mapper/rl-root
Size of logical volume rl/root changed from 36.98 GiB (9467 extents) to <55.04 GiB (14089 extents).
Logical volume rl/root successfully resized.

b) Grow the filesystem onto the new lv space.
> xfs_growfs /dev/mapper/rl-root
xfs_growfs /dev/mapper/rl-root
meta-data=/dev/mapper/rl-root isize=512 agcount=4, agsize=2423552 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=9694208, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=4733, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 9694208 to 14427136

8) df -h to see the changes.
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.1M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/rl-root 56G 27G 29G 48% /
/dev/sda1 1014M 342M 673M 34% /boot
vboxshare 477G 104G 373G 22% /media/sf_vboxshare
tmpfs 374M 12K 374M 1% /run/user/42
tmpfs 374M 0 374M 0% /run/user/0

9) Edit /etc/fstab and remove or comment out /home and reboot.
> vi /etc/fstab
#/dev/mapper/rl-home /home xfs defaults 0 0

10) Reboot to seat the changes.
> reboot

11) Create new users as needed. Use /home as a folder on the root volume and not a space wasting logical volume as before.

Follow Blog via Email

Enter your email address to follow this blog and receive notifications of new posts by email.

Recent Posts

  • Patch Alma Linux 8.7 on an Offline or Air-Gapped System
  • HOWTO Remove /home logical volume and add that space to the root partition
  • Patch Rocky Linux 8.6 on an Offline or Air-Gapped System
  • HOWTO Install the Splunk Universal Forwarder on FreeBSD
  • HOWTO install a Splunk Universal Forwarder on Solaris 11 SPARC and x64 Using pkg(p5p) and tar
  • HOWTO install a Splunk Universal Forwarder on Solaris 10 SPARC and x64 Using pkgadd and tar
  • Recover Files from a Windows NTFS partition using Linux based SystemRescue
  • Sysmon Event ID 1 Process Creation rules for Splunk Universal Forwarder and McAfee All Access
  • Upgrading CentOS 7.2003 to 7.2009 on an Offline or Air-Gapped System
  • HOWTO Easily Resize the Default LVM Volume on Ubuntu 18.04
  • Create a Docker Container for your Cisco ESA, SMA or WSA Offline Content Updates
  • Apply the Mozilla Firefox STIG to Firefox on Ubuntu Linux 18.04
  • Dynamically Resize Those Tiny BlackArch Linux Terminals and Add a Scrollbar
  • Kali Linux OVA for Air-Gapped Use Build Process
  • HOWTO install the XFCE 4 Desktop on NetBSD 8.1
  • Build a Kali Linux ISO with the latest OS patches and packages
  • HOWTO quickly STIG Firefox 59.01
  • HOWTO mount a Synology NAS SMB share on Linux with SMBv1 disabled
  • Howto safely delete the WSUS WID on Windows 2012R2
  • HOWTO quickly STIG Firefox 45.0.1
  • Completing the vSphere vCenter Appliance Hardening Process
  • HOWTO install the XFCE 4.12 Desktop on NetBSD 7
  • Enabling TLS 1.2 on the Splunk 6.2x Console and Forwarders using Openssl and self signed certs.
  • HOWTO enable SSH on a Cisco ASA running 9.1.x
  • Apply a Windows 2012 R2 Domain GPO to a standalone Windows 2012 R2 server
  • Enable legacy SSL and Java SSL support in your browser for those old, crusty websites
  • HOWTO update FreeBSD 10.1 to the latest 11-current release
  • HOWTO Secure iSCSI Luns Between FreeBSD 10.1 and NetApp Storage with Mutual CHAP
  • HOWTO install the XFCE 4 Desktop on NetBSD 6.1.5
  • HOWTO Secure iSCSI Luns Between Ubuntu Server 14.10 and NetApp Storage with Mutual CHAP

Categories

  • Cisco (2)
  • ESXi (4)
  • FreeBSD (2)
  • HP (5)
  • iSCSI (12)
  • Linux (31)
  • Nessus (3)
  • NetApp (31)
  • NetBSD (10)
  • Oracle (9)
  • Security (48)
  • Solaris (9)
  • Splunk (5)
  • VMware (19)
  • Windows (20)
  • Wireshark (4)
  • XFCE (3)

Archives

  • February 2023
  • August 2022
  • July 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • November 2021
  • January 2021
  • December 2020
  • November 2020
  • August 2020
  • May 2020
  • September 2019
  • August 2019
  • March 2018
  • November 2016
  • March 2016
  • January 2016
  • November 2015
  • July 2015
  • June 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013

Blogroll

  • Adobe Security Bulletins
  • CentOS Blog
  • Cisco Security Blog
  • CSO Magazine
  • DHS National Vulnerability Database
  • Eric Sloof's NTPRO
  • HT SSL Tests
  • Intel Corp Security Advisories
  • Internet Usage World Stats
  • Kali Linux Blog
  • Linux Mint Blog
  • Meltdown and Spectre
  • Microsoft Security Blog
  • Microsoft Security Intelligence Report
  • Microsoft Security Research & Defense
  • Microsoft Security Response Center
  • MITRE CVE Site
  • NetApp Blogs
  • NetBSD Blog
  • Oracle OTN Security
  • Oracle Security Blog
  • PacketStorm
  • Redhat Security Blog
  • SC Magazine
  • Shodan Search Engine
  • US-CERT Alerts
  • US-CERT Bulletins
  • US-CERT Vulnerability Notes KB
  • VMware Blogs
  • VMware Security Advisories

Category Cloud

Cisco ESXi FreeBSD HP iSCSI Linux Nessus NetApp NetBSD Oracle Security Solaris Splunk VMware Windows Wireshark XFCE

Follow Blog via Email

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 38 other subscribers

Powered by WordPress.com.

 

Loading Comments...