I hate restarting servers. What I hate even more is reinstalling server operating systems when something goes horribly horribly wrong.
My mum is a maths teacher at our local school, and she brought back a laptop with a broken screen (she had permission) from work, thrust it at me and said "make server pl0x".
A server I did make, and for a while it was good. I had a Plex media server set up so we could stream movies from our external hard drive to the smart TV and other devices.
The issue is that while the server works and performs its functions, it doesn't exactly have server grade hardware. This means it can't transcode video files for plex all that quickly, and the result is a quite a bit of lag when you're trying to watch higher quality video files.
So at one point, we're watching a movie and she asks me to just go unplug the external hard drive that the laptop is reading the movies from and plug it straight into the TV, and in fairness I did this part right - I unmounted the USB drive just fine, and we watched the movie with no interruptions. But here's where I made a fatal mistake, somewhere along the line:
While we were watching the movie, I turned off the laptop, unplugged everything and took it with me into the living room so I could open it up and see if it was possible to upgrade the CPU (the answer is no... it's an HP laptop and I didn't want to dig too deep into its guts. but it was worth a look.)
The horror part of this story comes in when I tried to start up the server again a few days later and set up the plex server once again.
Normally, when I power on the laptop server, I open CMD and enter "ping -t 192.168.178.33" which in windows, pings the target device forever until you cancel the process with CTRL+C. However, it had been a good few minutes now and it still wasn't receiving any responses which was unusual.
So I plugged the laptop via HDMI into my desktop monitor. I didn't really like what I saw.
No boot device found!
Fuck. Maybe i just left the HDD unplugged?
I opened up the laptop again to make sure.
That's the most plugged in HDD I've ever seen.
I put everything back together and ran a disk check.
Unfortunately however the result of this was that the disk was fine and there was nothing wrong with it. Which is annoying, as I was hoping the BIOS firmware would pick up whatever the problem is and fix it for me.
I figured I could go online, ask around and figure out exactly what the problem is, but realistically:
Since I already had an ISO of Ubuntu server sitting around in my files, as well as a copy of Rufus, it took me just a few minutes to write the new image to a USB flash drive.
I like to mess around and tinker with Linux quite often, so I have this "Linux Stuff" folder at the ready for anything like this
In this instance, since I'm not dual booting this device (like I do on my desktop) I can just select "Use the whole damn disk you rascal". Which is nice, as manually setting up partitions for your system can be a royal pain in one's backside.
While I was writing this tutorial it occurs to me that the OS can see that the HDD itself is 1tb in size, but when it partitions the disk for the operating system it only displays 200gb as writable storage...
However, post-installation, the results of "sudo fdisk -l" shows me all the available drives, and clear as day we can see my HDD at a size of 1tb.
furthermore, the results of fdisk on my drive indicate that all the space has been partitioned and ready for use
this must just be a linux thing I'm not getting. A bridge that shall be crossed when I get there.
From here, it was just a matter of waiting for the process to finish.
After I had installed the OS, I attempted to do my usual SSH into the laptop from my Windows PC, and was surprised to see this warning come up:
Despite being completely identical to the previous setup, minus the OS install date, Windows recognised it as a foreign entity and claimed that someone could be performing a MITM attack between my server and my PC, which is physically impossible. I then had to go to my C:\users\voter/.ssh/known_hosts file, and instead of adding the new key like the warning implied, I simply deleted the old one, which added the new key to the file with no fuss on the next attempt to shell into the laptop.
Awesome! The server's back online. Now I just have to mount the external drives.
...and set up samba.
...and re-install Plex.
As much as I love Linux, doing all this stuff without a GUI is a pain in my butthole. At least it's running now, so I can do it from the comfort of my desktop.