Posts Tagged ‘linux’

Configure Ubuntu Server with static IP

January 13th, 2010

It’s not recommended to assign IP address to servers using DHCP since the IP address can change after the lease expires. Just imagine having all the users or devices that need access to the server stopping because the server changed IP address.

In Ubuntu/Linux the process of assigning a static IP to the server is an easy task that only requires the modification of one file and issuing a few commands.

Using you favorite text editor open the file /etc/network/interfaces.

sudo nano /etc/network/interfaces

This is how the the /etc/network/interfaces file looks like.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
auto eth0
iface eth0 inet dhcp

You can safely erase all the information for eth0 and add the information below. Make sure to change the information in order to meet your networking requirements.

auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

After adding the appropriate networking information you can restart the networking service for the new changes to take effect.

sudo /etc/init.d/networking restart

PartedMagic does more than partitioning

December 22nd, 2009

Oh no!, PartedMagic is not just another Linux utility oriented distribution. PartedMagic is meant to be one of the best disk manipulation live CDs, don’t let the name fool asides from including both command line and graphical oriented partitioning tools it can also do ghosting, recovery of data to name just a few thanks to the other tools bundled in the same CD/ISO.

PartedMagic

Features

  • Format internal and external hard drives.
  • Move, copy, create, delete, expand & shrink hard drive partitions.
  • Clone your hard drive, to create a full backup.
  • Test hard drives for impending failure.
  • Test memory for bad sectors.
  • Benchmark your computer for a performace rating.
  • Securely erase your entire hard drive, wiping it clean from all data.
  • Gives access to non-booting systems allowing you to rescue important data.
  • Runs from the CD, no install required.

Some of the included tools to name a few

Partimage, TestDisk, Truecrypt, Clonezilla, G4L, SuperGrubDisk, ddrescue

To download PartedMagic visit PartedMagic.com

htop like top but better

July 20th, 2009

In the past whenever I had to work on a Linux system the first tool I would use was top to watch the overall performance of the system.

Process Hacker

However, it never felt right or friendly for my taste. Since I get to spend a considerable amount of time working on Linux systems I knew there had to be an alternative to top. Then I found htop, two and half years later here is why I am still using it.

  • The arrow keys are actually used for something.
  • It’s in color. The color coding helps with organization and orientation.
  • CPU, swap, and memory have a graph that reports how they are doing.
  • Full view of processes.
  • You can use F9 to end the life of those bastard processes.

Pretty and useful, just like I like my hummm!.

Links

http://htop.sourceforge.net/

Restore missing swap on Linux system

April 22nd, 2009

A fellow administrator had the task of re-allocating precious space on a server, that meant partitions would be moved around. Apparently during the process the swap partition was resized which resulted on the system loosing all of the available swap, despite the fact that the partition was never actually deleted.

After noticing the problem I decided to check /etc/fstab, I could see an entry for swap at boot. However the partition was not being mount it during boot up, leading me to believe that the UUID might have changed.

UUIDUniversally Unique Identifier

blkid

First use the blkid program to determine the new UUID of the swap partition. Look for the entry with the TYPE=”swap” and copy the UUID.

$ blkid
/dev/ramzswap0: TYPE="swap" 
/dev/sda1: UUID="8192a29b-e191-4347-a65c-3be8546a5c5c" TYPE="ext3" 
/dev/sda5: TYPE="swap" UUID="b6a5fce4-9938-4518-809a-2cd0f5e194e8" 
/dev/loop0: TYPE="squashfs"

Now open /etc/fstab and visually compare the swap UUID output from blkid with the current entry on fstab which should be different.

nano /etc/fstab

My swap partition is located in /dev/sda5.

# /dev/sda5
UUID=55a68fbd-2f25-447b-99fd-02e972937a3c none            swap    sw              0       0

Because they are different the problem is evident the UUID changed, meaning the system no longer has the correct swap UUID to call on boot up.

Solution

The solution is simple just remove the old swap UUID entry found on /etc/fstab and paste the new UUID you got from blkid.

nano /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=8192a29b-e191-4347-a65c-3be8546a5c5c /               ext3    relatime,errors=remount-ro 0       1
# /dev/sda5
UUID=b6a5fce4-9938-4518-809a-2cd0f5e194e8 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

The last thing to do is reboot the system and check the available swap.