Link to home
Start Free TrialLog in
Avatar of Simon Leung
Simon Leung

asked on

Check disk space on Centos 8

My website is saved under /var/www/html/website.  Which location does count in "du -H". How can I know the total usages under /var/www/html/website.  Thx

User generated image
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

sda1 is the drive which is 27% full with 285MB used
Avatar of Simon Leung
Simon Leung

ASKER

Do u mean my web folder is located under :

/dev/sda1                1.1G  285M  780M  27% /boot

The total disk of my centos is 500GB. Do it mean the website can use max of 1.1GB only ?
actually less since the operating system needs some disk space.  so you can only use 780M more
df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  4.9G   46G  10% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G   81M  1.8G   5% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-home  445G   33M  445G   1% /home
/dev/sda1               1014M  271M  744M  27% /boot
tmpfs                    379M     0  379M   0% /run/user/0


 

Does it mean there is no way to use the 445G   ? Is it possible to extend /html folder to use the disk space there ?

Thx
In the file  
"Disk /dev/mapper/centos-home: 477.9 GB"

"/dev/mapper/centos-root   50G  4.9G   46G  10% /"

"Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  4.9G   46G  10% /

 - it seems that 477.9GB has been allocated to  /dev/mapper/centos-home.
 - Under here (477.9GB), 50GB is allocated to "/". My website is located here /var/www/html/website. Hence, it can only used up to 50GB

Correct ?

How can I extend the space from 50GB from the existing free space in my Centos ? Thx again.
DiskUsage.txt
bind mount is your friend. Move your data to somewhere on the big disk.For safety, you might want to copy it and satisfy yourself the copy is good before you rename the original (for later deletion). Servers have to be stopped while you do this: best might be to take the system down to single-user run level. Create empty directory /var/www/html/website. Create a /etc/fstab entry to bind-mount your copied directory onto this new directory e.g.
/home/website /var/www/html/website none bind 0 0

Open in new window

When the system is multi-user again, /var/www/html/website will have 470GB available to it.
Note 1. The directory under /home can be called anything you like. Change the first field in the fstab line to match.
Note 2. You can use this for /var/www/html/website. /var/www/html or /var/www but not /var which is a system directory.
Thx. Something need to clarify

Create empty directory /var/www/html/website.
- my current website is located in this folder Do you mean I need to remove all files there.

Create a /etc/fstab entry to bind-mount your copied directory onto this new directory
- /home/website /var/www/html/website none bind 0 0

Is "/home/website" the new created directory ? What's the "/var/www/html/website" and where does it locate ?
Your original question, "How can I know the total usages under /var/www/html/website" is answered using this command...

du -hs /var/www/html/website

Open in new window


Or something similar...
Which location does count in "du -H"

it is the first entry (/dev/mapper/centos-root); not /boot
there is 49gb free where your website resides

Do u mean my web folder is located under :

/dev/sda1                1.1G  285M  780M  27% /boot

no it is not under /boot
there is no separate mount point for /var so it would be in the root

best might be to take the system down to single-user run level.

seems to be more trouble than it's worth
better off stopping apache, moving www to /home and create a symlink in /var for www pointing to /home/www and be done with it
ASKER CERTIFIED SOLUTION
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial