Category Archives: File System

Mini How To… How to recover files on a deleted/ corrupt disk


Over Christmas holidays one of the things I did was to replace a failing hard disk in one of my computers with a used one I had spare. The failing hard disk was on an Apple iMac, but that’s another story!

Before I installed it I decided to delete the existing partitions on it using another computers running Ubuntu 12.04 and Gnome 3. At the time this computer had three hard disks installed and dual booted to Windows XP.

Having hooked up the hard disk I booted of a GParted live CD and promptly deleted the partition, shut-down the PC removed the hard disk and then rebooted. All seemed well until I tried to boot into XP where I got missing xyz file error message!

It then dawned on me what had happened. I had wiped the partitions off the wrong hard disk. Whilst I did have a backup, it was a little out of date and whilst normally you can recover deleted partitions with Gparted, if you are using the live CD it will only work if you remain in the original session as the undo information is held on the RAM disk the live CD creates. Once you reboot, your opportunity to recover with Gparted will be lost, as in my case.

To make matters a little more complicated, it was not a Linux disk, but a Windows NTFS formatted disk.

After a bit of searching, I discovered TestDisk which is available in the repositories but also available as a Live CD. More information is available on the testDisk Wiki page http://www.cgsecurity.org/wiki/TestDisk including a Step by Step tutorial.

In my case I booted off the Ubuntu 12.04 partition on the computer and from Terminal ran

sudo apt-get install testdisk

Once installed, from Terminal I entered

sudo testdisk

and the program started.

All I then did was:

  • set my PC type as Intel
  • selected the disk I wanted to recover
  • choose Analyse
  • took the default setting for the NTFS disk format
  • then followed the prompts and the step by step guide mentioned earlier.

Testdisk recovered the partition and 99.9% of the files on the disk.

One of the reasons why this was successful was because I did not use the disk after it was wiped with GParted, had I done so the result would have been less successful.

Next time when deleting partitions on a disk, I’ll double check that it is the right partition by first opening Terminal and entering sudo fdisk -l to list the disk and partition information for each disk.

I’ll also make sure I’m fully awake!

GnomeBaker – Reliable CD / DVD Burning in GNOME


My Ubuntu PC is dual-boot (Windows XP / Ubuntu 10.10). It has a LG HL-DT-ST-DVD-RAM GH22N30 DVD burner which works really well under Windows using Nero Express, but does a great job turning out coasters (regardless of the burn speed) in Ubuntu using the pre-installed burner Brasero . It also takes about half an hour to turn out a DVD coaster and that was will the bulletproof burn feature turned off!

I’ve put up this this for a couple of years as my other Linux PCs running Kubuntu work fine with their DVD burners. They use K3B which in my view is the most rounded and user friendly Linux DVD burner available.

Over Christmas I seriously considered replacing the DVD burner with something else, after a firmware upgrade made no difference under Linux. Whilst I could have installed K3B in GNOME, my preference was to use a native GNOME DVD burning program as this ensures it is 100% compatible. I even tried the DVD burning capabilities in Nautilus but this turned out to be far too basic and I still had burning problems!

I remembered hearing about GnomeBaker a while ago, which seems to be a much underrated GNOME DVD burner. It exists in the Ubuntu repositories, so installation is really easy. To install from Terminal you just enter:

sudo apt-get install gnomebaker

or just search for gnomebaker in the Ubuntu Software Centre and install.

Once installed, I burnt my first DVD at 8x, no coaster to be seen!

Furthermore, it took under 10 minutes to burn a full DVD! Subsequent burns were also successful and fast. As it works like K3B and Nero, it is easy to use for anyone coming from Windows.

UbuntuGeek has done a very nice tutorial on using GnomeBaker, it can be found here.

The sad thing about GnomeBaker is that it is not the default DVD burning software in many Linux distributions. This might be because of its lack of development, the last release was in June 2008.

If it has any shortcomings then the absence of Universal Disk Format (UDF) support and a file size limit of 4Gb could be considered. However, software shortcomings are opportunities in disguise for software developers keen to cut their teeth on a new project.

