We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

/ partition nearly full ( Issue )


nowwhat
01/06/2016, 11h29
Citation Envoyé par NLBlackEagle
Somehow the regular localhost wasnt working for me,
As a sysadmin, the word 'somehow' doesn't exist
Just ask your server:
root@ns311465:~# netstat -napt | grep 'mysql'
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 21820/mysqld
tcp 0 0 127.0.0.1:3307 0.0.0.0:* LISTEN 1317/mysqld
My example shows that on localhost (127.0.0.1) port 3306 (default) a MySQL server is listening - and on port 3307 another one (I'm using MySQL and mariadb)

Citation Envoyé par NLBlackEagle
I have no clue how it exeacly happend but well, it's fixed now. I totaly love having all the files within the /home directory ...
Different sites 'should' all run with different identities, and this is where the /home directorty comes in very handy : every (system) user created on the server has its own folder in this directory. In every user's directory you'll be having a webroot (web server) folder, often called /www/ with the site's files, perfectly isolating one user to another. The big gain is : if one site gets hacked, other sites can't be contaminated (pishing pages, etc).
But : the database runs for everybody, and isn't related to a user (except 'root' and 'mysql') and shouldn't be in /home, but in the systems "live files folder" which is /var/...
Anyway : if it's fine for to you, all is well

NLBlackEagle
01/06/2016, 00h08
Somehow the regular localhost wasnt working for me, I have no clue how it exeacly happend but well, it's fixed now. I totaly love having all the files within the /home directory aswell, It makes life easier haha, while at it I've made a couple backups aswell as they function as backbone for the server.

nowwhat
31/05/2016, 23h36
Citation Envoyé par NLBlackEagle
....
(P.S. it required one more change within the WordPress settings: define('DB_HOST', 'localhost:/home/mysql/mysql.sock'); It's all fixed now ....
I'm using WP on my server as well.
But I never needed the socket info.
I use the default :
define('DB_HOST', 'localhost');
because PHP can use sockets or, far more common, it connects to local IP: 127.0.0.1 (== 'localhost) (or ::1 which is the IPv6 equivalent) , port 3306 (which is the default value for 'MySQL' : see your /etc/mysql/my.cnf).
Sockets is just a way to connect to a (local) server.
IP addresses and ports are another.
And guess what : there are even more ways

Btw : http://dev.mysql.com/doc/refman/5.7/en/connecting.html

NLBlackEagle
31/05/2016, 22h32
A last word : you said you didn't have time to redo the server. You don't want to have your server down for a long time.
Your making a HUGE mistake.

That's where I got all my experience aswell as knowledge on mount commands from. I do have my backups and a ton of self written guides hidden in my system. It's more because I honor the saying "If something works it shouldnt need fixing" As for KS, I do know that it's for starters but Its cheap aswell which is why I didnt upgrade to a better plan ( yet )

So, yes I have everything ready to do a complete reinstall but from my past experiences I do never expect something to work the first time so a simple system reinstallation can take up from 30 minutes to 3 weeks. ( As you said, If you do not have that 'hands-on' experience, it will take more. )

Anyway, thanks for the information! I'll check out the SoYou packages and may upgrade in the near future

(P.S. it required one more change within the WordPress settings: define('DB_HOST', 'localhost:/home/mysql/mysql.sock'); It's all fixed now Time to change the whole www directory to a /home directory. This will make it a whole lot easier to orginize everything aswell )

nowwhat
31/05/2016, 21h23
Citation Envoyé par NLBlackEagle
....
Changed:
.....
socket=/var/lib/mysql/mysql.sock
to:
socket=/home/mysql/mysql.sock
Ok, good, but do you know what a socket is ?
From a certain point of view, its a file ..... but all resemblance stops there.

You should know that this 'socket' is the 'listen' point of MySQL (or mariadb) for clients .... like ... the PHP interpreter.

Check out your php.ini - you will find something like this
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysql.default-socket
mysql.default_socket =
So, what is YOUR PHP actually using ? Just check the output of this phpinfo() :
Mine says :
"/var/run/mysqld/mysqld.sock"
Which correspond exactly with this line in my /etc/mysql/my.cnf :
socket = /var/run/mysqld/mysqld.sock

(strange : it shouldn't be in /var/lib/mysql/.... at all - what is your OS ?????? (ok, found it, CentOS : they do thing .... well .... different. )

So, if you move the place where the socket is being put by MySQL (or mariadb), then change also the definition of the place used by the client.
The client could be your PHP - your Teamspeak server, your mail server, whatever....

Got it ?
Now you are fully understand this error message from PHP :
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/wp-includes/wp-db.php on line 1520
PHP is looking for the socket here : /var/lib/mysql/mysql.sock but naughty you, you put it elsewhere


Of course, keeping /var/lib/mysql/..... and symlinking to another place, which is what you did, is far more easier.

A last word : you said you didn't have time to redo the server. You don't want to have your server down for a long time.
Your making a HUGE mistake.

You have a KS.
Did you know what happens how long it takes to get it back up when you're disk dies ? Give or take it a week - IF you have the experience to rebuild (== re install everything) fast.
If you do not have that 'hands-on' experience, it will take more.
And all this IF the disk gets replaced in 5 (working days + weekend - disks always die on Friday evening, disk are out of stock on Monday etc, and get replace Tuesday or Friday - Murphy already said so).
Btw : yes disk do die - check out this forum ....

So, If you think that what you do with your server is important, start removing some risks.
Leave KS for starters.
Get a SYS server at least (faster and more serious service, Raid 1 disks, more IP's, etc)
KS is a training server, and an international rule says : if the school close (you know, the training place) then kids are happy.
Are you happy when your training place (== KS) goes down ?

NLBlackEagle
31/05/2016, 19h07
Thanks for the help! I've decided to follow the simple solution as beside the website there are quite some programs and gameservers installed on the dedicated server. Setting them all up again takes atleast a full day which I saldy can't affort as I also have a webshop and alot of traffic on both the TeamSpeak server as the Website itself.

I always respond here as last solution to a error due to many reasons one of these is simply described: I own a webshop containing "software" which I've created so I know how it's like to get a ton of "stupid" questions, not that I mind as I ask them myself way to often haha. The second one is because I usally get complicated anwsers. However, yours make 100% sense which I really like and apriciate

Anyway, the webserver transfer sounds quite good aswell. I'll try that with a copy after I've moved the datadir to /home/mysqldata I'll try googling a bit but if there's something you can add to this solution please dont hestitate

Bedankt!!

[UPDATE]

After following the steps of the simple solution I've got the following error when browsing for the website:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/wp-includes/wp-db.php on line 1520

Here's what I did:

service mariadb stop
service httpd stop

cd /var/lib/mysql
cp -p -r * /home/mysql
cd /etc
vim my.cnf

Changed:

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

to:

datadir=/home/mysql
socket=/home/mysql/mysql.sock

wq!
cd /home
chown 27:27 mysql
service mariadb start
service httpd start



Here's the var/log/mariadb file:

160531 18:26:46 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
160531 18:28:41 mysqld_safe Starting mysqld daemon with databases from /home/mysql
160531 18:28:41 [Note] /usr/libexec/mysqld (mysqld 5.5.47-MariaDB) starting as process 17131 ...
160531 18:28:41 InnoDB: The InnoDB memory heap is disabled
160531 18:28:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160531 18:28:41 InnoDB: Compressed tables use zlib 1.2.7
160531 18:28:41 InnoDB: Using Linux native AIO
160531 18:28:41 InnoDB: Initializing buffer pool, size = 128.0M
160531 18:28:41 InnoDB: Completed initialization of buffer pool
160531 18:28:41 InnoDB: highest supported file format is Barracuda.
160531 18:28:41 InnoDB: Waiting for the background threads to start
160531 18:28:42 Percona XtraDB (http://www.percona.com) 5.5.46-MariaDB-37.6 started; log sequence number 5620780694
160531 18:28:42 [Note] Plugin 'FEEDBACK' is disabled.
160531 18:28:42 [Note] Server socket created on IP: '0.0.0.0'.
160531 18:28:42 [Note] Event Scheduler: Loaded 0 events
160531 18:28:42 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.47-MariaDB' socket: '/home/mysql/mysql.sock' port: 3306 MariaDB Server



my.cnf

[mysqld]
datadir=/home/mysql/mysql
socket=/home/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

website: www.craftrealms.org


[SOLUTION]

as mysql user:

ln -s /home/mysql/mysql.sock /var/lib/mysql/mysql.sock

nowwhat
30/05/2016, 09h09
Hi.
The issue is classic.
Consider:
Citation Envoyé par NLBlackEagle
....
/dev/root 20G 15G 3.5G 82% /
.....
/dev/sda3 1.8T 40G 1.7T 3% /home
Your server is partitioned for 'multiple users', so each user (all starting their private 'root' in /home/ can have a big work space.
Web sites, etc should be rooted also in /home/userxxxx/webroot/ etc.

What happened is that your web site(s) isn't in /home:/..., neither is your database, neither the OS (logic) etc.
/home/ isn't used and the root partition / is nearly full.

The best solution : reformat all, and this time, knowing you are NOT using the /home partition, chose a small one, making the root partion bigger.
Next best : redo the partition on the fly .... but : try this FIRST with your own PC If you still like this procedure (ONE error and you loose all) apply it to your server. It's possible, but more an expert procedure. The fact that you even didn't know about partitions scheme indicated me that you probably shouldn't chose this solution

Simple solution :
Create a directory called (example) imysql in /home
Inspect your /etc/mysql/my.cnf
Look for "datadir", it should read something like "/var/lib/mysql"
STOP the MySQL server
Copy all files and dirs in "/var/lib/mysql" to "/home/mysql" - RESPECT OWNER and file rights !!!!
Change the datadir in /etc/mysql/my.cnf from "/var/lib/mysql" to "/home/mysql".
Save
Start MySQL server and inspect its log - if he is happy (== running ok) than your done.
If all is well, just delete your original 'datadir' location (my example was using /var/lib/mysql).

Tip of the day : you can also move entire web sites like this. Your web server knows where to look for which directory is used for which web site, so change the location (to somewhere in /home/...).

Even faster alternative : just symlink the datadir directory ! Document yourself about le 'ln' command.

( Google het onderwerp ook even zodat het allemaal goed duidelijk voor je wordt )

NLBlackEagle
29/05/2016, 14h58
Hello everyone,

While on vacation I found out that my website wasnt running anymore due to the fact MYSQL has run out of disk space. I resolved this issue by deleting a couple files, however I'm afraid due to the traffic on the website this will only be a tempeoary fix.

I have searched around the web but being afraid of deleting important data & making big mistakes while trying to increase the partition brought me here.

So, could anyone assist me in cleaning and/or increasing the / partition?

Server Information:

CentOS 7.2-1511 (64bits)

df -h result:

[root@mail /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 20G 15G 3.5G 82% /
devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs 7.9G 520K 7.9G 1% /dev/shm
tmpfs 7.9G 66M 7.8G 1% /run
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sda3 1.8T 40G 1.7T 3% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0