Category: Article

Install RPMforge In CentOS / Scientific Linux

What is RPMforge and why should I bother adding it ?

RPMforge is a collaboration of Dag and other packagers. They provide over 5000 packages for CentOS, including wine, vlc, mplayer, xmms-mp3, and other popular media tools. It is not part of Red Hat or CentOS but is designed to work with those distributions.

Third party repositories like RPMforge increase the amount of available software you can install with your distributions package manager. The instructions you are about to read are both applicable to CentOS and Scientific Linux.

Install Wget

First install Wget since it doesn’t come installed by default in most systems, Wget will be responsible for downloading the required .RPM file for the repository.

yum install wget

Verify System Architecture

RPMforge is available for 32-bit(i686) and 64-bit(x86_64) architectures, if you don’t know the architecture type of the system in which you are planning to install RPMforge you can use the uname command.

uname -a
Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Sat Dec 10 17:04:11 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

RPMForge Installation

RPMforge for CentOS 6 and Scientific Linux 6 32-bit

cd /tmp/

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

RPMforge for CentOS 6 and Scientific Linux 6 64-bit

cd /tmp/

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

RPMforge for CentOS 5 and Scientific Linux 5 32-bit

cd /tmp/

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

RPMforge for CentOS 5 and Scientific Linux 5 64-bit

cd /tmp/

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Try It

RPMForge should help expand the amount of available software your installation can access when looking for a package to install.

[root@localhost tmp]# yum install lighttpd

Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lighttpd.x86_64 0:1.4.28-2.el6.rf will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package            Arch             Version                     Repository          Size
==========================================================================================
Installing:
 lighttpd           x86_64           1.4.28-2.el6.rf             rpmforge           706 k

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total download size: 706 k
Installed size: 2.8 M
Is this ok [y/N]:

Conclusion

If you don’t like to install from source, then RPMForge is a must. Installation takes just a few minutes, but the convenience is worth it.

Cloning A Drive With EaseUS Disc Copy – Simple Cloning Utility

EaseUS Disk Copy Home Edition is a simple cloning utility in the form of a Live CD. Disc Copy performs a sector by sector copy of the source drive and deposits the resulting data in to another drive, Sectory by sector copies are exact copies of the source drive resulting in an exact image. EaseUS Disk Copy interface is simple to understand, actually the user is presented with few options in regards to how the cloning will performed. EaseUS Disk Copy Home Edition is freely available to home users, business users need to purchase a license.

There a few limitations:

    its not possible to clone the source drive into an image file for later transfer

    free version has a 1TB drive limit.

Consider using EaseUS Disk Copy if you need to migrate an operating system from a smaller drive over to a larger one. For this tutorial I will be cloning the contents of a 80GB drive over to a 120GB drive.

But before you can use start cloning you need need to download the EaseUS Disk Copy executable which is responsible for creating either a Live CD, .ISO or bootable USB needed to start the application.
Download: EaseUS_DiskCopy_Home.exe

Create USB, CD/DVD, Bootable ISO

Run EaseUS_DiskCopy_Home.exe. Depending on your preferences you can choose to create either a bootable USB drive, .ISO file, or bootable DVD/DVD.

Depending on the system BIOS you need to boot in to either the CD/DVD Drive or Removable Devices which is another name for USB drive.

Choose Start Disk Copy

null

Select Next.

You can decided what will be copied:

  • Disk Copy – Copies the entire drive
  • Partition Copy – copies a single partition

For most cases you should pick Disk Copy.

I wish to transfer the content of my 80GB drive over to the new 120GB, which is why I selected the 80GB drive as the source. Click on Next when ready.

The 120GB drive will be the destination. Click on Next when ready.

Task preview – this is where you review the changes that are about to be made. Click on Proceed when ready.

Make sure you are working with the right drives. Click on Yes if you are positive of the changes.

Depending on the amount of data being handled the operation might take a while.

You can review the results if you like.

With the cloning operation successfully completed you can click on Done or Quit to exit.

When prompted click on Yes to reboot.

Now, make sure you remove the source drive and install the new drive in the same port where the previous was connected to.

Conclusion

If you need a some cloning utility then EaseUS Disk Copy Home Edition is the answer, I don’t have much to say other than it works and is free for home users.

Link: EaseUS.com

Configure Ubuntu To Serve As An iSCSI Target

