Geek Note:
An intervention is in order.
Please stop using Microsoft Internet Explorer.
I realize that change is difficult, but there are alternatives to your destructive lifestyle. For those of you using any version of MS-Windows, please consider downloading a modern web-browser like Mozilla Firefox, or Google Chrome (or Chromium). It's free, and there's really no legitimate excuse for using MSIE.

Although I do make some minor attempts to ensure this page will display properly under IE, I also can't help but thinking that anyone using a 1999 web-browser deserves to be served a 1999 web-experience and has no valid platform to complain upon.

And if you're still using Mosaic, then piss off. You might be all kinds of awesome for even remembering Mosaic, but you don't belong on today's internet. Fire up your Magellan search engine and go discover some straits or something.

Friday, November 8, 20134:11 PM

I've been rebuilding this old home-entertainment web-server that I built almost 10 years ago. I originally did it on a windows machine, and I just recently started trying to resurrect it under linux. I had the whole thing backed up on an external USB 1TB drive. Pulled the HDD out of the enclosure, and put it in the new server.

Problem #1: USB drive is NTFS. Linux can handle NTFS, but permissions get screwy and there's some overhead that slows down disk access. So I figure I should back it up, reformat it ext4, restore it, etc. And so long as I'm doing all that, may as well do it proper. Create an LVG, move /var, /opt, /home, and /usr each into their own LVs.

Problem #2: (arguably a bigger problem) I wrote the old server. No, seriously, re-read that, because I really do mean that one of the biggest problems with it is that it was written by me. I didn't write the server daemon itself, of course, but I designed the MySQL database, I wrote the PHP to do the queries and dynamically generate the pages, etc, etc... This can be subdivided into multiple problems. For one, it was PHP4. PHP4 has long since been fed to the dogs, and for many reasons besides just the dogs were hungry. For another, I didn't speak PHP... I was just teaching myself as I was writing it. With PHP4. So yeah. Sloppy coding from a total novice using a problematic language.

Guess how I tackled the task of trying to bring it all back to life?

Screw it, I put WinXP in a VM, loaded the old server, took screenshots of the interface so I had pictures to remind me of the look I wanted, and then...

I started writing the whole thing over from the ground up. Completely new database design (the original one was... Uuuumm... [insert-every-disapproving-adjective-simon-cowell-ever-used-on-american-idol] to keep the tables more manageable and speed up queries. Caching. This server will never have any need for caching, but damnit, I'm going to write those routines anyway.)

The frontend is about 85% complete. Backend probably around 65%. Depends on how you chew it, I factor... Backend is fully functional, which would put it at 99 or 100, but what with taking my re-design ideas into account, I have to honestly step that back. Backend is great "as-is", but "as-is" just isn't.
Still tossing ideas around in my head on how to structure the SQL database.

So let's talk about solving problem #1......

The last part, where I thunk (yes, I still insist 'thunk' is valid as a past-tense of 'think'. I know the word 'thought' exists, but sometimes, in retrospect, your rear-view gets clearer, and some 'thunks' don't legitimately qualify as 'thoughts'. After much discussion, I actually got my English professor to agree that our language needs a distinct word like 'thunk'. It can just be a homonym of the other onomatopoeia 'thunk')

OK... I'm not a COMPLETE idiot [fake edit: yes I am], I realize that I can't make the kinds of modifications to a live system with active disks. But that's cool, because I've got this thumbdrive that I made bootable with a basic command-line-only-runlevel-1.

I boot from the bare-bones thumb-drive, delete the NTFS partition, and start trying to create the logical volumes.

Guess what again?

Ubuntu by default doesn't have support for LVM.

No sweat, sudo apt-get install lvm2

Then:
$ sudo pvcreate /dev/sdb1
$ sudo vgcreate foxvg /dev/sdb1
$ sudo lvcreate -L 256G -n lvvar foxvg
$ sudo mkfs.ext4 /dev/mapper/foxvg-lvvar

etc, etc, etc.....

Remember how I said I booted from a LiveUSB? I did that for a reason.....

The drive normally used isn't active. It's probably mostly safe to copy var from an active drive if you drop to runlevel 1, but me? No. I'm just a little too cautious maybe. I don't want that drive in use at all.

I copy /var/. to the lvvar LV:

# mkdir -p /media/lvs/myvardir
# mount /dev/foxvg/lvvar /media/lvs/myvardir
# cd /media/lvs/myvardir
# cp -aRP /var/. .

I rename the old /var directory:

mv /var /var.wtf

I edit the /etc/fstab to add:

/dev/foxvg/lvvar /var/ default 0 1

I reboot, and....

....

......

Totally dead system.

Anyone care to hazard why how or wtf?

[edit:]
Remember again how I said I booted from a LiveUSB?
And remember how I mentioned that ubuntu doesn't support LVMs by default?

And I had to install lvm2?

Yeah... That worked out great.... But only for that liveboot session. Active load still didn't have support.

sudo apt-get install lvm2

sudo shutdown -r now

Everything is shiny.

[edit:]
I have no idea how my plymouth splash fixed itself while I was doing this, but I'm not going to argue with it.

No comments:

Post a Comment

Main Blog Older Post