So, if there are any software developers looking to take on a new project in 2011, then I think GnomeBaker is a worthy project for consideration.

=-=-=-=-=
Powered by Blogilo

Mini How To… Resize Images in Nautilus


In Windows I use an a free image resizer called PIXresizer and it is excellent. Unfortunately it does not run under Linux and whilst GIMP can be used for this purpose it is not particularly convenient.

If you run Nautilus as your file browser i.e. your are using the GNOME window manager, then you can add an extension called  Nautilus Image Converter. It’s available in the Ubuntu Software Centre, just search for “Nautilus Image Converter” or you can do an sudo apt-get install nautilus-image-converter in Terminal.

Once installed you will need to restart Nautilus by either logging out and then back into Linux or by entering nautilus -q in Terminal.

When you open Nautilus and right click on an image(s) file you will see two additional menu options:

Resize Images..
Rotate Images..

The same options are also available under the Edit menu in the menu bar.

Selecting Resize Images.. will give you the following window.

One you have finished adjusting the settings, click Resize and your selected image(s) will be resized.

Mini How To… Make an ISO from a CD/ DVD in Linux


Step 1: Find out your real CD/ DVD drive names!

From Terminal enter

dmesg |grep -i cd

You will get quite a lot of output from this command, look for the lines similar to the ones below

In the above example sr0 and sr1 are the associated CD/ DVD ROM drives. in this example we will use sr0

There are now two ways of creating an ISO, both are done from terminal and in this tutorial we will create them in your Home drive, so the first thing to enter in Terminal is

cd

This will ensure you are in the root of your home drive.

Step 2: Copy the disk to an ISO file

Now use one off the following methods to copy the disk to a ISO file. Both methods produce the same result!

Method 1 – Using CAT

cat /dev/sr0 > isoimagename.iso

Method 2 – Using DD

dd if=/dev/sr0 of=isaimagename.iso

=-=-=-=-=
Powered by Blogilo

FreeNAS Network Attached Storage Server – Part 3


In Part 1 I covered installing FreeNAS

In Part 2 I covered basic FreeNAS configuration, including adding disks

In Part 3 I am now going to cover some of the more advanced topics:

  • Setting up Software RAID
  • Users & Groups
  • File Management and the File Editor
  • Backing up your System Configuration

Setting up a Software RAID

NOTE:

In Parts 1 & 2 I had 256Mb of RAM configured for our FreeNAS server. If you are creating a software RAID, you will need to have at least 512Mb of RAM, otherwise you may experience unpredictable behaviour when creating the RAID.

FreeNAS supports many types of disk RAID Arrays including:

  • RAID 0
  • RAID 1
  • RAID5
  • RAID 0/1/5

See Wikipedia for more information on what each of these types of RAID offer in terms of protection against failure and performance.

JBOD is also supported but is not RAID, it stands for Just a Bunch Of Disks.

In addition to the drive FreeNAS is installed on, we have two hard disks in our FreeNAS Server which we are going to set-up as a Software RAID.

Follow the instructions in Part 2 in the section titled Adding Disks to FreeNAS, but before clicking Add, change the Preformatted file system to Software RAID. It should look something like the following screen-shot for the first disk which I’ve called Disk1. The choice of name is up to you!

Click Add and then repeat for the second disk, the Disks Management window should now look like the following

Click Apply Changes to put the disks online.

We are now ready to create our RAID.

From the menu bar select Disks > Software RAID. With RAID 1 selected (see screen shot below)

click on the + sign to create a RAID array.

Give the RAID a name, we will call it Disk in this example (see note later on).

Select the drives you want to be added to the array and then check the box titled Create and initialised RAID

Click Add. You will be taken to the previous screen where you newly created array is displayed.

Click Apply Changes. You should now get the following screen displayed

Note: in the following screen shot the RAID name was changed from Disk to RAD1

As we have chosen RAID 1 (disk mirroring) even though we used 2 x 2Gb hard disks, only 2Gb is available as usable storage. This is a feature of RAID 1.

The RAID Array now needs to be formatted.

From the menu bar select Disks > Format.

For Disk, select the RAID we have just created from the drop down menu.

