Enlarging the /home directory

Issues related to hardware problems
johnwmcc
Posts: 13
Joined: 2019/03/18 01:43:35

Re: Enlarging the /home directory

Post by johnwmcc » 2019/03/25 13:14:57

I've done everything you suggested, days later than I had hoped, except the last step, and it all seems to have worked ok so far.

Not sure what to use in the last step for 'filesystem_name'.

This is what's in /etc/fstab:

Code: Select all

/dev/mapper/centos-root xfs defaults 0 0
UUID (long and complex - can't copy/paste it)    /boot xfs  defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
What should I use for 'filesystem_name'?

My guess is the centos-root one, but that may be quite wrong, so I'll wait for a response before going further.

darthbolek
Posts: 12
Joined: 2019/03/17 11:48:21

Re: Enlarging the /home directory

Post by darthbolek » 2019/03/26 01:50:15

/dev/mapper/centos-home

You wanted to enlarge the /home...

johnwmcc
Posts: 13
Joined: 2019/03/18 01:43:35

Re: Enlarging the /home directory

Post by johnwmcc » 2019/03/26 10:29:51

So that's the one to go for? centos-home?

I wasn't sure whether there was a parent file-system of which it was only a part.

Thanks.

darthbolek
Posts: 12
Joined: 2019/03/17 11:48:21

Re: Enlarging the /home directory

Post by darthbolek » 2019/03/26 13:52:58

There is no "parent file-system"...

clasic way: disk -> partition -> filesystem -> mountpoint
lvm way: disk/partition -> physical volume -> volume group -> logical volume -> filesystem -> mountpoint

To see info on lvm volume groups, physical volumes, logical volumes use commands: vgs, pvs, lvs

So, you requirement was to "enlarge the /home directory":
* /home is mounted as a separate filesystem (df -h) (lsblk)
* /home is lvm - its filesystem is on logical volume (lsblk) (df -h) (/etc/fstab)
* to "enlarge /home" we need to enlarge its filesystem
* to increase filesystem size (on lvm) we need space on logical volume
* to increase size of logical volume we need space on volume group
* to increase space on volume group we can do 2 things:
a) add more physical volumes (that was suggestion by TrevorH)
b) increase the size of existing physical volumes (usually this is less likely to be an option)
* to increase space on physical volume we need more space on partition (this applies only if physical volume is defined on partition)
* to increase size of partition we need free space on disk

In your case: there was only one physical volume and physical volume was defined on partition (lsblk) (lvs) and there was free space on disk (parted) (lsblk). So, what you did:
1. you enlarged/resized partition (parted)
2. you enlarged/resized physical volume (pvresize)
3. there was no need to do anything to volume group
4. you enlarged/resized logical volume (lvresize)
5. you enlarged/resized filesystem (xfs_growfs)

I hope this helps.

johnwmcc
Posts: 13
Joined: 2019/03/18 01:43:35

Re: Enlarging the /home directory

Post by johnwmcc » 2019/03/26 16:20:40

Thank you. That helps my understanding in generally. But I'm afraid I'm still not quite clear if I've done everything I need to already, or do I still need to do one more step on .../centos-home?

I haven't done step 4. - extending the file_system with xfs_growfs - because I'm being dense about whether 'the file_system' is .../centos-home, or something else.

darthbolek
Posts: 12
Joined: 2019/03/17 11:48:21

Re: Enlarging the /home directory

Post by darthbolek » 2019/03/26 16:32:22

There are 2 naming conventions:

/dev/<volume_group_name>/<logical_volume_name>
/dev/mapper/<volume_group_name>-<logical_volume_name>

so, for you either will work:

Code: Select all

/dev/centos/home
/dev/mapper/centos-home

MartinR
Posts: 442
Joined: 2015/05/11 07:53:27
Location: UK

Re: Enlarging the /home directory

Post by MartinR » 2019/03/26 16:43:28

From man lvm:
Links or nodes in /dev/mapper are intended only for internal use and the precise format and escaping might change between
releases and distributions. Other software and scripts should use the /dev/VolumeGroupName/LogicalVolumeName format to reduce the
chance of needing amendment when the software is updated.
So in this case always use /dev/centos/home.

johnwmcc
Posts: 13
Joined: 2019/03/18 01:43:35

Re: Enlarging the /home directory

Post by johnwmcc » 2019/03/26 19:10:44

Many thanks for all the help.

Will try to finish this later tonight.

johnwmcc
Posts: 13
Joined: 2019/03/18 01:43:35

Re: Enlarging the /home directory

Post by johnwmcc » 2019/03/29 23:16:45

Finally got round to finishing this, and it is I think now all working as desired.

Just transferring my media to the new server - it will take several hours as there are hundreds of GB of them.

Many thanks for all the help to get me there.

Post Reply