Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

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.

Saturday, May 31, 2008

Amarok setup

On Susanne's PC:

Installed MySQL client from repos

Edit /etc/mysql/my.cnf, adding this line to stanzas [client] and [mysqld]:
default-character-set = utf8

sudo /etc/init.d/mysql restart

installed mysql server
had to enter password

susanne@arwen:~$ mysql -p -u root
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.45-Debian_1ubuntu3.3-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

set password for root@localhost = password('xxxxxxx');

mysql> CREATE DATABASE amarok;
Query OK, 1 row affected (0.02 sec)

mysql> USE amarok;
Database changed
mysql> GRANT ALL ON amarok.* TO amarok@localhost IDENTIFIED BY 'PASSWORD'
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> Aborted
susanne@arwen:~$

Wednesday, May 14, 2008

Windows XP Service Pack 3

I've just completed my first trial run with XP service pack 3. I installed it on top of a fresh copy of windows XP Professional, installed i a VMWare virtual machine. It installed without a hitch, seemed faster than the SP2 installation.

I've since run a Windows update check, and there were only 3 "high priority" updates. Not perfect, but much better than the several hundred MB of downloads and several reboots required after an SP2 installation.

My plan is to install a few basics and keep a copy of this VM for use as a base for various tasks. The first one will be a Visual Studio 2008 VM. 8 GB will probably be just enough* for this, but if I can keep it to 8 GB I can burn copies to DVD. My intention is to have task specific VM's, rather than one do-everything machine.

It will require a little more discipline, but I think it will serve me better in the long run, especially as I do more and more on Linux. Launching a Windows VM on demand should be more convenient than dual booting, except perhaps for gaming. However, my computer gaming time is pretty much non-existent these days, so it's not really much of a sacrifice.

* As it turns out, 8 GB really insn't enough for Visual Studio 8. Actually, the install was OK, but I removed C#, leaving me with less than 1GB. This, unfortunately, is unsufficient to install any of the docoumentation and reference material. I'll see how this goes, I can almost certainly have the doco on a second monitor / machine in most instances. Otherwise it'll be a 10-12 GB build.

Monday, May 12, 2008

Ripping Audio from a DVD

I was recently asked to get the audio from a DVD and place it on a portable media player. Here's how I did it, using Ubuntu 7.04.

1. Installed mplayer from the repositories

2. played the various chapter until I found the one I was looking for. This can be a bit of a hit and miss process, as DVD's often have rather strange title/chapter builds. The command is:
mplayer dvd://4
Where the "4" refers to the title number. This particular DVD has 6 titles. Apart from playing the chapter, you'll see a bunch of stuff in the console window. click "x" to stop playing. The output includes the following:
Playing dvd://4.
There are 6 titles on this DVD.
There are 2 chapters in this DVD title.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: en aid: 128.
audio stream: 1 format: ac3 (stereo) language: zh aid: 129.
number of audio channels on disk: 2.
number of subtitles on disk: 0
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 7500.0 kbps (937.5 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
3. The red text above shows the information I needed. There were two audio tracks for this title, I was after the english (en) version. The command to extract the audio is: (This is meant to be all on one line)
mplayer -vc null -vo null -aid 128 -ao pcm:fast:waveheader:file=output.wav dvd://4 -chapter 1-2
The "128" refers to the audio track found in step 2.
"Output.wav" is the output file name.
chapter 1-2 means I want the audio from both chapters. "2-2" would have taken only the second.

4. Import the wav file into audacity, a superb audio editor.

5. I then used audacity to crop and normalize the audio I wanted, including adding nice fade ins and outs.

6. I Again in audacity, export the audio to mp3.

All Done.

References:

Most of this is derived from this post on the Ubuntu forums.

Wednesday, April 16, 2008

Recovering photos from a dodgy XD card

I've done data recovery from portable/removable media before, but this is the first time I've done so under Linux.

I used "photorec", which is bundled with "TestDisk", the latter being the main part of the package, however I didn't actually get any images back until I used photorec itself.

It's a simple text based tool which is quite intuitive to use, and available from the repositories, so installing it was a snap. (Search for "TestDisk"). My discovery started with the results of a good old google (surprise surprise), here at debian-administration.org.

Anyway, I recovered the images from the card, and have re-formatted it, so hopefully it'll be some time before it causes any more problems. Mind you, at 128 MB, that particular card is a bit of a dinosaur, and on the small side.

I'm not sure what actually caused the data corruption. A couple of times I've had the camera lock up when shooting video when the card has been almost full. It's an Olympus C760 using XD, and been a pretty good all round camera.