Now give the volume a label, I this example we will call it RAID1

Now click Format disk to format the disk.

You will be asked to confirm your choice, click OK.

You will now see formatting information below the Format disk button similar to that below

Done! will appear once formatting has completed.

The final thing left to do is to mount the disk.

From the menu bar select Disks > Mount Point

Click on the + sign on the far right to add a new mount point.

Select the disk to mount in the Disk field and in the Mount point name field give it a name, we will call it DataRAID.

Click Add.

You should see the following in Disk Mount Point Management window

Click Apply changes to mount the disk.

To check the disk is mounted, click on System on the menu bar. You will see something like the following

Note: Although my ‘live’ FreeNAS server is a re-cased Compaq DeskPro EN Pentium 3 800MHz PC with 512Mb RAM, for this tutorial I created a Virtual FreeNAS server in Virtualbox. Hence the rather higher CPU specification!

With the disk mounted, you can now share it. Information on how to do this can be found in Part 2 of this series of FreeNAS articles.

Setting up RAID 5 is very similar, the difference is that at least three disks are required. Gary Sims, author of Learning FreeNAS which can be purchased online, has created a great video which you can view here on how to set-up RAID5 in FreeNAS.


Users & Groups

In Part 2 I touched upon creating a user account in the section Setting up a User Account to Remotely Access the Share. I will now cover this in a bit more detail in relation access permissions to Disk Mount points.

When you create a disk mount point, there is a section called Access Restrictions.

The defaults can be seen above, this is for my mount point called NASDisk1.

The owner is by default the account which created the mount point, normally Admin in FreeNAS. The Group, in this case wheel, restricts which group of users can access the mount point. The Mode section determines which collection of access permissions (Read, Write or eXecute) each category of user has, be it Owner, Group or Others.

From The FreeNAS menu bar select Advanced > File Manager and if asked to login login with your Admin account and password.

As FreeNAS runs FreeBSD, disk mount points are located in the /mnt directory. Open the /mnt directory by clicking on it.

On my FreeNAS server I have two disk drives and therefore two mount mount points, which like any Unix/ Linux OS take the form of a directory.

In the Perm’s column (short for Permissions) you will see the standard Unix Linux file permissions for the directory

Owner

Group

Other

r

w

x

r

w

x

r

w

x

r = Read w = Write x = eXecute

The above is prefixed with a ‘d’ if it is a directory, as with all PC operating systems, a directory is just a special type of file

Where permissions are absent, as in the following example for a file

the earlier table would look like the following

Owner

Group

Other

r

w

x

r

w

x

r

w

x

r

w

x

r

w

r

Which looks like this in File Manager

So, how does this all relate to users?

Well by default, if you create a directory using File Manager logged in as Admin, the default permissions are

drwxrwxr-x

When you create a user in FreeNAS, your primary group is Guest and no additional group is defined by default. Because your account is not the account which created the mount point i.e. Admin, you are therefore not the Owner and so Owner permissions do not apply.

As your account belongs to the Group guest, the Group the mount point belongs to is wheel, therefore Group permissions do not apply which means your account falls into the Other category. In this case this only allows you to Read and eXecute files but does not allow you to write!

There are two ways round this problem:

Either:

A. Change the mount point to it’s group matches that of the user, or better still change the group membership of the user to match the mount point. So make the user a member of the group wheel..

Or:

B. Login to File Manager with the account with which you wish to access the shares remotely, in this way that account is the owner of the directory and therefore has rwx access by default.

Note: It would not be advisable, for security reasons to change the permissions for Other to Write unless you were confident that allowing write access to all users was not going to be a problem, now or in the future.

For more information on Linux/ Unix file system permissions see Wikipedia

File Management

As we have already touched on File Management, it is worth covering it a bit more although there isn’t a massive amount to cover as it is mainly self explanatory.

The File manager supplied with FreeNAS is QuiXplorer which is a simple web based file manager.

You can:

  • create, copy, move and delete files and directories
  • change file and directory permissions
  • browse the FreeNAS file system
  • search for files
  • change users permissions

