-   Linux - Newbie (
-   -   Partition scheme on a hosting plan (

AdultFoundry 01-07-2016 07:43 AM

Partition scheme on a hosting plan
I got a dedicated server (low cost) and the partition scheme looks something like this:

1) 1004.5K - type BIOS - boot partition - primary
2) 19.5G - type Linux - filesystem - primary
3) 1.8T - type Linux - filesystem - primary
4) 511M - type Linux - swap - primary

It is something like this:

1) primary - ext4 - / - 20GB
2) primary - ext4 - /home - 1980GB
3) primary - swap - swap - 512MB

I understand the swap space (even though it could be probably larger, since the plan comes with 4GB of RAM <how large should it be?>) but what is the purpose of the 20GB one?

TobiSGD 01-07-2016 08:37 AM

Regarding the swap partition, it should be as large as needed for your specific workload, general rules are not of much worth.
In your partition scheme you have a 20GB partition for system files (binaries, libraries, configuration files, logs, ...) and a partition for user data called /home. This is done to separate user files from system files, so that you can reinstall the OS without having to backup and restore the user data. Of course that doesn't mean you shouldn't backup the user data before doing system critical changes, but it simplifies many things.

AdultFoundry 01-07-2016 10:16 AM screenshot

It looks something like this. I am still researching this / looking into it, but what would be all the tmpfs and the devtmpfs. I guess it is temporary file system, but what is this for?

So the 20G one is /dev/root mounted on /
1.8T one is /dev/sda3 mounted on /home

What would be the /dev, /dev/shm, /run, /sys/fs/group, and /run/user/0 ones?

### Edit:

I guess I only care about / (the 20GB one), and /home (1.8T one), and I can increase the size of the swap one, if needed. The other ones are some kind of temporary file systems that are there because of how the system (CentOS7) works...

pan64 01-07-2016 10:26 AM

tmpfs are used to create filesystems which can be lost when you switch off your host. They are simply stored in RAM because it is much faster than anything else.
/ is used to hold the os itself and /home is for the files of the users.

AdultFoundry 01-07-2016 10:35 AM

I will be the only user of this hosting plan. Most of what I will be doing is hosting websites (mostly picture files). The DocumentRoot for Apache web server is /var/www/html, so I guess, based on this /home layout, I will be running it from /home? I mean I can do that, but would I consider changing something with this (file system / partitions, to begin with)? Or just leave it as is?

### Edit:

I guess I will leave it as is and work from this / and /home model, since this is good.

TobiSGD 01-07-2016 11:02 AM

For more information about the different directories in your Linux system and what their purpose is I recommend to read the Linux Filesystem Hierarchy Standard:

AdultFoundry 01-07-2016 11:16 AM

"Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

So, if:

M = Amount of RAM in GB, and S = Amount of swap in GB, then
If M < 2
S = M *2
S = M + 2

Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM)."

AdultFoundry 01-07-2016 11:26 AM

I did not do anything to the hosting plan, and I can just reinstall the system. I increased the swap partition to 5926MB / 5.926 GB (based on S=M+2, 4GB RAM -> 6GB swap). I am already installing it with the 20GB / directory. Would it make some kind of sense to increase the size of it too (or change its size)?

TobiSGD 01-08-2016 08:13 AM

Again, those kind of general rules about swap size are bogus and have no real meaning. The size swap should have on your system is solely dependent on your workload. I currently have two systems running totally without swap (one with 4GB, one with 16GB of RAM), and they are running totally fine since their workload never exceeds that amount of physical memory installed.
Having said that, it doesn't matter if you have to much swap, though it will matter if you have not enough, so if you feel safer with adding more swap there is not much wrong with it, especially when using disks that large that a few GB less of usable space don't matter.

All times are GMT -5. The time now is 06:57 AM.