Notes
From AlistairPhipps
A few notes on various subjects, for my own use as much as anything:
Contents |
General
- If a system starts hanging and you cannot figure out why, it's going to fail. Move everything off the machine and stop using it, especially if it's at a remote location. It's common sense, but if it's a personal machine you've been using for years with no problems it's easy to get complacent.
Vim
- Press CTRL-] over a highlighted help item to skip to it
- Split the current file by using :sp
- In diff mode (vimdiff), use :do / :diffget to replace the current buffer's version. Use :dp / :diffput to replace the other buffer's version.
- Convert a file to UTF-8 encoding when writing by using :w ++enc=utf-8
Linux
Filesystems
- Avoid reiserfs. It takes a really long time to mount large partitions. Also if you have a few bits of bad memory, your entire disk will get scrambled.
- XFS has worked well for me so far.
LVM
- Put everything but root on LVM for additional flexibility.
- LVM supports using bare (unpartitioned) disks, but always partition the disk regardless. OSes may, by chance, see something that looks like a partition table but is invalid, leading to strange errors in dmesg in Linux and prompts by software in other OSes to suggest you "fix" the partition table, which could result in data loss. Partitioning gives much more flexibility and wastes very little space.
- To move a partition from one drive to another:
modprobe dm-mirror pvcreate /dev/new_physical_disk1 vgextend volume_group /dev/new_physical_disk1 pvmove -v /dev/oldphysdisk1
- A strange error message similar to "mirror log: unrecognised sync argument to mirror log: 2", "table: mirror: Error creating mirror dirty log" means you have mismatched kernel device mapper and userspace tools versions: probably your kernel is too recent for your version of the lvm tools. Install the latest device mapper and lvm2 from sources, and it should work.
RRDs
- Create an RRD using something like:
rrdtool create hdd_temp.rrd DS:hda_temp:GAUGE:600:0:100 DS:hde_temp:GAUGE:600:0:100 DS:sda_temp:GAUGE:600:0:100 DS:sdb_temp:GAUGE:600:0:100 DS:sdc_temp:GAUGE:600:0:100 DS:sdd_temp:GAUGE:600:0:100 DS:sde_temp:GAUGE:600:0:100 RRA:MAX:0.5:1:1440 RRA:MAX:0.5:1440:10080 RRA:MAX:0.5:10080:260
MySQL
- Dump a database over SSH:
ssh -C sshuser@sshhost mysqldump -u mysqluser -pmysqlpass mysqldbname > fileprefix-`date +\%Y\%m\%d`.dump
Windows
- For resizing NTFS partitions, stick with Partition Magic. Do not use Acronis Disk Director - it's buggy. Specifically, it does not work properly when running a pre-windows boot resize/move (does nothing, even though it runs!). To get it to work, you apparently have to boot off a separate CD to accomplish what Partition Magic does without this hassle - and my system hung when I booted from this CD.
- A .UIF file requires MagicISO to burn; it's commercial software, but the demo lets you work with UIFs up to 300MB.
Solaris
- Change hardware? Boot failsafe and update the boot archive:
mv /a/platform/i86pc/boot_archive /a/platform/i86pc/boot_archive.old bootadm update-archive -R /a
- Continuous reboots? Kernel panic. Boot with the kernel debugger. Add to grub "kernel" command line "-kd". Use ":c" in the debugger to continue. The panic will be printed.
- Use 'format' to configure slices and figure out which partition is on which disk.
- Swapped disks around and it can't find your root path? In failsafe mode, use "format" to determine the correct device path, then edit the "setprop bootpath" line in /a/boot/solaris/bootenv.rc to match.
- Problems with services? 'svcs -xv' shows detailed information about services that could not start. 'svcadm clear' is used to move a service out of the maintenance state. 'svccfg import filename.xml' is used to import a SMF configuration.
MediaWiki
Useful special pages
- Set up the navbar: Mediawiki:Sidebar
- Configure the initial page: Mediawiki:Mainpage
- Configure the editing help location: Mediawiki:Edithelppage
- Configure the help contents location: Mediawiki:Helppage
- List of variables: Special:Allmessages
Moving from one site to another
Copy mediawiki directory from site A to site B.
On site A:
mysqldump -u wikiuser -p wikidb > dump.sql
On site B:
mysql -u wikiuser -p wikidb < dump.sql
Other notes
If you get 'ERROR 1071 (42000) at line 927: Specified key was too long; max key length is 1000 bytes', it's because you're using UTF-8 which causes MySQL to take 3 bytes per character (so I read), and you have a key longer than will fit in 1k. The easiest solution is to reduce the size of the one of the VARCHARs in the key.
