Archive

Posts Tagged ‘ubuntu’

Bandwidth Monitoring in Linux

June 15th, 2009

I travel to frequently and as such need to be able to keep an eye on my servers. I use SSH extensively for this purpose. I’ve been looking for some tools to keep track of bandwidth usage using the command line for a while and recently found some that do exactly what I want.

I found a list that introduced me to a bunch of different tools. Two of my favorites are bmon and bwm-ng. Both of these command line tools can be installed in Ubuntu by using apt-get. technical

Technical Notes , ,

Random Technical Notes

June 15th, 2009

I had some spare time today and decided to make use of my Cox internet connection while I still have it. Naturally the only thing to do with an unused connection was to put a Tor exit node on it :)

The guide found at ubuntu-tutorials.com was very helpful. In short, simply use “apt-get install tor” to install the software and then edit /etc/tor/torc to change all the settings. It is required to give your endpoint a unique nickname. Read the config file and you’ll be fine. You can then use “sudo /etc/init.d/tor start” to start Tor and “tail -f /var/log/tor/log” to check the status.

If Apache is giving you trouble, or you should screw up the config files beyond recognition, it is possible to wipe Apache out completely and then re-install it. If you’re just playing around with the server this can save you a lot of time. The command to remove apache2 completely is “apt-get remove –purge apache2 apache2-common apache2-mpm-prefork apache2-utils ssl-cert” You can then reinstall apache using the default values with “apt-get install apache2″ It’s very simple once you know what some of the tricks are :)

Computers, How To , , ,

tune2fs: Free Space in a Storage Partition

June 1st, 2009

The ext2, 3, and 4 filesystems by default all reserve 5% of their capacity for the root user. While this is very important for partitions that contain /var or / (the root of the operating system), it can be a waste of space in drives that are only used for file storage. After making a ext4 partition I realized that I didn’t change the default setting. Instead of having 3.6TB of usable free space on my new hard drive I only had 3.4TB. After a quick google search I found an Ubuntu forum posting with a similar issue: http://ubuntuforums.org/archive/index.php/t-215177.html

The command I used is very simple:

# tune2fs -m 0 /dev/md0

Where /dev/md0 is the partition you are configuring. For more help check out the manual page for tune2fs  (# man tune2fs  )

Computers, How To , ,

Back Online After Server Failure

June 1st, 2009

This is exactly why I backup as frequently as I do. During this entire process no data was lost.Yesterday my webserver starting acting very strangely. I attempted to upload some photos to my photo gallery. It would not let me create any new content, but I could still view all of my content that was already posted. I SSH’d into the server and found that my system load was at 280 (!!!) and growing by about 2 points per minute. I checked some logs and couldn’t really figure out what was going on. No process was showing a major increase in resource consumption and there were no signs of extra traffic. I tried to close out all of the terminal windows I had open, but two of them would not lose, no matter what I tried (killing processes, etc.). After 225 days of uptime, I figured I should just reboot the system.

I waited a few minutes but the system never came back online (not even enough for me to ping it). I waited untill about 10 minutes after I gave the shutdown command and then forcefully turned it off. I brought it into my room to work on it and plugged it into a monitor to see where the problem was (I usually run my servers headless). I turned on the power and… Read more…

Computers, This Site , , ,

HandBrake

December 4th, 2008

A few weeks ago I updated my desktop from Ubuntu 8.04 to 8.10 and preformed a clean instal. I was following the MTS to AVI how to guide that I made a while ago and found that some of the links were dead. I tried to find the new location for some of the downloads, but eventually gave up. I decided I would see if another program had come along that could do the task better. Enter HandBrake

This is an awesome conversion program that runs on Windows, Mac, and Linux that was originality designed to rip DVDs to your hard drive. This open source gem also has a knack for transcoding h.264 video files. Even beter it does so using multiple threads, unlike the script that I was using before. If you have a need to convert AVCHD (or .MTS) files, I seriously recommend it.

Computers, How To , , ,

Ubuntu Installation Issues: RAID

November 14th, 2008

I set up the partitions on my hard drives the way I wanted. I have dual 500GB sata drives that I wanted to put in a RAID 0 with 2 partitions. 495GB each for the OS and then the remaining space for swap. When I was done configuring everything and wrote the changes to disk, I got the following error:

“The kernel was unable to re-read the partition table on /dev/md0 (Invalid argument). This means Linux won’t know anything about the modifications you made until you reboot. You should reboot your computer before doing anything with /dev/md0.”

This was followed by an identical error for /dev/md1. I’m still not sure of exactly what caused the error, but the quick fix I used was to hit the ESC key after the errors take place, wait for the menu to show up (the computer wants to install the base system first), then without changing anything else, set up the RAID partition that you are installing the OS, and don’t modify the swap partition or anything else like that. When I did this I still got the error for /dev/md1, but I did not get one for /dev/md0, which is what I am installing the OS to.

Computers, How To , , ,

Another Server Migration

October 19th, 2008

After several complaints from my family about not being able to access the local network file shares while I was playing video games on my computer, I decided to put all of my data onto the new server “DuckTape”, and move the website back to the old web server. This makes my family happy and really shouldn’t effect the website unless I get hit by digg, but even then it shouldn’t make that much of a difference.

What really prompted moving the hard drives over to the other computer was the fact that due to a hard reboot I lost all data contained on my RAID5 array. Apparently RAID5 is awsome at protecting data from hard drive failure but it absolutely sucks at dealing with power outages and the like. Luckily as a good sysadmin I keep regualr backups. After 17 hours of transfering 1.5TB of data onto a new RAID0 array on DuckTape, I was back in bussiness. The only thing that got lost from the failure was a small portion of an Ubuntu 8.10  Beta .ISO file that was only partaily done downlading when the backup was run. THIS is how easy it is to restore data when you KEEP UP TO DATE BACKUPS.

Computers, This Site , , ,

Waiting for Ubuntu 8.10

October 16th, 2008

I started running the beta in a virtual machine. If you’re intrested in this sort of thing I would reccomend doing the same. As of writing there are 14 days left until the new version is released.

Computers

Stress Test Complete

October 10th, 2008

After overclocking my system I ran a stress test in order to make sure that even during the heaviest of loads my server would stay functional. My application of choice for stress testing in Ubuntu is “cpuburn”. I then use lm-sensors to read the temperatures of my system.

$apt-get install cpuburn lm-sensors

$sudo sensors-detect

$sudo modprobe [modules that the previous command identified at the end]

$sensors

At this point you can now see the temperatures, voltage regulations, fan speeds, and other such information. Now you need to open new terminal window for each CPU core you have (or create them using Screen) and run the following command in each one:

$burnP6

Let this run for at least 15 minutes and then check the temperatures by running “sensors”. You can also set up sensors to automatically update by using the “watch” command.

$watch sensors

Computers, How To , ,

How To: Static IP Address In Ubuntu

August 18th, 2008

In order to setup a system to use a static IP address you have to edit the /etc/network/interfaces file.

The first step is to backup the existing file, just in case you screw something up by accident, or something otherwise doesn’t work as it should.
#cd /etc/network
#cp interfaces interfaces.backup

Next, edit the file as root with your favorite text editing program. I personally like Vim.
#sudo vim interfaces

add the # symbol beside what is already there for the interface you want to configure. The # makes whatever comes after it in the line a comment, and the computer doesn’t read it.

Next copy the following text and edit to fit your needs:

auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1

Save the file and quit. The next time you restart your computer it should automatically setup your network interface as you programed it to.

Computers, How To , , ,