This tutorial will cover the required steps to configure a basic iSCSI Target on Ubuntu. The installation for this tutorial was performed on an Ubuntu 12.04 64-bit system, but the same configuration applies to Ubuntu 12.04-32bit.

Before We Install

Before the target can be installed check to see of the system you are planning to run the target from is up to date.

sudo apt-get update
sudo apt-get upgrade

Target Installation, Minimal Changes

Proceed to install the iSCSI target(iscsitarget) along with iscsitarget-source and iscsitarget-dkms.

sudo apt-get install iscsitarget iscsitarget-source iscsitarget-dkms

If you don’t install the extra two packages you will be greeted with the following error every time you attempt to restart the target.

user@ubuntu:~$ sudo service iscsitarget restart
 * Removing iSCSI enterprise target devices:           [ OK ]
 * Starting iSCSI enterprise target service            FATAL: Module iscsi_trgt not found.

Next edit /etc/default/iscsitarget. Change the default value of ISCSITARGET_ENABLE=false over to ISCSITARGET_ENABLE=true. Not doing so will not allow the target to start.

sudo nano /etc/default/iscsitarget
ISCSITARGET_ENABLE=true

Storage Creation

When working with iSCSI you have to also think of LUN’s. This when you decide whether you want to use files or partitions when offering the targets storage to the iSCSI clients. For the tutorial I will be using files.

To create a file we can use dd to create and empty file that will grow once the users start storing file in it. The file weights 50GB.

dd if=/dev/zero of=/media/volume0/storlun0.bin count=0 obs=1 seek=50G

I want to store the resulting files in a different path than my home directory which is why I specified that the file be deposited at /media/volume0.

Target Creation

Configurations and targets we create can be found in the /etc/iet/ietd.conf configuration file.

sudo nano /etc/iet/ietd.conf

Scroll to the bottom of the configuration file and add:

Target iqn.2012-05.local.mynet:storage.sys0
        Lun 0 Path=/media/volume0/storlun0.bin,Type=fileio,ScsiId=lun0,ScsiSN=lun0

If you don’t want to use files you can also use partitions, just use Lun 0 Path=/dev/sdb1,Type=fileio instead.

The first line can be changed, but the second line specifies where the LUN actually is. If you want, you could create a second LUN using LUN 1 Path=/XXXX XXXX XXXX and expose a second iSCSI drive withing the same target, this assumes you have created a second storage file.

Restart Target

All that is left to do is restart the target with our changes.

sudo service iscsitarget restart

Test The Target

To test the target I will be using built-in Windows 7 iSCSI client(initiator)

Enter the IP address of the Ubuntu server and click on Quick Connect…

You are now connected, click on Done.

Go over to Administrative Tools > Computer Management.

On the left sidebar you should notice the Disk Management option.

Look for the iSCSI drive, for this tutorial we made a 50GB drive which is listed at the bottom. Here you can choose to format the drive if you like.

Conclusion

As you can see configuring an iSCSI target in Ubuntu doesn’t have to be complex. Keep in mind the above was just a basic installation, deploying iSCSI also brings other variables in to consideration such as security since the above configuration will allow just about any one to connect to the target. Perhaps I should make another post about iSCSI best practices, thank you for reading.

If you have any questions or comments use the form below.

Configure Software RAID1 Array In Linux

Before we start you should know this tutorial assumes two things:

  • First – System were MDADM will be running is up to date
  • Second – Every step below will be performed with Root privileges or similar.

How Many Drives Are Available ?

We need to list the available drives in the system we wish to create the array, this task can be accomplished with the ls command:

ls /dev/sd*
user@ubuntu:~$ ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5  /dev/sdb  /dev/sdc  /dev/sdd

Listed are five drives, /sda /1 /2 contain the Operating System, /sdb and /sdc are empty and will be used to create the RAID1 array, /sdd can be left alone or used as a hot-spare.

Drive Prepartions

First of all we should prepared the drives we want to include in the array, by preparing I am referring to partitioning each drive. For the purpose of partitioning we will be using a well known utility called fdisk. Repeat fdisk in every drive that will be part of the array, remember you will need to run the exact command and parameters.

I’ll do my best to guide you through the required steps to format a drive with fdisk.

root@ubuntu:~# fdisk /dev/sdb

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-251658239, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-251658239, default 251658239):
Using default value 251658239

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

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

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

If you prefer a graphical interface, GParted is a good alternative to fdisk.

