B
B
Bisekenov2018-09-04 15:21:58
linux
Bisekenov, 2018-09-04 15:21:58

How to extend root partition in centos?

There is a 1Tb hard drive with CentOS installed, 53 GB in the root partition, and 941 GB in the home partition.
How can I increase the size of the root partition at the expense of the home partition?
fdisk -l gives this information

spoiler

/dev/sda1 * Linux
/dev/sda2 8e Linux LVM

linux noob))

Answer the question

In order to leave comments, you need to log in

6 answer(s)
C
CityCat4, 2018-09-04
@Bisekenov

This is not an easy question to ask :)
It's easy to expand an LVM volume. But to free up space in it - it will be more difficult.
By the way, DO NOT climb into LVM volumes using partition editors! (gparted, partition magic, acronis and others like them) - ditch everything the fuck.
First you need to free up space in /home. And this is not easy, because the system will only allow you to trim the volume if the blocks are not used. Then the vacant place is assigned to another volume.
In words, everything is simple. In fact, it will be long and thoughtfulreading the documentation on LVM, a full backup of data (because the chance of ruining everything with inaccurate handling of volume management commands is not just high - it is fucking high!), And only then try to do something. It will not turn out right away :) so if there is an opportunity and there is no time, it is better to ask someone.

#
#, 2018-09-04
@mindtester

in general, for any linux, usually everything is just done with live media, gparted or patritionmanager , if sneakers
.. this is just in case of a simple markup, without LVM (although .. maybe with LVM everything will be just as simple ... almost as in acronis)
ps if suddenly these utilities are not in live (which would be strange) they can be installed in the standard way (although for one session, but more is not needed)
pps and yes - backup of important data is highly desirable BEFORE
ppps fallback (for dummies, but why not?) - from live (under root):
- comment the home line in /etc/fstab
- create a home folder in
root - rsync/grsync/ and even mc - hamster movie
- kill the hamster partition
- expand the root to the physical limit (utilities mentioned above)
... but never forget about backups of everything important before starting the meat grinder..
ppps

By the way, DO NOT climb into LVM volumes using partition editors! (gparted, partition magic, acronis and others like them) - ditch everything the fuck.

- acronis is mentioned in general for comparison (and the analogy is quite appropriate, see the next paragraph, everything is in goo, but everything works), partition magic was not mentioned at all
- but the cheap patrtitionmanager did a great job (kubuntu 18.04.* at least. LVM section is shown on on a physical device - move/resize (no less than the content of course), and its subvolumes are already shown as on a separate device - move/resize wellcome (again, within the size of the LVM volume)) , usually gparted , in all sorts of blogs, is often declared more advanced, but I have not tested it myself)

R
Ruslan Fedoseev, 2018-09-04
@martin74ua

Centos is installed on LVM by default.
Look for how to expand the LVM partition.
In general, you need to unmount /home, delete the volume, add space to the volume of the root partition, expand the file system on the root partition. Well, fix fstab so that home is not mounted at startup;)

D
devlocal, 2018-09-04
@devlocal

It's better not to touch it, if not when this was not done on the test server

P
pfg21, 2018-09-04
@pfg21

we can also remember such a "collective farm-style" :)
we are looking for the largest and most unnecessary directory using ncdu or similar programs.
from under the root we transfer it to the section with home (kudan separately, so as not to be scratched :) )
and in the same place we make a soft link to the moved directory for transparent access.

S
Stanislav Bodrov, 2018-09-04
@jenki

CityCat4 wrote everything correctly. At first glance, the question is simple and easily solved. Until you ruin a couple of servers with archaic important data that no one has ever backed up.
Therefore, it is better to make a backup copy of everything and everything and roll the server over again. I'm sure there is still something to change / improve, but for this you need to reinstall the OS - it's always like that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question