ComTech: IT Support Stirling
TwitterFacebookGoogle

How to set up RAID 1 on an existing Linux system


Recently I did a tutorial on how to set up RAID 1 on a new Linux system.  Today I will show you how to set up RAID 1 on an existing system.  Why I hear you ask on an existing system? It is true that, if possible, you should set up RAID on a server during installation however there are times that you can’t (only one hard disk present or the person installing didn’t know the correct procedure so chose not too instead).

The method I am going to show you involves using a piece of software called Clonezilla, which is opensource cloning software, so you will need to get your hands on it. You can download it from the Clonezilla website.

For the purpose of this tutorial I will be using Ubuntu 12.04 installed on a 500 Gb hard drive.  I will clone the installation using Clonezilla and then set up a RAID 1 array on two new 1 Tb hard drives.  Once the RAID 1 array has been set up I will then copy the Ubuntu image onto it.

Lets get started.  First thing to do is to BACKUP ALL YOUR DATA.  Even though you are effectively backing up your data when you image it I always recommend you backup your data using a different method just incase something happens.

Now onto imaging your system.  I have already written a tutorial which covers the required steps so rather than repeat myself please refer to the Clonezilla Tutorial for the method.

Once you have imaged your system connect your two new 1 Tb hard drives and disconnect the old 500 Gb one and again reboot the system using the Clonezilla Live CD.  Go through the menus the same as before until you get to the screenshot below.

Clonezilla1

 

This time instead of choosing Start_Clonezilla choose Enter_Shell.  Once at the shell we need to check our two new disks so type:

sudo fdisk -l

Write down the designations of the two disks (e.g /dev/sda) as we are going to need these later.

Now we need to create partitions and filesystems on the two disks and we do this by using fdisk.  The steps required to accomplish this are covered in How to format a hard drive on Ubuntu 12.04 using fdisk.

Now we need to install a package called mdadm which we shall use to set up the RAID 1 array so type:

sudo apt-get install mdadm

Once installed we can go about setting up the array.  In your terminal type the following:

sudo mdadm –create –verbose /dev/md0 –level=1 –raid-devices=2 /dev/sda /dev/sdb

NOTE: There are two dashes infront of create, verbose, level and raid

In the above command:

level=1 is the raid level (in this case Mirror)

raid-devices=2 is the number of hard disks in the array

/dev/sda and /dev/sdb are the disks to be used (obtained earlier using fdisk)

If successful then you should get mdadm: array /dev/md0 started

Now we just to check the array so in your terminal type:

mdadm –detail –scan (again using two dashes)

This command should return details of the array we have just set up.

All that is left to do is to exit the shell and resume Clonezilla so in your terminal type:

exit

which should return you to the screenshot we had earlier.  This time choose Start_Clonezilla.

Follow the wizard to install your saved image onto the new RAID 1 array.

About the Author

Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients in and around Stirling.

For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more.

 

 

 

 

How to format a hard drive on Ubuntu 12.04 using Fdisk


Today I will show you how to format a hard disk using Fdisk.  Fdisk comes already installed on most modern Linux distributions by default.

For the purpose of this tutorial I will be using Fdisk on Ubuntu 12.04 to format a 16Gb USB penstick with the ntfs file system.

First we need to see what our 16Gb USB penstick is mounted as so open up a terminal and type:

sudo fdisk -l

and type your password when prompted.  You should get a screenshot similar to the one below.

In this case my 16Gb USB penstick is mounted at /dev/sdc1.

Next type:

sudo fdisk /dev/sdc1

and you should get the command prompt shown below.

Now we need to check the existing partitions on the penstick so type:

p

to get the screenshot below.

Now we know what is on the drive it is time to delete it so type:

d

You will then be asked for the partition number (1-4).  In my case I have 4 partitions on the disk and I need to delete them all.  So I will type 1 and this will erase the 1st partition only.  I would then be left with partitions 2 – 4 and to remove these I would repeat the procedure until all the partitions have been erased.

We now need to set up the new partition so in your terminal type:

n

Because this is the first partition on the drive type:

p

You will now be asked for a partition number.  Choose 1 and then press return.  When asked to specify the First Sector choose the default by pressing Return.  Again accept the default Last Sector by pressing Return.

Now that the partition parameters have been specified we need to write them to the hard drive and we do that by typing:

w

