Posts filed under 'Linux'

Add A New Harddisk To Linux Using Parted

If you have added a new harddrive, and want to take advantage of it in Linux, parted is a great tool to get you started. Parted is like fdisk, but a bit more challenging. Please note that when following this tutorial you will loose any data on the harddrive in question.

Finding the device name

The first task is to find the devicename of your new harddrive. SCSI disks are usually given device names like /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd and so on (dependening of how many phsyical disks you have got. IDE disks are usually given device names like /dev/hda, /dev/hdb, /dev/hdc, /dev/hdd and so on. In this tutorial we will image we have added a second SCSI disk, we will treat it as /dev/sdb

Using parted

As root, type
parted /dev/sdb
and parted will now startup, expecting to perform work on our new harddrive.

First we create a disk label
(parted) mklabel msdos

Then we need to find the size of the disk, or more correctly the start- and end sector of the disk
(parted) print

The print command should display something like this:

Disk geometry for /dev/sdb: 0.000-102400.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags

The geometry data will come in handy in our next command where we create a filesystem on the disk
(parted) mkpart primary ext2 0.000 102400.000

We can also make extra sure that we get a ext2 disk with the following command (please note that parted doesn’t support ext3):
(parted) mkfs 1 ext2

Now exit parted:
(parted) quit

Mounting the new drive

First create the mountpoint that you want to use for the new drive:
# mkdir /u01

Change the filesystem from ext2 to ext3:
# tune2fs -j /dev/sdb1
Now edit /etc/fstab and add the following line:
/dev/sdb1 /u01 ext3 defaults 1 1

The mount the new drive on mountpoint /u01:
# mount -a

Finally check that the new drive is mounted:
# df -k

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 5526416 2081024 3164660 40% /
/dev/sda1 101086 8613 87254 9% /boot
none 387852 0 387852 0% /dev/shm
/dev/sdb1 10317828 33460 9760252 1% /u01

Add comment May 25th, 2009

Upgrade Fedora Core from version 5 to 6

I found an execellent guid on how to upgrade from FC5 to FC6 the other day. Unfortunatly I did not bookmark the site, but I did save the steps to a text file, which I will post here for future use.

Upgrade Fedora Core

yum update
yum clean all
rpm -Uhv http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/fedora-release-6-4.noarch.rpm

http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/fedora-release-notes-6-3.noarch.rpm

yum -y update
yum -y update

I don’t know why I had to run yum -y update twice.

Upgrade the kernel

rpm -Uhv http://mirrors.dotsrc.org/fedora/updates/6/i386/kernel-2.6.18-1.2869.fc6.i686.rpm

http://mirrors.dotsrc.org/fedora/updates/6/i386/kernel-doc-2.6.18-1.2869.fc6.noarch.rpm

http://mirrors.dotsrc.org/fedora/updates/6/i386/kernel-devel-2.6.18-1.2869.fc6.i686.rpm

Reboot server to use the new kernel

init 6

Add comment May 25th, 2009

The telnet hack

One of the most famous and useful hacks either when testing websites or firewall access to websites is “the telnet hack”. When you think of it, a web browser is just like an advanced telnet client executing HTTP commands. Thus using the classic telnet application and writing the HTTP commands your self has proven a good way of testing both website content and website access through firewalls. The syntax is: telnet <server> <port>

Get webserver version

# telnet www.httpforum.com 80
Trying 80.166.163.20…
Connected to www.httpforum.com (80.166.163.20).
Escape character is ‘^]’.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Wed, 30 Mar 2005 18:44:46 GMT
Server: Apache
Connection: close
Content-Type: text/html; charset=utf-8

Connection closed by foreign host.

So this shows us that www.httpforum.com is running Apache and the webservers default character set is UTF-8

Is the site available

# telnet www.httpforum.com 80
Trying 80.166.163.20…
telnet: connect to address 80.166.163.20: Connection refused telnet:
Unable to connect to remote host: Connection refused

Well, seems like I have forgotten to open port 80 in the firewall, or that the webserver is not running. Please note that if there is a firewall between the webserver and your client, the telnet hack is a far better option than ping, as the ping protocol is most likely limited by the firewall. People who pings a webserver and get no respons from the host, often take this as a proof the webserver is not started or that it’s network services are not running, but since ping is disabled by most firewalls, you can’t trust the ping command. In addition, tracert/traceroute command is also often blocked in firewalls, so you can’t trust that command either. The telnet hack is the only sure method of checking if the firewall is open on the web port (default 80 for HTTP and default 443 for HTTPS).

Add comment May 25th, 2009

Upgrade Fedora Core from version 6 to 7

Upgrade the release

yum -y update

yum clean all

rpm -Uhv <url>/fedora-release-7-3.noarch.rpm <url>/fedora-release-notes-7.0.0-1.noarch.rpm

Where the <url> for instance is http://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/7/Fedora/i386/os/Fedora/

yum -y update

Upgrade the kernel

rpm -Uhv <url>/kernel-2.6.21-1.3194.fc7.i686.rpm <url>/kernel-doc-2.6.21-1.3194.fc7.noarch.rpm <url>/kernel-headers-2.6.21-1.3194.fc7.i386.rpm <url>/kernel-devel-2.6.21-1.3194.fc7.i686.rpm

Where the <url> for instance is http://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/7/Fedora/i386/os/Fedora/

Reboot server to use the new kernel

init 6

Update the rest

yum -y update

Add comment May 25th, 2009


Services

Archives

Twitter

del.icio.us