1

We have a dedicated server with OVH. We can access the server via SSH and WHM Cpanel. We want to increase the size of dev/sda2 partition. It is only 20 GB. And running out of space frequently (every other day). So we want to increase the size to at least to 50GB. How can we do it. Can you please provide technical guidelines to increase the space on dev /sda2 partition without disrupting the files. We have several websites hosted in that server. So we dont want to disrupt the live websiotes. But want to increase the spce in that disk.

After logging in to the server as root and SSH ; We have used df -h to see how much space is left. as you can see from the screenshot /dev/sda2 has only 20 gb space and out of which 17Gb is full.

enter image description here

we are not knowledgeable enough in server and linux sector.So we cannot get much information from the similar type questions .

Additional Information

The var/log is filling up all the space. We clear the folder as temporary fix.

enter image description here

6
  • 1
    Just my 2 cents: if you got no idea how to manage a linux server, maybe you shouldn't be operating one. Seeing as this server seems to run without lvm, you will need to repartition the harddrive (sda).
    – Panki
    Jan 29, 2020 at 11:06
  • 3
    Please do not post pictures of text. Post the text. Jan 29, 2020 at 11:07
  • Yes I agree. Currently we do not have anyone to manage it. And OVH whom we got the server does not provide any support at all. We are willing to hire someone for a day or week who has experience in that. But we do not know where to look and how to decide the right person
    – Bashabi
    Jan 29, 2020 at 11:09
  • @Panki - Does re partitioning (sda) will cause any disruption to the data? We are willing to hire some one for the job . Can you please guide us where to look for a freelancer and how to decide the right person.
    – Bashabi
    Jan 29, 2020 at 11:15
  • 2
    There is no reason to be rude. Thanks
    – Bashabi
    Jan 29, 2020 at 13:12

1 Answer 1

2

In Linux nearly everything is possible. The main question is, what is the reason, and what is the goal.

Your sda disk has two main partition: sda2 as / (root of the filesystem) and sda3 as /home/ . There would be some swap partition (may be sda1), too. In such case, you cannot simply do any repartitioning, without stopping your system for at least hours. But there is more simple way: Try to investigate, what directory grows so quickly. You can do that with du command:

du /* -sh

it will take some time, but I can bet the most growing directory should be /var/ , and mainly due to its /var/log/ subdirectory. Hence you can save you time asking the system:

du /var/* -sh

If it is so, you can create new subdirectory var/log inside the /home/ directory, because this is on the biggest partition.

mkdir -p /home/var/log

Then copy all content of the of the /var/log directory into the new one

cp --recursive /var/log/* /home/var/log/

Then comes the most delicate moment: you must disable the current /var/log/ directory e.g. rename it to /var/log_old/ and immediately create symlink /var/log -> /home/var/log. It could be fine to look at some man pages to know, what the symlink realy is. You can do that with:

mv /var/log /var/log_old && ln -s /home/var/log /var/log

If everything gone well, your system will continue to write all the logs into the new place. The second question is, why you save so much logs. The bad reason could be, your system annonces you lot of errors. In that case you definitely must analyse the error logs, find the problem and remove it. The not too bad reason could be, your system is set to log too deep annonces, warnings etc. You can try to set your system to be less verbose or you can reconfigure your logrotate subsystem to keep less history.

Please! be carefull with this described method, choose the time of minimum activity.

7
  • Thank you so much. Yes . you are right. this is due to var/log subdirectory growing fast.
    – Bashabi
    Jan 29, 2020 at 14:08
  • mv /var/log /var/log_old && ln -s /home/var/log /var/log - shall I run this command after creating symlink with this - /var/log -> /home/var/log
    – Bashabi
    Jan 29, 2020 at 14:09
  • 1
    /var/log -> /home/var/log is the graph only. The command to create the symlink is the ln -s .... It must be set at the end! The last command row contents two command mv and ln. The symbol && says: do the next command only if the first command succesfully ended.
    – schweik
    Jan 29, 2020 at 14:16
  • Okay.. Thank you .. just to be clear... /var/log -> /home/var/log - is not a command. right.? Sorry for such a silly question.
    – Bashabi
    Jan 29, 2020 at 14:26
  • 2
    You understand it well! No problem, we all started from the green table. You are welcome.
    – schweik
    Jan 29, 2020 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.