The last item is probably the most interesting as you can manage user passwords, set whether the user can see hidden files and the level of permissions they have for managing users. An account can also be disabled from this option.

File Editor

Also in the main FreeNAS menu under Advanced is the File Editor, which allows you to browse for a file, Load it, edit it and then Save it. It is by no means advanced, but a useful addition to the toolbox should you feel brave enough to edit FreeNAS configuration files directly!

Backing up your System Configuration

Whilst it is great ‘tweaking’ your FreeNAS system configuration either via the menus or directly using the editor, mistakes do happen and things can go horribly wrong, So it is worth while to backup your system configuration on a regular basis.

From the main menu, click on System > Backup / Restore. The following screen will be displayed.

Click on Download configuration, this will allow you to save your configuration file locally to your PC. It will not save it to the FreeNAS server disks for obvious reasons!

To restore your configuration, browse to where your backup file is stored and click on Restore configuration.

Finally, if all else fails, rather than re-install FreeNAS you can reset the server back to Factory defaults by selecting System > Factory defaults.

Use with care and best to backup your configuration before resetting.

In part 4 of this article, I’ll be looking at e-Mail notification and some of the additional services FreeNAS can run like BitTorrent, which I had to leave out of this article due to space!

=-=-=-=-=
Powered by Blogilo

Using Clonezilla with FreeNAS or Network Share to Backup a Hard Disk


If you’ve used Symantec Ghost http://en.wikipedia.org/wiki/Symantec_Ghost or Acronis True Image http://en.wikipedia.org/wiki/Acronis_True_Image then you will know how useful they are for making images of computer hard disks. Great for backing up all your data or even for disaster recovery. The down side is they are both expensive programs to buy and for us Linux users, not free (as in beer or as in speech).

Clonezilla http://en.wikipedia.org/wiki/Clonezilla is in my view as good as, if not better than, the closed source competition and is highly regarded by IT professionals. I use Clonezilla regularly to image PCs before doing a distribution upgrade and I image both Linux and Windows partitions. I also use it for backing up hard disk and for migrating data between disks. For the latter I use Clonezilla along with GParted Live http://gparted.sourceforge.net/livecd.php. to resize partitions after the cloned image is restored to a new (larger) hard disk.

