MySQL error: "The partition with /var/lib/mysql is too full!" df -h shows otherwise

6,565

Always control services as root.

While you can log in as root to control a service, it isn't recommended.

Instead, use either:

sudo /etc/init.d/mysql restart

Or:

su -c "/etc/init.d/mysql restart"

The former requires the logged in user to be configured within sudo. This involves being a member of a certain group - the group depends on the distro. The advantage is that the user will be using their own password.

The latter will involve the logged in user having the root password to run the command.

Share:
6,565
jjacobson
Author by

jjacobson

Updated on September 18, 2022

Comments

  • jjacobson
    jjacobson over 1 year

    my rented server is currently saying that mysql is too full when trying to start it when using /etc/init.d/mysql start. However using sudo /etc/init.d/mysql start it works normally.

    Running df -h shows that there are no full partitions

    Filesystem      Size  Used Avail Use% Mounted on
    rootfs           20G  1.5G   17G   9% /
    /dev/root        20G  1.5G   17G   9% /
    devtmpfs         32G  4.0K   32G   1% /dev
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    none            6.3G  752K  6.3G   1% /run
    none            5.0M     0  5.0M   0% /run/lock
    none             32G     0   32G   0% /run/shm
    none            100M     0  100M   0% /run/user
    /dev/md2        127G   11G  111G   9% /home
    

    as requested df -i

    Filesystem      Inodes  IUsed   IFree IUse% Mounted on
    rootfs         1281120  45568 1235552    4% /
    /dev/root      1281120  45568 1235552    4% /
    devtmpfs       8242291   1516 8240775    1% /dev
    none           8250649      2 8250647    1% /sys/fs/cgroup
    none           8250649   1031 8249618    1% /run
    none           8250649      1 8250648    1% /run/lock
    none           8250649      1 8250648    1% /run/shm
    none           8250649      2 8250647    1% /run/user
    /dev/md2       8462336 990512 7471824   12% /home
    

    I am confused because mysql claims its full when restarting normally, but then lets me restart it when using sudo, and df -h shows that there is plenty of space.

    Thank you for the help.

    • Dom
      Dom over 9 years
      Could you add a df -i ?
    • jjacobson
      jjacobson over 9 years
      @Dom added df -i
    • garethTheRed
      garethTheRed over 9 years
      What do you mean "restarting normally, but then lets me restart it when using sudo"? Exactly what is "restarting normally"?
    • Pratap
      Pratap over 9 years
      Can you provide exact error with the restart command which you are using to restart?
    • jjacobson
      jjacobson over 9 years
      @garethTheRed When not using sudo it fails to start and I get /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
    • jjacobson
      jjacobson over 9 years
      @PratapSingh I get /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
    • garethTheRed
      garethTheRed over 9 years
      What command do you use when you're not using sudo?
    • Pratap
      Pratap over 9 years
      in your df command we do not see any partition as /var/lib/mysql ? Can you check what is your datadir in my.cnf? provide output of command "ls -ald /var/lib/mysql/"
    • jjacobson
      jjacobson over 9 years
      @PratapSingh That outputs drwx------ 7 mysql mysql 4096 Sep 17 02:31 /var/lib/mysql/
    • jjacobson
      jjacobson over 9 years
      @garethTheRed The same command but without sudo "/etc/init.d/mysql restart"
    • garethTheRed
      garethTheRed over 9 years
      But are you logged in as a normal user or as root? If the latter, why are you using sudo as root? (other than because it works of course!)
    • jjacobson
      jjacobson over 9 years
      @garethTheRed That's actually a good point. I was logged in as a normal user. Would that cause the "is full" error?
    • garethTheRed
      garethTheRed over 9 years
      I would expect it to complain about Permissions. I've just installed it on a Ubuntu VM and it does indeed also compain about the partition being too full! How odd :-). Anyway, always restart it as root and you'll be fine.
    • jjacobson
      jjacobson over 9 years
      Wow thanks @garethTheRed That is really weird that it says its full.
    • jjacobson
      jjacobson over 9 years
      Thanks a lot for the help @PratapSingh, looks like it was a weird permissions thing. I am not sure why it would use that as the complaint instead of not having permissions.