[How To] Mount an additional drive

In this article I will describe how you can mount an additional drive on a Linux machine. First of all you will need to ensure that the OS is able to see both drives correctly, using the fdisk command:

root@server [~]# fdisk -l
Disk /dev/sda: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      257008+  83  Linux
/dev/sda2              33       18948   151942770   83  Linux
/dev/sda3           18949       19457     4088542+  82  Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn’t contain a valid partition table

As you can see, the second drive (/dev/sdb) doesn’t contain a valid partition table so we will need first to create a partition:

root@server [~]# /sbin/fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.

The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457):
Using default value 19457

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

To recap, you will need to run /sbin/fdisk on the second drive (/dev/sdb) , then you will type ‘n’ in order to create a new partition, ‘p’ to have it created as a primary partition, you will need to set the desired partition number (in the above example is 1) and leave everything else as default. The partition that is created is /dev/sdb1 (as I set 1 as the partition number). Once the partition is created we will need to format it:

/sbin/mkfs -t ext3 /dev/sdb1

A mount point for the new partition needs to be created and you will need to assign a label to this mount point:

mkdir /backup
/sbin/e2label /dev/sdb1 /backup

In order to have the new partition mounted automatically after a reboot, you will need to add a new line in /etc/fstab that should include the label assigned, the mount point, the partition type ect:

vi /etc/fstab and add:
LABEL=/backup   /backup   ext3   defaults   1 2

Finally, mount the new created partition

mount /backup

and check the results:

[root@server ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             108G   54G   50G  53% /
/dev/sda1              99M   24M   70M  26% /boot
none                  498M     0  498M   0% /dev/shm
/usr/tmpDSK           485M   12M  449M   3% /tmp
/tmp                  485M   12M  449M   3% /var/tmp
/dev/sdb1              74G   85M   70G   1% /backup

[How To] ImageMagick Installation

Here’s a quick how-to for installing ImageMagick ( a software suite to create, edit, and compose bitmap images). Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

Note: All the above steps have been performed on a CentOS 5.5 machine:

cd /root/setup/
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-6*
./configure –enable-shared –with-modules –without-x && make && make install

Finally, verify the ImageMagick install worked properly, by running: convert -version

# convert -version
Version: ImageMagick 6.5.9-5 2010-02-16 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC