Add space to root partition (using /home space)
On /home partition of one server I've got more HDD than I need. Below are steps to shrink /home partition (I preferred to delete it and then recreate, preserving all content):If you're not under the root, then first do the below:
- make (-m) dir and make it home for tmp_usr:
- useradd -m -d /tmp/temp_usr temp_usr
- usermod -aG wheel temp_usr
- id temp_usr
- passwd temp_usr # Z481632z.@
- ssh temp_usr@needed_server_ip
- sudo su -
- df -h
- ll /home/
- mkdir /tmp/temp
- cp -a /home /tmp/temp/ # -a key makes archive
- ll /tmp/temp/home/
- umount -fl /home # lazy unmount and undetected NFS unmount
- lvs # find VolGroupName and /home VG name
- lvremove /dev/VolGroupName/lv_home
- pvs # how much free space we have
- lvextend -L+350G /dev/VolGroupName/lv_root
- resize2fs /dev/VolGroup/lv_root # or xfs_growfs /dev/VolGroupName/lv_root
- pvs # how much free space we have
- lvcreate -L 50G -n lv_home VolGroupName
- pvs
- lvs
- mkfs.ext4 /dev/mapper/VolGroupName-lv_home# or mkfs.xfs /dev/mapper/VolGroupName-lv_home
- df -h
- mount -a # mount all existent FS
- df -h
- cp -a /tmp/temp/home/* /home
- ll /home
- rm -rf /tmp/temp
No comments:
Post a Comment