All that is left to do is to make the filesystem on the hard drive and to do that we type:

sudo mkfs -t ntfs /dev/sdc1

Next time I will show you how to accomplish the same task using GParted (for those who like a GUI).

About the Author

P1020114

Hi I’m Chris Wakefield the owner of ComTech IT Support. I provide Windows, Mac and Linux based IT Support to small businesses in Stirling, Alloa and Falkirk.

Follow @Comtech247 on Twitter

 

How to recover data using a Linux Live CD

I have touched on this in a previous post but today we will have another more detailed look at how to recover data using a linux live CD.  Live cd’s can be easily downloaded off the internet and most distributions now have one.  For the purpose of this tutorial I have used a Linux Mint 11 live DVD which acts in exactly the same way.

The data recovery procedure is as follows:

1. Load a live CD / DVD and wait until the desktop environment is visible.

2. Open up a terminal and type sudo fdisk -l.  Write down where your partition is installed e.g /dev/sda1.

3. Next type sudo mkdir realroot.  This will make a directory on the desktop.


4. Next type sudo mount /dev/sda1 realroot (replace /dev/sda1 with the ID of your device obtained in No 1 above).  You should now be able to see your hard drive on the desktop.

5. Browse your hard drive to find the folders where your data is saved.  Locate your data and save to an external hard drive.

About the Author

P1020114

Hi I’m Chris Wakefield the owner of ComTech IT Support. I provide Windows, Mac and Linux based IT Support to small businesses in Stirling, Alloa and Falkirk.

Follow @Comtech247 on Twitter

 

 

 

Formatting a hard drive in Linux


Imagine the situation.  You are using Linux and you want to format a particular hard drive.  What tool would you use?  If you like GUI’s then the best tool to use would be GParted.  But what if you think that GUI’s are not your thing and you want to use the command line?  Then you want fdisk.

Ok here goes, open up a terminal and type su.  When prompted enter your root password.

Type fdisk /dev/device (where device is the ID of your hard drive you want to format eg sda)

Next you want to check for any existing partitions on the drive by pressing p.

You now want to delete any existing partitions by pressing d.

Press n to construct a new partition on the hard drive.

When you get the choice of specifying cyclinders use the default for first and last (unless you have a specific need to change them).

Now we need to write the partition to the disk and we do this by pressing w.

It is now time to make the filesystem on the partition.  First off though you have to choose the file system you want.  At the moment the best one to use in Linux is ext4.  If however you intend to use the hard drive with Windows at some point then use NTFS.

In your terminal type mkfs -t ext4 /dev/device (where device is the ID of your hard drive you want to format eg sda).

All that is left to do is mount the hard drive.  If the hard drive is an external one then it will be automatically mounted when you plug it in.  However if the drive is an internal IDE or SATA drive you will need to enter it into the fstab file which is covered here.

About the Author

P1020114

Hi I’m Chris Wakefield the owner of ComTech IT Support. I provide Windows, Mac and Linux based IT Support to small businesses in Stirling, Alloa and Falkirk.

Follow @Comtech247 on Twitter

 

 

 

 

 

How to restore the grub bootloader


You know that feeling. You turn on your computer and it attempts to load but nothing happens.  It just hangs.  This tutorial will teach you how to restore the grub bootloader so that everything works again.

Ok the first thing we need is a Linux live CD, any distribution will do.  Insert the Live CD and allow it to load.  Once loaded you need to open a terminal.  We need to find out where your linux partition is installed so type sudo fdisk -l.  You will get a response similiar to;

Device         Boot Start     End     Blocks Id System
/dev/sda1     1    60801   48838  4001  83 Linux

Make a note of this as we will use this later.

Next we need to make a directory on the desktop and mount the partition where Linux is installed

so type sudo mkdir realroot.  Then sudo mount /dev/sda1 realroot.  You should now see your partition mounted on the desktop.

Last thing is to re-install grub into the partition.  We do this by typing sudo grub-install –root-directory=realroot /dev/sda.

And that is it.  Make sure you type sudo where stated above as you need to perform these commands  as root.  Close down the system and reboot.

If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!

At ComTech I work with both Linux and Windows.  I can advise on setting up servers, networks (home and business) or sort out those little gremlins you might have.  Go to www.comtech247.net/contact-us for some good old fashioned advice.

CyberChimps
Follow

Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates