November 1st, 2004

amused, silly, ha ha only serious

(no subject)

[edit]I just noticed that the American Independent candidate is Peroutka--Baldwin is his running mate. Sorry![/edit]

Poll #376388 The Official Unofficial LiveJournal Presidential Poll

Who would you vote for?

Badnarik (Libertarian)
8(50.0%)
Baldwin (American Independent)
0(0.0%)
Bush (Republican)
2(12.5%)
Cobb (Green)
0(0.0%)
Kerry (Democratic)
4(25.0%)
Nader (Independent)
2(12.5%)
Peltier (Peace and Freedom)
0(0.0%)

Who would you not mind winning? (Approval voting)

Badnarik
2(12.5%)
Baldwin
0(0.0%)
Bush
1(6.2%)
Cobb
0(0.0%)
Kerry
1(6.2%)
Nader
0(0.0%)
Peltier
0(0.0%)

Will you vote in the U.S. general election this year?

Yes, and I plan to.
11(78.6%)
Yes, but I won't bother.
0(0.0%)
No, I'm too young.
0(0.0%)
No, I'm not a U.S. citizen.
3(21.4%)
  • Current Mood
    cheerful cheerful
megatokyo, MT, largo, manga, japanese

How to fix a database using as many Linux features as possible!

Task: Repair a damaged database.

Constraint: The server it's residing on doesn't have enough space to repair it. The Linux partitions on the client are too small; there's an NTFS partition with enough space, but Linux cannot change the size of files on such a partition. SMB is far too slow to simply mount the NTFS partition to the server and use it as scratch space--or even to copy the file over, repair it under Windows, and copy it back.

Solution: Create a big file on the NTFS partition (in Windows), put an ext2 filesystem in it, and use the loopback device to mount it. Then copy the file to the scratch filesystem with NFS, repair it, and copy it back.

Step 1: perl -e "open (TEMP, '> c:\temp.ext2'); for(0..5*1024*1024) { print qq(\r), int($_/1024); print TEMP qq(\0) x 1024 or die $! }" (Generates a 5GB file.)
Step 2: Boot into Gentoo
Step 3: emerge nfs
Step 4: ssh navi, then /etc/init.d/apache stop; /etc/init.d/mysql.server stop; emacs /etc/exports; /etc/init.d/nfs start
Step 5: mount navi:/ /mnt/navi
Step 6: mke2fs /mnt/win/temp.ext2
Step 7: mount -o loop /mnt/win/temp.ext2 /mnt/temp
Step 8: cp /mnt/navi/var/mysql/apache/access_log.* /mnt/temp
Step 9: emerge =mysql-4.0.17
Step 10: myisamchk -r /mnt/temp/access_log
Step 11: cp /mnt/temp/access_log.* /mnt/navi/var/mysql/apache
Step 12: ssh navi, then /etc/init.d/mysql start; /etc/init.d/apache start

And it worked, with only minor problems (mainly relating to NFS configuration). It was almost too easy, once I figured out how to do it.
  • Current Mood
    geeky geeky