Author Topic: How to manage hard drive space without losing data  (Read 1587 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to manage hard drive space without losing data
« on: May 25, 2023, 10:31:47 AM »
Hi there,
According to the picture below:

https://drive.google.com/file/d/1CwAHjMyoVfToNNTIyxHymvH4WjKT3YUR/view?usp=share_link
I have a lot of free and unused space in some directories
Now I want to add these empty spaces to the root directory without losing my data or damaging them.
Can you please tell me how I can do this?
BR

System INfo:
Distro Name: CentOS Linux release 7.9.2009 (Core)
Kernel Version: 3.10.0-1160.90.1.el7.x86_64
Platform: x86_64 vmware
« Last Edit: May 25, 2023, 10:36:28 AM by Sina »

Offline
**
Re: How to manage hard drive space without losing data
« Reply #1 on: May 25, 2023, 12:36:40 PM »
Hi,

Just forget about "devtmpf", "tmpfs". Those partitions can't be used as storage device:
https://en.wikipedia.org/wiki/Tmpfs
Once you reboot your server/vps all data in tmpfs will be removed.
« Last Edit: May 25, 2023, 12:38:31 PM by cyberspace »

Offline
*****
Re: How to manage hard drive space without losing data
« Reply #2 on: May 25, 2023, 02:07:11 PM »
The answer to the original question is "very carefully." I have done this on two different servers, using both fdisk (for hard partitions) and lvs resizing techniques (easier/safer). Obviously you are using LVM, and as an aside, I prefer my disk layout to all be one under / (meaning one LVM managed volume -- /dev/mapper/centos7-root -- I don't need the separate /dev/mapper/centos7-home partition. I only feel that is needed if you need it to reside on different storage or foresee expanding /home ad infinitum, or I suppose your backup requirements were specialized.

At any rate, do a FULL backup before proceeding. Be aware if you mess up, you will crash your server.
https://linuxhandbook.com/resize-lvm-partition/