July 27, 2007

Backing up Linux systems

There are multiple valid ways of backing up a Linux system. I’m going to only talk about one method here, however. Using Symantec Ghost2003 you can image the system disk partitions and save them away for a rainy day. Given that Ghost will image the whole partition, it makes sense to make the root partition as small as possible so that backups can occur within reasonable time. One of my pet peeves is that pre-configured computers or rather mis-configured computers have one large gigantic partition with everyone on it. This is a maintenance nightmare. The system may only take up 4G of space, but some user has 200G worth of files sitting there. When you image the disk, you end up copying that extra 200G of deadweight. You may ask, “well don’t you have to backup that 200G anyway?” Yes, but there’s a better way than using Ghost for this.

The whole purpose for using Ghost is that in total disk failure, you can just pop in a new disk, create some partitions, and then restore the whole system, as it was configured with minimal effort and knowledge of how it was set up. You can’t just command line copy all the files from root to another directory and expect it to boot the same way. Ghost preserves special files like devices, which you just can’t copy normally.

However, personal data files are just regular files, and so incremental backups using rsync is my preferred method.

So lets get started. Step 1 is to pare down the system files. If you’re lucky, /home is mounted separately. If not, I would resize the root partition to 50G or less and then create a new partition with the freed up space and mount it as /home

WARNING: mucking with the file system can be dangerous as you could wipe out whole partitions with a single stroke. (unfortunately, the ‘q’ quit with no changes is right next to ‘w’ write changes in fdisk, so watch out!)

Resizing the system partition.

Get a bootable CD of a Linux Rescue CD like Fedora7
Boot to rescue. Skip the step that asks if you want to mount any found Linux systems. You now get dropped to a shell. Check the disk you are going to resize with e2fsck. Use df to see what devices and sizes you have.

Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda2 50397 21110 27751 44% /
/dev/sda1 99 36 59 38% /boot

/dev/sda2 is about 50G. If I wanted to resize it to 30G I would use

resize2fs -p /dev/sda2 30G

(now go get some coffee.. the -p (progress) is important so you can see that its doing something and about how long it will take, else you might think its hanging)

After the filesystem is resized, you must then shrink the size of the partition upon which it resides using fdisk. In our example you would run

fdisk /dev/sda

Note the starting block number of the partition. Delete the partition and create a new, smaller partition with the same starting block number. If you don’t use the same starting block number, it will probably trash the file system. Make certain the new partition is big enough to hold the resized file system and +10% for overhead.

Now you can create a new partition with the freed up space.

July 20, 2007

Problems with Ubuntu 7.04

I decided to give Ubuntu a try for a new filesever I was building since I read that Dell had decided to use Ubuntu as its Linux OS. I experienced a number of problems that prompted me to change to Fedora.

The server version of Ubuntu is stripped down to command line and makes it hard to administer. I chose to install the desktop version.

The first issue encountered was a keyboard scrambling problem that manifested itself upon remote gnome-session or VNC login. When you type, the key output is all mixed up rendering the session useless. The bug is detailed https://bugs.launchpad.net/ubuntu/+bug/108928

There is a workaround, which took awhile to find, but seems to work http://ubuntuforums.org/showpost.php?p=2539412&postcount=4

The second problem I had was not fixable. I needed to use the machine as a fileserver, but found that smb mounts would not stay mounted and would lockup and disconnect. The bug is described at https://bugs.launchpad.net/ubuntu/+source/samba/+bug/46514

But the third problem which made up my mind to find an alternate linux was that I was experiencing seemingly random kernel panics / crashes. Some of these were logged very early, before I had installed or configured many packages. At first I feared defective hardware, however I have not had any kernel problems using Fedora 6 with the same hardware, so I assume it was something with Ubuntu.

In conclusion, while Ubuntu 7.04 may be usable for desktops, it does not meet my needs for enterprise class stability and usability as a server since basic out of the box functionality is lacking without patching or lame hacks to get around bugs which should not exist.

July 19, 2007

How to change the MAC address of a network card in windows xp

The problem is that someone has a conflicting MAC address or that for some reason the MAC address is banned from the network. You can ping local computers, but you cannot ping the gateway or DNS machines. Instead of buying a new NIC, you can try to change the MAC address of the NIC.

I found instructions here: http://www.nthelp.com/NT6/change_mac_w2k.htm

and it also references http://www.klcconsulting.net/change_mac_w2k.htm

In summary, you go to the network control panel, right click on the icon for the network connection, and choose properties.

click on the configure button, click advanced. Modify the “Network address property” by filling in the MAC address you want into the blank space (no dashes).

confirm that the MAC address is changed by typing ipconfig /all in a command shell.

it worked for me on windows xp.