Because it runs from a ‘live’ CD (ISO image obtainable from http://tinyurl.com/c2myn8) and will read most hard disk formats including NTFS, Clonezilla is OS agnostic. It can backup at partition level to another hard disk or to a USB hard disk, and as we shall see it can also back up to a network share, or in our case to a FreeNAS storage server*.

*See my earlier blog posts on installing and configuring FreeNAS http://preview.tinyurl.com/2eglwrm and http://preview.tinyurl.com/2978jqv .

Cloning a Hard Disk

Insert the Clonezilla ‘Live CD’ and boot the PC off the CD.

The following menu will be displayed.

Select the default option, and press the Enter key. Clonezilla will boot.

Eventually displaying the following “choose language” screen.

Select your language, then press the Enter key.

The “configuring console data” screen will appear

Accept the default and press the Enter key.

You will now be given two options, as we don’t want the command prompt, choose the default option Start Clonezilla and press the Enter key.

You will now get a screen asking if you wish to work with images or clone from one physical disk to another (duplicate). Choose the device-image option and press the Enter key.

You will now be asked where you are going to save the image to, as FreeNAS runs Samba, we will choose samba_server.

Press the Enter key.

Note: If you are not using FreeNAS, but are instead saving to a Windows or Linux Samba share, then you would still select this option.

You will now be asked to set-up a network IP address for Clonezilla so that it can connect to the network share.

As we have a DHCP server (in my case it is my DSL router) I’m going to select dhcp.

Press the Enter key to continue.

Once Clonezilla has obtained an IP address from the DHCP server, you will be asked for the IP address of the Samba server which contains the file share you wish to connect.

In my case the address is of the FreeNAS server is 192.168.1.252, yours is probably different.

Once you have entered the address, press the Enter key to continue.

You will be asked to provide the domain name, if you don’t have a domain name set you can leave this blank. In my case mine is called workgroup.

Press the Enter key to continue.

You will now be asked for a username to connect to the FreeNAS server, the offered name is Administrator. Replace this with a valid username for your network share. In my case I have a username of fernsm1 set-up on my FreeNAS server.

Press the Enter key.

You will then be asked for the destination directory, and will be offered the directory name of /images. Replace this with the name of your network share and the directory within that share you wish to save the image in to.

In my case this is /NASDisk1/images, remember that Unix and Linux operating systems are case sensitive. So if the share name is in upper case, make sure you write it in upper case!

UPDATE: 15/12/10

You can also enter the share name. So in my example the Samba/ CIFS share name is /DiskImages and you just enter what I’ve put in bold text. You may find this more reliable than specifying the actual path.

When done, press the Enter key.

The following screen will be displayed. This is a summary of what you have entered so far, and warns that you will now be asked to enter the password.

Press the Enter key.

At the bottom of the screen the following will appear.

The above is the command string being used to connect Clonezilla to the share.

Type in your password and press Enter.

If the following will be displayed, this means that Clonezilla has successfully connected to the FreeNAS server/ network share. if you get an error message at this stage, check the share name and/ or username/ password and start again.

Press the Enter key.

You now need to select the mode you wish to run Clonezilla in, a list of choices will be displayed

As we are creating an image of the PC, we will use the savedisk option. Select and press the Enter key.

You will then be asked for a name to give the image. By default Clonezilla gives a unique file name based on the date and time. When you have give a file name for the saved image, press the Enter key to continue.

You will now be asked to select the hard disk on the PC which you wish to clone. If you only have one hard disk, just press the Enter key. Otherwise use the cursor keys and space-bar to select/ deselect a disk..

You will now go through a number of screens offering “advanced extra parameters”. Accept the defaults on all.

Once completed, Clonezilla builds a command string should use wish to use it again without having to go through all the menus. In our case it should look similar to the following

Press the Enter key to continue.

Clonezilla will now start the cloning process, telling you what it is about to do and giving you the option to cancel.

If you are happy with the summary it provided, press y followed by the Enter key to continue.

Clonezilla will check the file system of the source PC to ensure okay and determine the cloning method it will use before it starts to clone the hard disk. If satisfied, it will then commence the cloning process.

Once the disk has been cloned, you will see something like this

Congratulations, you have successfully cloned your PCs hard disk to your FreeNAS network share.

Pressing Enter, will give you an options menu:

  1. Poweroff
  2. Reboot
  3. Enter command line prompt
  4. Start over

Warning: The default is option 2.

 

=-=-=-=-=
Powered by Blogilo

FreeNAS Network Attached Storage Server – Part 2: Configuration


In Part 1 we installed our FreeNAS Server on an old PC gathering dust in the corner of the office. In my case this is a Pentium III 800MHz Compaq Deskpro EN tower, maxed out with 512Mb of RAM and a Promise PCI SATA/ IDE card to manage large 250Gb+ hard disks. For FreeNAS this is quite a high spec PC as it can run with 256Mb RAM and a Pentium II CPU!

In Part 2 we are going to configure this PC into to a fully fledged NAS Server.

Configuring FreeNAS Server

Changing the Admin Password

This is the first thing we need to do, now the server is up and running.

From the FreeNAS menu bar, click on System > General and select the Password tab. Your old password is already entered for you, so enter your new password (twice) in the fields provided.

When done, click Save.

The following message will be displayed.

Note:

If you wish you can also change the username from Admin to something else, this can be done from the General tab under WebGUI section. In the Username field enter the name of the username you wish to use, go to the bottom of the page and click Save.

Set-up the File Sharing Service (CIFS/ SMB)

From the FreeNAS menu bar, click on Services > CIFS/ SMB.

Note:

SMB http://en.wikipedia.org/wiki/Samba_%28software%29 and CIFS http://en.wikipedia.org/wiki/Cifs allow Unix/ Linux, Apple OSX and Windows PCs to access the share.

Tick the Enable check box (top right of screen)

Scroll to the bottom of the screen and click on Save and Restart.

The screen should refresh and you should see

Adding the Disk(s) to FreeNAS

From the FreeNAS menu bar, click on Disks > Management, the following screen will be displayed

As we are adding a disk, click on the + symbol on the right.

Now from the Add window, click on the drop-down in Disk field, this will display all your “disk” devices including removable media, like my DVD ROM drive. FreeBSD (Unix) labels disks differently to Linux. ATA type disks (IDE/ SATA) are prefixed with ‘a’, followed by ‘d’ short for disk, CD devices are followed by ‘cd’. A number is allocated for each device, and the device information read to help you identify which device you are selecting.

In the above example, ad1 is a 8Gb IBM hard disk of which 128Mb was allocated to FreeNAS in part 1, the rest is available to use. The remaining ad devices are a 250Gb Hitachi SATA hard disk (ad6) and a 300Gb Maxtor IDE hard disk (ad8). We will select ad6 as our first disk to mount.

As I don’t wish my disks to spin when not in use (it’s good to try to save energy when setting up a NAS box), I’m going to set the Hard disk standby time to 10 minutes.

I’m also going to activate S.M.A.R.T. Hard disk monitoring as I will not be using a software RAID disk in this NAS configuration as I want to maximise my available disk space. Tick Activate S.M.A.R.T monitoring for this device.

Click Add to save the settings, you will be returned to the Disk Management screen. An information box will advise you to click Apply to apply the changes to the disk. Once clicked, the disk status will change from initialising to ONLINE.

Under the File System column, you will notice that the disk is showing as unformatted.

Format the Disk

To format the disk, from the FreeNAS menu bar select Disk > Format.

In the Disk field, select the disk you wish to format, in our example only one is listed because only one disk has been added to FreeNAS.

Give the disk a Volume label, this will be used to identify the disk. In our example, I’m calling this disk NAS1.

The completed screen should look like the following

As you will notice, I’ve headed the warning at the bottom of the screen and have kept the default UFS (Unix File System). You are now ready to format the disk, so press Format disk. You will be asked to confirm, click Okay.

The disk will be formatted and the lower half of the screen will fill the output of the format command (sets of random numbers). Once formatting has completed the word Done! will appear at the bottom of the list.

From the FreeNAS menu bar, click on Disks > Management, under the File System column, you will notice that the disk is now showing a UFS file system.

Mounting the Disk

Although the disk is online, and formatted it is not available to use as it has yet to be mounted. To mount a disk from the FreeNAS menu bar, click on Disks > Mount Point.


Click on the ‘+‘ sign on the far right, as you are going to add a disk. In the Mount Point Add screen, in the Disk section under Settings, select the hard disk you have just formatted. Now give it a Mount point name, I’m going to call it in this example NASDisk1.

If you wish you can also give it a description, in the description filed below.

Likewise, you can set the normal Unix/ Linux Read Write and eXecute permissions for different groups of users, set the owner, default is always root (administrator), and add the disk to a group. For our purposes, we will leave this as per the defaults.

See completed screen below

Click Add, you will be returned to the Mount Point Management window, where the disk will show a status of initialising. Click Apply Changes, the disk will be mounted and the status will change to OK.

Whilst in the window, you may notice there are two other tabs, Tools and Fsck. The former allows you to mount or umount (unmount) a disk and the latter which stands for File System Check is used to check the consistency of the Unix/ Linux file system, similar to chkdsk in DOS/ Windows.

Sharing the Disk

From the FreeNAS menu bar, click on Services > CIFS/ SMB. Click on the Shares tab, we are now going to share the disk so that it is available to access over the network.

Click on the ‘+‘ sign on the far right, as you are going to add a share.

Give a Comment for the share, this can be anything useful.

Give the share a name e.g. NASShare1.

In the Path field, you are now going to create the share. Click the browse button, a window similar to the following should appear

NASDisk1 is the mount point for the disk we created earlier. Click on it to select, and then click Okay.

The resulting screen should look something like

Click Apply changes.

You have now created your share on the network.

Accessing the Share over the Network

Now browser the network for the samba share using your file manager:

For Linux

In KDE Dolphin, or in GNOME Nautilus you can either browse your network for the Samba share or enter smb://192.168.1.252/NASShare1/ .

It is also possible to automatically mount a Samba share, for more information see https://help.ubuntu.com/community/SettingUpSamba .

For Windows

Open Windows Explorer or Start > Run and enter \\192.168.1.252\NASShare1.

As we have not set-up security on the share, no password is required, and therefore you should be able to browse you FreeNAS share, add and remove files.

You have now set-up your FreeNAS server Samba share.

Setting up a User Account to Remotely Access the Share

Whilst you can get away with having no user account set-up for remote access to the share, some programs expect a user account. One of them is Clonezilla, which I will be using in my next blog to image up a PC to the FreeNAS server.

To set-up the user account

From the FreeNAS menu bar, click on Access > Users and Groups. Click on the ‘+‘ sign on the far right, as you are going to add a new user.

In the Name field, enter the login name for this account.

In the Full Name field either give the users full name or a description of the purpose of this account

In the Password field, enter a password, (twice)

When complete click Add.

The above screen will appear, click Apply changes. You have now created an account to remotely access the share.

In Part 3, I will be looking at configuring some of the other more advanced features available in FreeNAS, including setting up a software RAID and configuring FreeNAS as a Bittorrent server.

=-=-=-=-=
Powered by Blogilo

FreeNAS Network Attached Storage Server – Part 1: Installation


The appeal of having a Network Attached Storage “box” on the network is great if you wish to have a central place to store your data. However, NAS boxes are expensive starting around £100 and going up to £600 for a Drobo and that’s before you add the hard disks.

If you are like me, you probably have a PC sitting in the corner looking for a new use, and wouldn’t it be great to turn it into a NAS server, and a FTP server and download bittorrets with it….. Well your can, and using FreeNAS you can have it all for free!

In my case this is a Pentium III 800MHz Compaq Deskpro EN tower, maxed out with 512Mb of RAM and a Promise PCI SATA/ IDE card to manage large 250Gb+ hard disks. For FreeNAS this is quite a high spec PC as it can run with 256Mb RAM and a Pentium II CPU!

FreeNAS is an open source Linux distribution based on FreeBSD http://en.wikipedia.org/wiki/FreeNAS. It works as a preconfigured "software appliance". Like any appliance, it needs to be set-up and this is mainly done through a very user friendly web interface.

The following instructions will walk you through installing FreeNAS.

FreeNAS can be downloaded from http://freenas.org/downloads.

Installing FreeNAS Server

Boot off the FreeNAS CD, you will get a boot menu with a countdown timer, allow the PC to boot with the default boot option.

Once booted you will get a menu similar to that below

Select option 9) Install/ Upgrade to hard drive/ flash device, etc.

