Our system recently stopped working--we can still SSH, but most programs on our server result in an Input/Output error, so we can't SSH out of the server, open FTP to it, etc.

I have a MySQL database I absolutely must not lose--I can see the files in /var/lib/mysql just fine, but I have absolutely no way to get them out of the system. The drive /dev/sda4 on / with type ext4 is the bad one--as I understand it, I need to run fsck, but these prompts scare me quite a bit.

If I see the files in /var/lib/mysql, it means they're okay, and there's no way fsck will delete them if part of them are damaged? I can just run fsck -y and stay calm? My provider told me that I need to shutdown the system to connect the new HDD to move my stuff to it, but I am incapable of rebooting without repairing the drive.

Can I run fsck -y without worrying?

  • I would probably not risk it. Don't you have any way to back up your files first? Normally fsck should not do more harm than good, but who knows what happens on a corrupted file system... – Byte Commander Aug 7 '17 at 22:52
  • 1
    the best thing to do if you have an external drive, clone the faulty drive to the external, the attempt repair/recovery on the external. – ravery Aug 7 '17 at 22:57
  • That's the thing, I don't know of any way to back them up. I am incapable of SSHing; incapable of using SFTP; incapable of using PSCP; incapable of generating so much as a gzip. The only writable place I found is /dev. No other hard drives available; provider demanding to shut off the server in order to connect the hard drive. – Azar Aug 7 '17 at 22:57
  • clonezilla.org/downloads.php here is a bootable drive clone similar to norton ghost. any the server will have to be shut down in order to replace the fautly drive. and do repairs. even fsck should be done on an unmounted partition – ravery Aug 7 '17 at 22:59
  • 1
    WinEunuuchs2Unix: The server is on a datacenter in a different continent. I am incapable of executing most programs on the server--mysql, mysqldump, even fdisk, nothing is working due to input/output errors. And I cannot write to anywhere on the system except /dev and /run as it's in read-only mode. – Azar Aug 7 '17 at 23:11

First, yes fsck is safe[1] (with caveats[2]) to run on a faulty disk/partition if you unmount the disk/partition before.

Having just one drive/partition, this is possible by starting the Runlevel 1 mode (calling init 1).

However, be aware that your SSH connection will down at that moment because init 1 will kill[3] all services and daemons (and SSH is one of them).

Second, about your need of a mysql backup, I would try to do the following:

  1. Make a SSH-tunnel onto your existing SSH session [4];
  2. Run mysqldump remotely [5];
  3. Check the *.sql generated by mysqldump;
  4. And call authorized service to replace the damaged drive.


Best regards!

  • In the end, the MySQL database survived, thanks! Though, I was incapable of making and pulling a backup because the program mysqldump, and really most others, even base64, were giving Input/Output error. – Azar Aug 9 '17 at 11:24
  • Nice! I'm glad that your database is safe! Did you try the mysqldump remotely via SSH as I described? I'm curious to know if in your critical case it works. – Matt Mello Aug 11 '17 at 23:57

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.