Change Current Mount Point and rearrange partition

General support questions
osxio.com
Posts: 3
Joined: 2017/07/17 17:49:35

Change Current Mount Point and rearrange partition

Postby osxio.com » 2017/07/17 18:04:43

Hi all,
I'm new in Linux and CentOS. I bought a server for web and ask friend for initial setup with CentOS 7. Now checking the hosting account in WHM I have:

Code: Select all

Account User Name   askmacos
Primary Domain Name   askmacos
Current Home Directory   /home/askmacos
Current Mount Point   /
Current Partition   /dev/md1
Current Disk Usage   6595516 / 40153596 Blocks used, ( 17% Free )


Checking df -h command I have:

Code: Select all

Filesystem         Size  Used Avail Use% Mounted on
/dev/md1         39G   31G  6.3G  83% /
devtmpfs          48G     0   48G   0% /dev
tmpfs               48G     0   48G   0% /dev/shm
tmpfs               48G  9.0M   48G   1% /run
tmpfs               48G     0   48G   0% /sys/fs/cgroup
/dev/md0        283M  111M  154M  42% /boot
/dev/md2        899G   77M  853G   1% /data
/dev/loop0      1.5G  2.5M  1.5G   1% /tmp
tmpfs              9.5G     0  9.5G   0% /run/user/0


The problem is that all data of my website and new hosting account that I create will be place in "/" directory because it is current mount point while the /dev/md2 which mounted to /data has much more free space. I would to change the current mount point of this account (root account) to /data. How could I do

Another question is that I see others partitions: devtmpfs, and 4 tmpfs with large space. I would to optimise space for the web. Is it possible and show me how please.

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

Re: Change Current Mount Point and rearrange partition

Postby TrevorH » 2017/07/17 18:53:22

All the tmpfs mounts are RAM + swap so you are not using any disk space there and they are like that for performance reasons.

If you umount /data and edit /etc/fstab you can change where /dev/md2 is mounted. To test it without rebooting use mount -a after amending fstab so you can make sure it mounts without error. You can mount /dev/md2 on the place where you most need the space although you will need to copy the data from one to the other before you mount it over the top.

Personally I would not do that. I would umount /data and remove it from fstab then turn /dev/md2 into an LVM PV, create an LVM VG (vgcreate) using that new PV and then make new LVs from the VG, run mkfs against the LVs and mount those where you need the space.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

osxio.com
Posts: 3
Joined: 2017/07/17 17:49:35

Re: Change Current Mount Point and rearrange partition

Postby osxio.com » 2017/07/17 19:36:27

Following the 1st approach, so all steps I have to do are:
- unmount /data from /dev/md2
- edit /etc/fstab to mount /dev/md2 to / where is current mount point of /dev/md1

As mentioned: before do that I have to copy all data from /data to /

So after that the / directory will has biger space (from /dev/md2)

Is it right? Just confirm because I have no experience with Linux

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

Re: Change Current Mount Point and rearrange partition

Postby TrevorH » 2017/07/17 20:33:34

No - do not attempt to mount it as / - that will fail to boot. The idea is that you mount it on the *directory* where you most need the space.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

osxio.com
Posts: 3
Joined: 2017/07/17 17:49:35

Re: Change Current Mount Point and rearrange partition

Postby osxio.com » 2017/07/18 03:55:01

But as you see:

Code: Select all

Account User Name   askmacos
Primary Domain Name   askmacos
Current Home Directory   /home/askmacos
Current Mount Point   /
Current Partition   /dev/md1


the askmacos user has Current Mount Point is "/" and Current Partition is "/dev/md1 which sized only 40GB. I want this user use /data as current mount point and /dev/md2 as current partition so I can use full disk for hosting.

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

Re: Change Current Mount Point and rearrange partition

Postby TrevorH » 2017/07/18 06:56:35

I suspect the important one is "Current Home Directory /home/askmacos"
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

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

Re: Change Current Mount Point and rearrange partition

Postby jlehtone » 2017/07/18 07:05:43

Apache configuration says where the files of an URL are on the server. You could change there that the path is /data-something, not /home/askmacos-something.

Homepath is part of account definition. It does not have to be /home/askmacos. However, moving yourself can be tricky.

Personal files of an account contain data that should never be in a directory that the Apache shares out. The website data should be in a directory of its own. (Could be a subdirectory.)

If you cannot update the Apache config, then:
The mount has a "bind" option. You have / and /data mounted. You can mount /data/foo into /home/askmacos/bar.
mkdir /data/foo and /home/askmacos/bar
add a file into /data/foo
append to fstab:

Code: Select all

/data/foo /home/askmacos/bar none bind 0 0

mount /home/askmacos/bar
you will see the file in /home/askmacos/bar


You will have to fix permissions and selinux contexts for Apache to see the new locations.


Return to “CentOS 7 - General Support”

Who is online

Users browsing this forum: No registered users and 2 guests