You will be presented with a number of options as FreeNAS can be installed on a variety of different types of media including USB memory sticks.

We are going to choose option 3 ‘full’ OS install to HDD (Hard Disk Drive), the following will be displayed.

Press enter to confirm.

You will then be asked to select the CD ROM drive the FreeNAS CD is in. Select the drive and press enter.

You will now be asked to select the hard disk on to which to install FreeNAS. Again select the drive and press enter.

The FreeNAS installer will ask you to set the size of the FreeNAS partition

Select the default (128Mb) and press enter.

On being asked about whether you would like a swap partition, select No.

The FreeNAS CD ROM will now be mounted and FreeNAS installed.

Once the installation has completed, you will get a message similar to the following

When you press enter, you will be returned to the Console Set-up menu.

Configuring the Network Interface

Select option 2 Set LAN IP address

You will be asked the following

You now have two options:

Option 1 (If you select Yes): DHCP allocated IP Address

The advantage of DHCP is that you don’t have to worry about configuring the IP address, this is by far the lest technical way of setting up the server and works well if you don’t plan to turn it off.

If you select this option, you will then be asked if you wish to configure the network interface for IPv6. For most people, the answer will be No (default). Press enter, after a few seconds you will get a something similar to the following:

This tells us that the FreeNAS server has an IP Address of 192.168.1.66 and the web interface can be accessed by entering http://192.168.1.66:80 in a web browser. The :80 means that the website will be accessed on port 80.

