0

I have an Ubuntu server 12.04 with a corrupted ext4 file system on my /tmp partition :

$ dmesg | tail
[25300713.878456] end_request: I/O error, dev vda, sector 2019854
[25300713.882430] Aborting journal on device dm-0-8.
[25300713.969861] end_request: I/O error, dev vda, sector 1965862
[25300713.972127] Buffer I/O error on device dm-0, logical block 196608
[25300713.973351] lost page write due to I/O error on dm-0
[25300713.973450] JBD2: I/O error detected when updating journal superblock for dm-0-8.
[25300746.138426] EXT4-fs error (device dm-0): ext4_journal_start_sb:327: Detected aborted journal
[25300746.139792] EXT4-fs (dm-0): Remounting filesystem read-only
[25387373.536038] EXT4-fs (dm-0): error count: 2
[25387373.536043] EXT4-fs (dm-0): initial error at 1407997573: ext4_journal_start_sb:327
[25387373.536047] EXT4-fs (dm-0): last error at 1407997573: ext4_journal_start_sb:327
[25473881.056039] EXT4-fs (dm-0): error count: 2
[...]

I'm on a VPS, and I have no idea how to fix this. Before I do something that may break everything, I want to backup the server, espacially the MySQL database.

Now, I tried to do this :

ssh username@ip  "mysqldump -u user -ppwd db" > ~/Bureau/db.sql

But it complains it can't do some queries because of the read only /tmp.

My second thought was to rename /tmp (or umount it), and create a /tmp link on one of the working partitions. It didn't work, complaining /tmp is busy.

I would like to avoid restarting MySQL if possible, since I don't know if it will restart properly.

Sven
  • 98,649
  • 14
  • 180
  • 226
Bite code
  • 409
  • 5
  • 17
  • 1
    Is this a VPS? If yes, talk to the hoster, as it appears the physical storage has issues. – Sven Aug 27 '14 at 09:46
  • I know, that's why I want to backup. – Bite code Aug 27 '14 at 10:21
  • Yeah, but you *must* store the backup somewhere else, not on the VPS. There is a problem with the disks and it's possible that you can't access this backup anymore afterwards. If all else fails, just `scp` the actual MySQL files in `/var/lib/mysql` (or wherever) to some external storage. – Sven Aug 27 '14 at 10:24
  • yes, that's why i used ssh from my local machine to do so. This command stores on my laptop the dump from the remote machine. – Bite code Aug 27 '14 at 10:31
  • Instead of doing it like that, just copy the files with `scp`. – Tero Kilkanen Aug 27 '14 at 20:39

2 Answers2

3

You can point another dir with mysql cli

set global tmpdir = "/path/to/dir".

This new tmpdir can be actually created as tmpfs and store in memory, not on actual corrupted file system.

Navern
  • 1,619
  • 1
  • 10
  • 14
1

You have a more serious problem. Basically, what the log is saying in plain English is that "Sorry - I cannot maintain filesystem consistency anymore, I give up and switch to read only mode to avoid completely trashing it". This is an extremely serious issue that takes priority. Raise a support issue with the hoster ASAP. In the meantime try to do the following to get a remote backup

mysqldump --host servername dbname > dbname.sql

which of course might fail, given the system is in a erroneous condition.

Check /etc/my.cnf and see the settings for [mysqldump] tmpdir=/tmp

but now you are faced with a potential chicken and egg problem since if you edit /etc/my.cnf, you might need to restart MySQL for the changes to take effect.

thanasisk
  • 941
  • 6
  • 16