Is MDADM Installed In The System?

The answer is probably no!, if this is your case then I would recommend installing MDADM via the designated package manager for your Linux distribution.

For Red Hat and derivatives you can use yum.

yum install mdadm

Debian and derivatives you can use.

apt-get install mdadm

Array Creation

If you carefully look at the command below you can see the creation of the array, RAID level selected, and the devices to be included in the array.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
  • /dev/md0

    – is the name of our array

  • --level=1

    – equals RAID1 or mirror

  • --raid-devices=2

    – means the amount of required drives

You’ll be asked Continue creating array?, the answer is Yes.

Now we add the new array to the systems mdadm configuration file mdadm.conf.

mdadm --detail –-scan >> /etc/mdadm.conf

Monitor the creation or rebuilt process of the designated array.

root@ubuntu:~# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Sun May  6 20:32:39 2012
     Raid Level : raid1
     Array Size : 125827000 (120.00 GiB 128.85 GB)
  Used Dev Size : 125827000 (120.00 GiB 128.85 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sun May  6 20:33:10 2012
          State : active, resyncing
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

  Resync Status : 1% complete

           Name : ubuntu:0  (local to host ubuntu)
           UUID : 91f3904c:e3580ae7:a2b1cf77:b1be9efa
         Events : 1

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1

If you look at Resync Status : 4% complete is the status of our array,

You can also monitor all arrays within the system. I consider this to be a more elegant display.

root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
      125827000 blocks super 1.2 [2/2] [UU]
      [>....................]  resync =  3.8% (4838272/125827000) finish=30.7min speed=65591K/sec

unused devices: 

Grab a cup of coffee or a beer it might take a while before the operation completes.

Format The Array

Now that our array is complete we format the volume. Format like you would format any other drive.

mkfs -t ext3 /dev/md0

Mount The New Array

If you want to make use of your new array which from now on we’ll call volume we need to mount it first. Create a directory where we can mount it.

mkdir /media/volume0

Now provide the path to the array and path to the directory we create in the previous step.

mount /dev/md0 /media/volume0

Make sure our user can access the partition, by giving ownership of the partition to our regular user. Otherwise you will have to be root to create anything. user:user will changing according to your system.

chown user:user /media/volume0/

Thanks to the df command we can see our RAID protected volume, check the bottom of the output.

user@ubuntu:~$ df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        54G  2.0G   49G   4% /
udev            186M  4.1k  186M   1% /dev
tmpfs            78M  308k   78M   1% /run
none            5.3M     0  5.3M   0% /run/lock
none            194M     0  194M   0% /run/shm
/dev/md0        127G  197M  121G   1% /media/volume0

However, if you want the volume to to survive a reboot you need to add the volume to the /etc/fstab configuration file. You can easily add the new array by making use of the echo command.

echo '/dev/md0 /media/volume0 ext3 noatime,rw 0 0' >> /etc/fstab

Let’s see if our new entry is in the /etc/fstab file.

[root@iou ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 22 20:41:14 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=489ea666-1374-41ba-b4ef-725c04693437 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

/dev/md0 /media/volume0 ext3 noatime,rw 0 0

There it is, now our array should be mount it every time we start the system. If you have questions or suggestion on how this tutorial could be improved leave a comment below, thank you.

Mount exFAT Formatted Drives In Ubuntu

ExFAT is an abbreviation for Extended File Allocation Table a file system intended for use in flash drives, exFAT main advantage over the more traditional FAT/FAT32 file system is that it can store a file larger than 4GB. With the increase in flash drive capacity FAT/FAT32 can be limiting. While exFAT sounds like the right solution it comes with inherit problems for users of Free Software such as Linux, you see exFAT is a file system created and patented by Microsoft meaning due to patents support for exFAT in Free Software is bound to be flaky.

ExFAT adoption is not a problem for the Windows platform: by Windows XP (SP2), Vista, and 7 are already support exFAT.

While not the best solution it is possible to mount exFAT formatted drives by using FUSE which is also an abbreviation for File system in Userspace, 🙁 .

Installation and Configuration

Before you can make use of Fuse-exFAT you need to first install python-software-properties which includes add-apt-repository.

  • This is required of you wish to continue with this tutorial, this package includes the tool needed to add the repository.
  • sudo apt-get install python-software-properties
  • Add the new PPA (http://pre.google.com/p/exfat/).
  • sudo add-apt-repository ppa:relan/exfat
  • Update the system.
  • sudo apt-get update
  • Install Fuse-exFAT
  • sudo apt-get install fuse-exfat
  • Create a directory where we can mount the drive.
  • sudo mkdir /media/exfat
  • Mount the drive and specify the file system used by the flash drive.
  • mount -t exfat /dev/sdb1 /media/exfat
  • Display the newly mounted exFAT drive.
  • user@ubuntu:~$ df -H
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1        54G  1.8G   49G   4% /
    udev            186M  4.1k  186M   1% /dev
    tmpfs            78M  279k   78M   1% /run
    none            5.3M     0  5.3M   0% /run/lock
    none            194M     0  194M   0% /run/shm
    /dev/sdb1        2.1G  525k  2.1G   1% /media/exfat

There you have it, it might not be pretty but it works.

New Virtual Machines Available: Ubuntu 12.04 32-bit and 64-bit

Precise Pangolin or Ubuntu 12.04 is now available as a virtual machine. Like always the specs are:

  • CPU: 1
  • Memory: 512
  • Disk Space: 50GB
  • Networking: NAT | Sound card: Enabled
  • Compressed using 7-Zip

Download from the links below:

Ubuntu 12.04 Server 32-bit – 382MB
.MD5
.SHA1

Ubuntu 12.04 Server 64-bit – 377MB
.MD5
.SHA1

Roll Back A Problematic NVIDIA Driver

Device driver or software driver are a must if you want to get the most out of what ever hardware you are using and in my case it happens to be a graphics card but this time updating to the latest driver released by NVIDIA resulted in an annoying problem. Whenever I play Battlefield 2 Bad Company I sometimes get a black screen right when I am about to shoot some punk. NVIDIA drivers now support Braille ?.

In Windows rolling back to a previous driver version is surprisingly easy all you have to use is the Windows Device Manager.

As of this writing the latest driver for my NVIDIA 8800GTS graphics card is 296.10.

Device Manager

From Windows go to Start > Administrative Tools > Computer Management or go to Run and type compmgmt.msc.

On the left sidebar search for and click on Device Manager.

Search for Display Adapters and right click on yours, click on Properties.

Select the Driver tab.

Click on Roll Back Driver.

In order to revert back to the old drive you have to click on Yes. Wait for the changes to take effect you might get a temporary black screen.

To see if the changes were successful check in the NVIDIA Control Panel.

Securely Erase A Drive With Shred

The reason why tools like Shred exist is because we don’t like the tough of our files ending in the hands of the wrong people and if it’s within our reach to prevent such an occurrence then why not take the steps.

Shred accomplishes its goal by repeatedly overwriting the target with specific data patterns in order to make recovery of the data contained within the drive impossible.

As long as the system can see the drive Shred should have no problem erasing the contents. Keep in mind that erasing a drive will take a considerable amount of time.

The simple version of shred would be.

shred /dev/sda2

This would erase the second partition in /sda using default options.

But we are geeks and the defaults just wont do, if you like you can opt to use different parameters as explained below.

shred -fzv /dev/sdb

f = If necessary override file permission and overwrite
z = final overwrite with zeros to hide shredding process, you don’t want the drive to stand out
v = Display operation progress

By default Shred will overwrite the target three times if you think the default is too much or too little you can change the default by adding the -n # parameter to change the overwrite amount.

shred -fzv -n 1 /dev/sdb

Shred will not save you from the XKCD five dollar wrench recovery method.

XKCD Five Dollar Wrench

Hash The Contents Of An Entire Drive With md5deep

Previously I wrote about Hashing a directory with md5deep since that post was written I’ve received a few comments asking how to accomplish the same but with an entire drive which is why I’ve decided to write this post.

The actual command to hash an entire drive with md5deep is quite easy to understand and execute just like before.

Normally if all you want it to do is hash a single directory you would use the exact command below.

md5deep -rel E:Encoder_Output > Encoder_Output.md5

The command to hash the contents of an entire drive is similar to the one above, but instead of using the directory path we only need to use the drive letter.

md5deep -rel E: > E_Results.md5

Command Explanation

  • r = recursive operation
  • e = compute estimated time remaining for file name
  • l = print relative paths for file name
  • E: = Drive you need to hash
  • > E_Results.md5 = output file

Once you have the resulting hashes from the operation in a text file you can refer to my second post on how to Compare Hashes With md5deep.