Pressing Enter returns yo to the main menu.

Option 2 (If you select No): Fixed IP Address

If you answer No, you will be asked to enter your own IP address. Make sure that the first three sets of numbers correspond to your network address range. To check open terminal and enter ifconfig. You should see something similar to the following

Enter the first three sets of numbers which make up the inet addr e.g 192.168.1 and then enter the final number which must be available to use. If uncertain, from terminal enter ping followed by the full IP address you wish to use. If you get the Message “Destination Host Unreachable” then it is unlikely that that IP address is being used. Press CTRL+C to terminate the ping.

Enter the fixed IP address you wish to use.

Select OK and press enter.

You will now be asked to enter the subnet mask using CIDR (Classless Inter Domain Routing) http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing notation

The easiest way to work out this two digit number from your subnet mask which in our example we got 255.255.255.0 from doing an ifconfig (see above) is to use a online calculator. I use http://grox.net/utils/whatmask/ which is simple to use.

Enter the IP address, and press Go, you will get something similar to the following

In this example the CIDR number is 24. Enter it and select OK.

You will now be asked to enter your default Gateway, this is normally 254, so in this example you would enter 192.168.1.254.

You will next be asked for a DNS IP address. Unless you are running your own DNS server, leave this black and select OK. Other wise enter your DNS server IP address.

