Server is back up after a crash of sorts. Apparently, it is a bad idea to
reboot the server that serves you NFS shares while watching some TV series
served from said NFS share. The result is that my 3TB drive now believes it is
only 800 GB, and I’m unable to mount any file system on it, since the file
system is configured for 3TB. Also, when troubleshooting the usage of a
graphics card, remember to have all your RAM modules firmly in place, or you
may not get any graphics output at all.
UPDATE: The disk is now fully functional again, and as far as I can tell by
playing some random media files from it, nothing has been lost. Since I suspect
more people will have this problem, here’s what I did in the end. The problem I
had was that the disk somehow believed itself to be smaller than its actual
size. Since the partition table and file system on the drive were set to its
actual size, this made it impossible to do anything before fixing this problem,
since a new file system (for example) would mean losing all data. Here goes:
Make sure your kernel has support for IDETASKIOCTL since this is used by
hdparm for what you’re about to do
Call hdparm --yes-i-know-what-i-am-doing --dco-restore /dev/sdX. Note that
this command is marked as dangerous in the manual, so use at your own risk. It
makes kind of a factory reset for the basic disk values, but it does not erase
any data, really. In my session hdparm reported I/O error when issuing the
command, but it seems to have worked anyway.
Repartition the disk with gdisk or fdisk or whatever. Since my disk was a
storage disk, I only had one big partition on it, so restoring that was easy.
Run a file system check, in my case fsck.ext4. For me at least, some values
in the file system did not match, so fsck fixed those.
Mount the disk!
A log of what I did can be found below I’ve edited out a couple of calls to dmesg
| tail, but I recommend anyone checking the status there regularly during such
an operation. From looking at the gdisk output in the log, you can see that I
did overwrite my partition table with a new one (746 GiB partition). I would
advice against that, even if the partition tables doesn’t touch any data.