Showing posts with label Computer. Show all posts
Showing posts with label Computer. Show all posts

Wednesday, February 18, 2009

Ubiquity

I've been playing around with Mozilla labs ubiquity plug in in recent weeks. It's still in beta, and far from fully featured, but even so it's quite impressive.

Tonight I was reading comments on a boing boing post where a few of the commenters had used ROT13 to obscure spoilers. There are plenty of good sites to do the conversion for you (I'm too old/lazy to do that sort of thing in my head these days) but I thought to myself that this would be a perfect for for a ubiquity command.

I know the world isn't really crying out for a ROT13 utility, but I thought it would be a good way for me to test the waters in writing some browser code. My javascript-fu is far from strong, but it was surprisingly easy. I spent far more time futzing about with publishing it than I did writing the code itself.

You can check out my notes here. Even if you've no interest in my almost embarrassingly trivial utility, check out ubiquity for it's own sake. If you're a power web-user, you won't regret it.

Sunday, October 12, 2008

Resizing the swap partition size after install

I just increased the amount of RAM in an Ubuntu web server from 256 MB to 1 GB. I wanted to increase the size of the swap file accordingly. There are various schools of thought as to how big the swap file should be, I went with 2 GB which is almost certainly overkill, but there you go.

My procedure was as follows:
  • Boot to using the Ubuntu8.04 live CD.
  • Use the partition editor to shrink the primary partition, and grow the the swap file partition and volume.
  • Write the changes to the disk.
  • Reboot to the server command line.
  • Determine the swap volume's new UUID using:
ls -l /dev/disk/by-uuid
  • Edit /etc/fstab and change the UUID for the swap partition to the correct value
  • reboot
  • Check that the partition is correctly mounted with the "free" command. Don't mind that you may not be using any of the swap at present, but you can at least tell that it's there for when you do need it.

Text editing with multiple files on the command line

To make my life easier, and considering that my web server doesn't have a GUI I first saved the output of the ls command to a text file, and edited that so that it contained just a single line containing the UUID
I then opened fstab
sudo vim /etc/fstab
and then, at the end of fstab, I inserted the file I'd created with the command:
:r /home/john/uuid.txt
I copied the UUID to the appropriate spot, deleted the line at the end and saved the file.

There are plenty of good tutorials and command summaries for vi / vim around on the web if you need them. (here's one, and another). I admit I'm somewhat conditioned to using graphical editors, but one doesn't always have a choice.

Friday, May 16, 2008

Long file names and removable media

I was recently trying to copy a bunch of files onto an SD card, and kept getting an "out of space" error message, which was kind of odd, considering the 300 or so image files added up to a grand total of just over 20 MB, and the card was en empty 1 GB card.

Much poking, prodding, trying stuff from the command line and googling resulted in me learning more about VFAT than I'd originally intended. Anyway, it turns out that the implementation for long file names in VFAT is a workaround which means that if you have too many(1) long file names in the root directory you may chew up all your allocation units and get "out of space" errors long before the media itself is full.

Files in sub folders are not implemented in the same way, and therefore don't exhibit the same behavior. Put all of the files in a subdirectory and all is well.

References:

Wikipedia's entry on various implementations of Mr Gates' File Allocation Table.

A MEPIS forum post that really pointed me in the right direction.

Notes:

(1) How many depends on how long your file names actually are, you use one extra directory entry for every 13 characters. I think it's 512 directory entries, so assuming I had 302 x some number greater than 1, I was bound to run into problems.