You will then be asked if you wish to configure the network interface for IPv6. For most people, the answer will be No (default). Press enter, after a few seconds you will get a something similar to the following

This tells us that the FreeNAS server has an IP Address of 192.168.1.120 and the web interface can be accessed by entering http://192.168.1.120:80 in a web browser. The :80 means that the website is being accessed on port 80.

Pressing Enter returns you to the main menu. You are now ready to login

Logging in to you FreeNAS Server

On a network attached PC, open a web browser and enter the ip address 192.168.1.120:80.

The following login screen will be displayed

Enter the following login credentials:

Username: admin

Password: freenas

The FreeNAS home page of you server will now be displayed

You have successfully installed your FreeNAS server.

In Part 2, I’ll be looking at configuring FreeNAS and mounting your storage so it is accessible from other computers.

How to Mount an ISO Image


From Terminal enter the following to create a mount point (directory) for your ISO file. This is an one-off activity.

sudo mkdir /media/iso

Mounting the ISO Image

Now mount the iso file whatever.iso using the following command

sudo mount $HOME/whatever.iso /media/iso/ -t iso9660 -o loop

Short, sweet and simple!

Un-mounting the ISO Image

To un-mount the ISO image, from terminal enter

sudo umount /media/iso

=-=-=-=-=
Powered by Bilbo Blogger

Joining Files the Linux Way


The Concatenate Command – cat

You can use the cat command to join files together without using an editor. To do this, type cat, the names of the files you want to join together, and then redirect the output into a new file.

For example, if you want to join together file1, file2, and file3 into a file called allfiles, you could type:

cat file1 file2 file3 > allfiles

The nice thing about the cat command is it can join nearly any type of file as long as the format of the files are the same. For example you can join avi files if they are in the same format, e.g. stop motion video taken by a web cam.

However, there are some types of files which are better left for more specialist programs to join, and one of these file types is created using a cross platform program called hjsplit http://hjsplit.en.softonic.com/. For these file lxsplit is a more reliable option, although a Java version of hjsplit does exist for Linux, the former is easier an quicker!

lxsplit for Joining Split (e.g. hjsplit) Files

To Join a file split with HJSPLIT or lxsplit enter from the directory where the file is located

lxsplit -j <filename>.001

A new file consisting of all the split parts will be created called <filename>

If you have not already guessed, the -j is short for Join!

Using lxsplit for Splitting Files

There are many reasons why you may wish to split a file e.g. your e-mail system has a 10Mb file attachment limit and you want to send a 30Mb file.

To split a 30Mb file in to 10Mb sections you would enter:

lxsplit -s <largefilename> 10M

where <largefilename> is the name of the 30Mb file.

A Manual page exists for lxsplit and this can be displayed in Terminal by entering

man lxsplit

=-=-=-=-=
Powered by Bilbo Blogger