Author Archive

Hard drive migration

Posted by on Tuesday, 7 April, 2009

This is handy if you just got yourself that new xxxTB hard drive.

Firstly, BACKUP!
This is one of the most important things to do, you never know when you may screw something up royally.

Make sure your new hdd and old one are both in the machine.

This is only a basic overview for the purposes of a tutorial. It assumes you dont have multiple partitions for /var or /usr or /boot or any other and that all your data is only one the one partition (basicly the home user not a server).
Be aware that if you have an entirely new system and have gone from IDE to SCSI then you may want/need to recompile your kernel before you do this to support the new drive.

These are the commands you probably want to do. /dev/hdxxx is the destination hard drive.

fdisk /dev/hdxx
– This is to partition the disk

mkfs -t ext3 /dev/hdxx – This is to format it

mkdir /target

mount /dev/hdxx /target – Mounting the new drive.

rsync -a --exclude="/dev" --exclude="/proc" --exclude="/sys" --exclude="/target" / /target/
– this copies your data accross

mkdir /target/{proc,dev,sys}

(Note: you can probably cp -a /dev across)

cp /dev/MAKEDEV /target/dev/ – this file is needed for making device nodes

cd /target/dev

Now you need to make the device links. This is done with a script called MAKEDEV that you just copyed accross.
./MAKEDEV will give you the options you need/want.

./MAKEDEV generic-i386 should do the basic nodes

Now you have to edit a couple of things.
vi /target/etc/fstab
This only really needs to be done if the hard drives are going to change places on the ide chain.
Please do note that Redhat/Fedora uses labels instead of partitions, label your partitions if you wish to continue with this method, alternativly change the label for the actual device name.

vi /etc/lilo also if needed for the same reasons.

Now for the tricky bit, you can copy the masterboot record with something that looks like this
dd bs=512 count=1 if=/dev/hddxx(oldone) of=/dev/hdxx(newone)

However, apon saying this i have found it to break my partitioning before on some hard drives.
So Im more inclined to just reboot and using another linux install disk or floppy to boot.

I find slackware disk excellent as a rescue disk, when it comes up to the lilo screen i just type
Lilo: linux root=/dev/hdxx(new hard drive)

Debian cd can be booted with,
Lilo: rescue root=/dev/hdxx(new hard drive)

etc. Most distros will do it, just read the help.

Reboot with rescue cd and run lilo or dd the MBR (which i find to screw up sometimes)

Then login as root and rerun your lilo or grub onto the new hard drives MBR.
Last-Modified: 2007-03-07 19:38:50


Using apt-get

Posted by on Tuesday, 7 April, 2009

Using apt-get / Installing aplications on Debian based distro’s.

This is just a quick guide to get you started on installing and upgrading software on you debian or debian based distro of linux. It is not meant to be a comprehensive guide. From here on in where I refer to Debian I mean any debian based or other distro of linux that uses apt-get.

Finding Applications / Packages.

Software for debian is stored in packages. These packages contains the files required for an application and also referances to other packages required to run the software. The fastest way to search the packages currently availible (assuming your package cache is up to date, more later) is to use apt-cache.

The basic syntax is: apt-cache search

ie. finding an irc client


$ apt-cache search "irc client"
cgiirc - web based irc client
ctrlproxy - An IRC proxy with multiserver support
...
...
...
tinyirc - a tiny IRC client
tirc - token's irc client
xchat - IRC client for X similar to AmIRC
xchat-text - IRC client for console similar to AmIRC
zenirc - Major mode for wasting time

I have shortened the output here …

The alternative in to browse a package archive such as packages.debain.org But keep in mind that depending on your installation sources and version some packages may not be available to you.

Installing an Application / Packages.

Lets, for example, choose to install xchat, an excellent IRC client. To do this we simply execute this at a command prompt as ROOT user. apt-get install xchat (To log in as root type ‘su’ at the prompt and enter you root password when prompted, if you are on knoppix or your user has sudo access preffix the command with ‘sudo’)

you should get something like the following:


Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
xchat-common xchat-text
Suggested packages:
libnet-google-perl
The following packages will be upgraded:
xchat xchat-common xchat-text
3 upgraded, 0 newly installed, 0 to remove and 350 not upgraded.

As you can see this will install extra required two packages. You maybe prompted to confirm the download of the packages. You should also receive a summury of sizes. On confirmation apt-get will download the packages and configure them. Some software will require user interaction and will prompt you for input.

To upgrade an existing package you similarly type apt-get upgrade

Upgrading and Updating apt-get

As the list of packages changes regularly you may need to update you cache of available packages. This is done by executing the following as root: apt-get update

To upgrade all packages on you system you can try the following (again as root) apt-get upgrade This will generally download alot of files !!!

Sometime packages will be held back because of conflicting dependancies, etc. To force this try apt-get dist-upgrade after running apt-get update then apt-get upgrade .

Last-Modified: 2007-03-07 19:38:50


User communication

Posted by on Tuesday, 7 April, 2009

If you are running a multiuser system like Linux, you should expect to find other users on your system. (I guess that’s why it is a multi-user system.) Although there are many built-in mechanisms to keep users separated, sometimes you will want to communicate with other users.

Linux provides several tools to do this, depending on exactly what you want to accomplish. If you simply want to send a quick message to someone, for example, to remind him or her of a meeting, you might use the write program, which sends (writes) a message to his or her terminal.

In contrast to some other systems (say, the winpop mechanism under Windows), each line is sent when you press Enter. If you are on the receiving end of the message, the system lets you know who sent you the message.

If the person you are trying to contact is logged in more than once, you need to specify the terminal to which you want to send the message. So, if I wanted to talk to the user jimmo on terminal tty6, the command would look like this:

write jimmo tty6

If you omit the terminal, write is kind enough to let you select which terminal to which you want to send the message.

It might happen that someone tries the above command and receives the following message:

write: jimmo has messages disabled.

This message means that jimmo has used the mesg command to turn off such messages. The syntax for this command is

mesg n

to turn it off and

mesg y

to turn it on. Unless the system administrator has decided otherwise, the command is on by default. I have worked on some systems in which the administrator changed the default to off.

An extension of write is the wall command. Instead of simply writing the message to a single user, wall writes as if it were writing on a (where else) wall. That is, everyone can see the message when it is written on a wall, and so can every user. The wall command is often used by root to send messages about system status (e.g. when the system is about to be shutdown. Even if a user has disabled messages, the root user can still send them messages using wall.

If you want to have an interactive session, you could send write messages back and forth. On the other hand, you could use the talk program that was designed to do just that. When talk first connects to the other user, that other user sees on his or her screen

Message from TalkDaemon@source_machine… talk: connection requested by callers_name@his_machine talk: respond with: talk callers_name@his_machine

As the message indicates, to respond, you would enter

talk callers_name@his_machine

You might have noticed that you can use talk to communicate with users on other machines. If you omitted the machine name, talk would try to contact the user on the local machine (localhost). The preceding message would simply say

talk: connection requested by callers_name@localhost

You can also disable talk by using the mesg command.

It is common practice to use a couple of terms from radio communication when using talk. Because you cannot always tell when someone is finished writing, it is common to end the line with -o (or use a separate line) to indicate that your turn is “over.” When you are finished with the conversation and wish to end it, use oo (over and out).

Both of these mechanisms have some major problems if the user is not logged in: they don’t work! Instead, there’s mail or, more accurately, electronic mail (or e-mail).

On most UNIX systems (including Linux), e-mail is accessed through the mail command. Depending on your system, the mail program may be linked to something else. On my system, the default was to link to /usr/bin/mail.

Last-Modified: 2007-03-07 19:38:50