How Can I Extend centos-home?

General support questions
Plaxtor
Posts: 4
Joined: 2019/10/17 07:04:12

How Can I Extend centos-home?

Post by Plaxtor » 2019/10/17 07:13:14

Here is my filesystem:

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 19G 32G 38% /
devtmpfs 12G 0 12G 0% /dev
tmpfs 12G 8.0K 12G 1% /dev/shm
tmpfs 12G 1.2G 11G 11% /run
tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/sda1 1014M 265M 750M 27% /boot
/dev/mapper/centos-home 533G 520G 14G 98% /home
/dev/loop0 2.0G 3.3M 1.9G 1% /tmp
tmpfs 2.4G 0 2.4G 0% /run/user/0

I want to extend /dev/mapper/centos-home 520G to 749GB.
How can i extend it files are important in /dev/mapper/centos-home... There is no more space for getting backup.

Please help me friends.

Best Regards.

User avatar
jlehtone
Posts: 3051
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How Can I Extend centos-home?

Post by jlehtone » 2019/10/17 22:44:27

There are more commands that can reveal details:

Code: Select all

lsblk
blkid
pvs
vgs
lvs
findmnt

Plaxtor
Posts: 4
Joined: 2019/10/17 07:04:12

Re: How Can I Extend centos-home?

Post by Plaxtor » 2019/10/18 13:05:22

Physical Disks
[ 1.851947] sd 0:0:0:0: [sda] 1468006400 512-byte logical blocks: (751 GB/700 GiB)
[ 1.851985] sd 0:0:0:0: [sda] Write Protect is off
[ 1.851989] sd 0:0:0:0: [sda] Mode Sense: 61 00 00 00
[ 1.852027] sd 0:0:0:0: [sda] Cache data unavailable
[ 1.852030] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 1.852761] sda: sda1 sda2
[ 1.853415] sd 0:0:0:0: [sda] Attached SCSI disk
[ 5.398308] sd 0:0:0:0: Attached scsi generic sg0 type 0

----

[root@webserver ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 700G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 599G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-swap 253:1 0 15.8G 0 lvm [SWAP]
└─centos-home 253:2 0 533.3G 0 lvm /home
sr0 11:0 1 1024M 0 rom
loop0 7:0 0 2.1G 0 loop /home/virtfs/XXXX/var/tmp

----

[root@webserver ~]# blkid
/dev/sda1: UUID="c27e058f-3fab-4737-9c41-1f39f81e72fb" TYPE="xfs"
/dev/sda2: UUID="c32Ge2-RPoi-sVc2-OMeo-xHSy-Ul4c-yZDBiH" TYPE="LVM2_member"
/dev/mapper/centos-root: UUID="164d39a8-896f-4ef1-a3a4-45223d170c91" TYPE="xfs"
/dev/mapper/centos-swap: UUID="8d045fc3-12fe-4bb3-b0e5-046bf26d9b0b" TYPE="swap"
/dev/mapper/centos-home: UUID="fec6f6f3-4fbb-44cb-ae54-a3aeb28e55b8" TYPE="xfs"
/dev/loop0: UUID="0b08b916-66d2-48b3-8964-fd20de61e094" TYPE="ext3"

-----

[root@webserver ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <599.00g 0

----

[root@webserver ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos -wi-ao---- <533.25g
root centos -wi-ao---- 50.00g
swap centos -wi-ao---- 15.75g

----

User avatar
jlehtone
Posts: 3051
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How Can I Extend centos-home?

Post by jlehtone » 2019/10/18 15:46:37

Plaxtor wrote:
2019/10/17 07:13:14
There is no more space for getting backup.
Put other way: if your data is not worth backing up, then your files are not important.


You have one 700 GiB drive. It has two partitions, 600 GiB in total, and 100 GiB unpartitioned space.

One 1 GiB partition has xfs filesystem that is mounted to /boot.
The other partition has LVM physical volume (PV) that contains three logical volumes (LV):
* swap volume
* 50 GiB xfs root volume
* 533.25 GiB xfs home volume
The three volumes use the entire partition.

There is no way to expand the home to 749 GiB inside one 700 GiB drive.

It is not possible to shrink xfs filesystem inplace.

The home could be expanded to 633 Gib by taking into use the 100 Gib of unpartitioned space.
There are at least two approaches:
A. Create third partition. Make it a PV. Add PV to the volume group. Extend the home LV and the filesystem within it.
B. Resize the second partition. Resize PV in it. Extend the home LV and the filesystem within it.


I strongly suggest creating a backup before doing anything else.

Plaxtor
Posts: 4
Joined: 2019/10/17 07:04:12

Re: How Can I Extend centos-home?

Post by Plaxtor » 2019/10/21 09:42:32

Yes,
I added 100gb unpartioned drive from vmware.
"The home could be expanded to 633 Gib by taking into use the 100 Gib of unpartitioned space."
I want this :cry:
My files are too important

Could you please help how can i extend in terminal?

User avatar
jlehtone
Posts: 3051
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How Can I Extend centos-home?

Post by jlehtone » 2019/10/22 17:17:37

1. Make a backup

2. Create third partition. I would use fdisk
3. Make that partition a PV: pvcreate /dev/sda3
4. Add PV to VG: vgextend centos /dev/sda3
5. Expand LV and filesystem: lvextend --resizefs centos/home /dev/sda3


Disclaimer: Provided as is. Untested. No warranty. No claim of correctness.

User avatar
KernelOops
Posts: 328
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: How Can I Extend centos-home?

Post by KernelOops » 2019/10/23 07:03:51

In my experience, it is wrong that CentOS/Fedora use LVM and restrict the /home directories. Eventually people end up with the same problem, trying to grow their partition, while /usr, /var or other partitions waste empty space.

My suggestion is to create the whole drive as root / with everything in one partition and no LVM (except the boot partitions like /boot or /boot/efi).

Sure, some people will tell you that if you fill the entire root then you can get into problems, but that is much less common than filling the limited home partition. Plus, you can easily recover by removing a few files, much easier than resizing entire partitions.

Just my opinion :)


PS:
another plus side, is that you can remove all LVM related packages from your system!
--
I love my computer - all my friends live there.
--

User avatar
jlehtone
Posts: 3051
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How Can I Extend centos-home?

Post by jlehtone » 2019/10/23 11:20:37

KernelOops wrote:
2019/10/23 07:03:51
My suggestion is .. everything in one partition
I disagree.

If you have everything in one, then you end up wiping everything when you install a OS and have to restore user data from a backup.

With distinct OS and user data volumes you can wipe the OS filesystem without touching the user data.

User avatar
KernelOops
Posts: 328
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: How Can I Extend centos-home?

Post by KernelOops » 2019/10/25 09:45:16

Of course you can disagree, but that does not mean that you are right :D

For example, you can hold everything in a single partition and still upgrade, since you can mount your root partition from the live image and delete all / root directories but keeping your /home intact.

Also, its not a bad idea to re-install every once in a while, to make sure you start with a clean system.

Finally, having backups is a must-have these days 8-)
--
I love my computer - all my friends live there.
--

User avatar
TrevorH
Forum Moderator
Posts: 29503
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How Can I Extend centos-home?

Post by TrevorH » 2019/10/25 15:07:39

I also disagree. All your arguments in favour of using partitions can also be used to justify using LVM. How do you shrink /usr when it's a plain partition and sandwiched in the middle of others. Just use LVM, it's *way* more flexible and easy to use.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”