May 13

Linux is blessed with a variety of methods for accessing, expanding and building dynamic, scalable storage solutions. And they’re not just for industry experts either – even everyday Linux users can get access to a great deal of functionality by sharing and accessing data across a network.

Set up iSCSI and your data will stream from your PC like a magical rainbow. Perhaps. If you’re very lucky.

But there’s a new generation of solutions that can increase performance, offer more features and improve security – one of which is iSCSI. As its name implies, iSCSI is a version of the SCSI protocol, which is responsible for shuffling data between various SCSI devices. The key difference with iSCSI is that instead of transporting data across local cables and buses, the ‘i’ takes that data across the internet or your local network, attaching remote storage devices to your local system. It’s perfect for storage area networks (SANs) in particular, and you’ll find network administrators in enterprises of all sizes singing the praises of iSCSI’s ability to combine big-business fibre channel commands with generic networking hardware, saving their departments thousands of pounds in both hardware and infrastructure costs. iSCSI is also a great general-purpose remote storage solution that could easily replace the NFS protocol.

Understanding iSCSI

You can now find iSCSI in many network-attached storage (NAS) devices for the home and even standard Linux installations. This is because it’s a great storage protocol for an expanding network. It might be hard work to master, but you can build a working configuration with relative ease. The great advantage that iSCSI has over some of the alternatives is that drives are exported as block devices, just as blocks of data would be transported over an old SCSI cable. This means that, to the Linux kernel, these drives are handled exactly like local block devices. This makes it perfect for connecting the storage area of a database to the client application or, more recently, the virtual storage devices used by VMware and VirtualBox virtual machines. It’s also ideal if you want to run a machine without any local storage – traditionally the domain of NFS.

Use ‘apt-get install iscsitarget’ to add the appropriate packages to your installation.

Before getting started, your first step should be to familiarise yourself with some of the concepts that are used by iSCSI. These appear to take their names from the Terminator films, with the two most important being the Initiator and the Target. The Initiator is the iSCSI equivalent of the client. It’s the machine you want to have access to the remote data – the one that’s running the applications, or your desktop. The Target is the place the Initiator grabs the data from – another machine running the iSCSI server software and managing the requests to and from the storage medium. You’ll often find NAS drives running the Target server, for example, and you’ll only need to run the Initiator on your local machine in order to access the Target drive.

Set up the Target

It’s possible to share a large variety of different storage types over iSCSI, but the easiest to configure are entire drives. iSCSI connects devices at the block level, which means the job of partitioning and formatting can be left to the Initiator rather than the machine that’s attached directly to the hard drive. On our system, the drive we used was listed as /dev/sdb, and we’ll stick with this example throughout this tutorial. The system drive is normally /dev/sda. To find out what yours is, type fdisk -l on the command line for an overview of what’s connected to your system.

Edit the configuration file in nano. You’ll need to add a line which ensures iSCSI is switched on.

On the Target machine, you first need to install the ‘iscsitarget’ package. You can do this either from the Synaptic package manager or by typing sudo apt-get install iscsitarget on the command line. This will also install several configuration files, and the first of these that we need to look at is ‘/etc/default/iscsitarget’. You can type sudo nano followed by the path to the file name to edit it on the command line, or use your favourite desktop editor if you prefer. We only need to make a single edit here – making sure ‘ISCSITARGET_ENABLE=true’ is the only line in the file. Nano users need to press [Ctrl]+[X], then [Y] to save the changes.

Edit configuration files

The next file we need to edit is ‘/etc/ietd.conf’, which you’ll need to open in an editor. This document contains a working configuration, with lines using the # symbol designated as comments and therefore out of action.

The first line we need to edit defines what’s known as the iSCSI qualified name, or IQN for short. Just search for Target, followed by iqn. As with pages on the net, this IQN name has to be unique to your installation, and it takes the form of ‘iqn’, followed by the year and month, then a reversed version of your domain name. This is then followed by a colon and a reference to whatever you’re going to call the target storage device. This can be anything you like. Here’s what we chose:

iqn.2010-01.com.example:storage.disk2

Next, we need to define the drive that’s going to be shared over iSCSI. Remove the # symbol from the line starting with ‘Lun’ and modify it to read Lun 0 Path=/dev/sdb,Type=fileio. You need to change ‘/dev/sdb’ to the location of the drive that you’ve decided to share. Next, uncomment the Alias line at the bottom of the current section and save the file.

You’ll need to do some deeper editing to the ‘/etc/ietd.conf’ file.

You may have noticed that there are two lines available for a username and password, but we’re going to leave these untouched for now because we’re running our iSCSI device over a trusted network. You can always come back to this point and change the configuration after you’ve got the basic connection working, if you think that you need to.

To enable the device to be shared, open ‘/etc/initiators.allow’ and add iqn.2010-01.com.example:storage.disk2 ALL. When you get the connection working, you’ll need to change ‘ALL’ to the IP address of the machines allowed to access your iSCSI device, but for now we’re trying to remove all obstacles that could stop us getting the connection working. Start the Target server by typing sudo /etc/init.d/iscsitarget start.

Set up the Initiator

It’s now the turn of the other machine, the Initiator. To begin, you need to install the ‘open-iscsi’ package. Once that’s done, open the ‘/etc/iscsi/iscsid.conf’ configuration file and look for the line starting with ‘node.startup’. Change the default value of ‘manual’ to automatic, save the file and restart the service by typing sudo /etc/init.d/open-iscsi restart.

Make sure you change the node startup option to ‘manual’.

Almost everything is now configured and ready to go. Our next step is to probe the Target machine to see what storage services it offers, hopefully listing our drive in the process. Type iscsiadm -m discovery -t st -p, followed by the IP address of the Target. You can find this by typing ipconfig on the Target machine. If everything is set up correctly, you should see the IQN of your drive as output to the iscsiadm. This is the output we received:

iscsiadm -m discovery -t st -p 192.168.1.61
192.168.1.61:3260,1 iqn.2010-01.com.example:storage.disk2

Now you know that the Target machine is correctly configured and that iSCSI can see the remote storage device, you need to type iscsiadm -m node. This will automatically create configuration files within /var/lib/iscsi/nodes for the storage unit on your local machine, which will allow the Initiator to mount the device automatically when the service is restarted. You may need to do this manually by typing sudo /etc/init.d/open-iscsi restart.

The remote drive should now be mounted locally. The best way to check is to type fdisk -l to list all the storage devices attached to your machine. The iSCSI drive should be part of the output, but you won’t see any indication that it’s being connected over a network. That’s the great advantage of using iSCSI.

Mount the drive

iSCSI passes the block information, so you need to format the remote drive from the Initiator machine before it can be used. This process is exactly the same as partitioning and formatting any other drive on your system. You could use fdisk on the command line, for example, or you could take the easy route and use a graphical partitioning tool like GParted, which you can install through your distro’s package manager.

After launching GParted, you first need to select the remote drive from the dropdown list in the top-right of the main window. As with fdisk, the iSCSI drive looks exactly like a local drive, so you need to take special care to select the correct device. You can lose data from other drives permanently with GParted, so proceed with caution.

If you’re hooked up to your target drive you should be able to treat it like any locally connected module – including partitioning it.

With the remote drive selected, click on the large grey area in the middle of the window marked ‘unallocated’. This is the unpartitioned area on your remote drive. Click on ‘New’. By default GParted will use the entire disk, but you’re free to subdivide the remote drive in exactly the same way you would a local one if you prefer. Leave ‘Primary Partition’ selected, then select ‘ext4’ as the filesystem and give your drive a meaningful label before clicking ‘Add’. Click on ‘Apply’ to make the changes to the remote drive, and then simply sit back and wait while the formatting process finishes.

Now that the drive is correctly formatted and partitioned, it’s time to mount it onto the local filesystem so you can start reading and writing data to it. You can use the ‘mount’ command to attach the drive just as you would any other, but there’s one small difference that you have to consider whenever you use multiple iSCSI devices – they might not always have the same /dev path. The solution is to navigate to the device using the /dev/disk/by-path/ nodes, so you can be sure you’re getting the same disk every time.

If you type ls /dev/disk/by-path, for example, you can easily see which devices are using the IQN address. In our example, we mounted the remote drive onto the local /mnt/iscsi folder with the following commands:

mkdir /mnt/iscsi
mount /dev/disk/by-path/ip-192.168.1.61\:3260-iscsi-iqn.2010-01.com.example\:storage.disk2-lun-0-part1 /mnt/iscsi

You can now read and write files to the /mnt/iscsi mount point, and these are passed directly to the remote drive just as if they were connected using an extremely long SCSI cable.

iSCSI on NAS boxes

Two of the trickiest parts of using iSCSI are finding the hardware and configuring the Target machine, but luckily there may be another option if you have a Linux-based network-attached storage box. Many of these will offer up a chunk of the storage inside the box over an iSCSI connection, and you can usually activate and configure this facility with just a couple of clicks. Some of these will let multiple Initiators access a single target and enable you to add CHAP password authentication. Then it’s simply a case of running the iSCSI discovery procedure on your Initiator hardware. If you’ve chosen to use a password and username, you’ll need to run the ‘iscsiadm’ command on the Initiator to add those values to the configuration file for that Target. The command takes the following format:

iscsiadm -m node --targetname IQN --portal IP AND PORT OF TARGET --op=update --name node.session.auth.

You need to run this three times, changing the end parameters each time. With the first execution, add authmethod –value=CHAP to the authentication check. For the second, add username –value=username to specify the username for the connection, and for the third execution add password –value=password to specify the password.

Create a virtual hard drive

Many more technical distributions, such as Fedora, use logical volume management (LVM) for local storage and filesystems. One of the advantages of LVM is that you can shrink, expand and create partitions on the fly from the pool of storage on your machine. Logical volumes can be used for all sorts of tasks. Virtual machines often use them to keep data from the main system, and they’re handy if you enjoy playing with filesystems. They’re also useful if you want to try iSCSI, because you don’t need to have a spare hard drive – you just need the space within your logical volume pool.

The key to adding new virtual drives is the ‘lvcreate’ command. We used the following command to create a 10GB logical volume: lvcreate -L10G -n vdrive vg. This creates a volume called ‘vdrive’ in a volume group called ‘vg’. You’ll need to take a look in your /dev directory to discover the name of the logical volume group used by your installation. After creating the drive, it appears in the /dev volume tree just like any other device and you can share it across the iSCSI connection like a real hard drive.

Even without LVM, there are other options for dynamically shared storage. You could create an image file, for example, by typing dd if=/dev/zero of=/mnt/iscsi.img bs=1024k count=1000. The ‘count’ value is the size of the image, while ‘/mnt/iscsi.img’ is the file that’s created. You can use that path as the source for the iSCSI Target on the ‘Lun 0’ line in the ‘/etc/ietd.conf’ configuration file, and use it like a real partition.

Virtualisation

iSCSI is commonly used by cloud applications and the world of virtualisation. This is so you can access the same hard drive data regardless of where the virtual machine is running. If you’re in the market for a major, enterprise-grade virtualisation solution that uses iSCSI, take a look at VMware’s ESXi solution, which is available for free from www.vmware.com.

Boot options

If you want the Target iSCSI device to be available each time you boot the Initiator machine, you will need to add the remote device to the ‘/etc/fstab’ file. The quickest way to do this is to copy another line in the file and change the parameters to suit the iSCSI device. Make sure the path uses the ‘by-name’ format so that you can be sure you get the same drive at each boot.

Apr 29

Detox Windows

Computer Comments Off

Is your Windows 7 machine grinding to a halt already? Don’t despair as we’ll explain how to restore brand-new PC performance-and then go faster still.

There’s a lot to like about Windows 7, not least its many improvements over Vista: the new OS is faster, less demanding on resources, has better designed security and contains many new productivity-boosting features.

If you were an early Windows 7 adopter, though, you may already have noticed that one old problem still remains. The more you use your PC, adding and removing applications, the more junk builds up throughout your system, and the slower and more unstable it eventually becomes. You need to treat the problem, detoxing your PC on a regular basis to remove the leftovers – but how, exactly? Which areas of Windows 7 are most susceptible to this gradual degradation? Are there any tools or benchmarks you can use to reveal problem areas? How much can all this clutter slow you down, anyway, and what’s the best way to remove it all and restore your system to its optimum performance?

As we researched this article, one point was clear. Windows 7 is very different internally to Windows XP, and we couldn’t simply assume that old tricks, like optimising services, would work in the same way. What we needed to do was design a test, something that would reveal exactly why Windows 7 systems slowed down over time, and help uncover the best way to restore that initial new PC performance. And so that’s exactly what we did.

Designing the test

We started our trial by obtaining a powerful new 3XS Intel X58 Core i7 PC from Scan Computers. The machine featured a quad-core Intel Core i7 920 (which was overclocked by 20 per cent), 6MB of RAM and a speedy SATA 300 Samsung hard drive. It was an excellent performer that we knew wouldn’t choke unless it was faced with a set of major performance problems.

When the 3XS PC arrived, we installed the latest Windows 7 (Ultimate Edition, 32-bit) and driver updates and then set about establishing baseline measurements of our PC’s performance.

The best Windows boot time – which we’re defining as the time that elapses between the ‘Starting Windows’ message and the desktop appearing – was 22 seconds. Seeing the desktop means nothing if you can’t use it, so we also measured the time between the ‘Starting Windows’ message appearing and the point that we were able to launch IE and have it display our Google homepage 
(28 seconds).

We also used Task Manager to collect data on free memory and system activity (processes, threads, and so on). Finally we checked how long it took to launch apps, including Firefox and Outlook (both around four seconds).

With the performance of our clean system safely defined, we set about abusing it. We installed Windows Live tools, iTunes, Adobe Reader, browsers, antivirus apps, Microsoft Office, DVD-burning suites, video-editing tools, a large Outlook inbox, hundreds of fonts and more. We accepted every extra that was on offer, then reinstalled and updated the apps before moving plenty of files around to ensure hard drive fragmentation.

Installing apps like iTunes can slow down your system performance in several different ways.

And what did this do to the benchmarks? The plain Windows boot time increased by around a third, from 22 to 30 seconds. Our system was unusable after that for a long time, though, with IE not displaying Google for 140 seconds. Task Manager showed that system activity had more than doubled. Outlook now took five times as long to launch (21 seconds), and shutdown time increased by 50 per cent to 18 seconds.

So even a powerhouse like our 3XS system can be seriously affected by clutter. Now our really important tests began: discovering how to reverse this slowdown.

Defrag options

The hard drive is a big bottleneck on most PCs, and defragging has traditionally been one way to boost performance. Windows 7’s own defrag tool completed the task in a little over 20 minutes, confidently reporting that there was now 0 per cent fragmentation. But this had little effect on our PC, shaving one second off boot time and leaving other benchmarks unaffected. We weren’t convinced, and ran Auslogics Disk Defrag immediately afterwards. This produced some interesting information: it thought our drive was still 16 per cent fragmented. We told the program to optimise our file layout (go to ‘Settings | Program Settings | Algorithms | Move system files to the beginning of the disk’) and set it to work.

Auslogics Disk Defrag optimised the layout of files on your hard drive and gave a real speed improvement as a result.

This delivered real benefits. Boot time fell from 29 to 26 seconds; IE was usable after 107 seconds, a 23 per cent improvement; and launch time for Outlook fell by a third. We can’t guarantee you’ll see similar results, as every defrag situation is different, but it’s clear that Windows 7’s defrag tool alone won’t necessarily do the job. We advise you click Start, type defrag, click ‘Disk Defragmenter’ and make sure that scheduled defrags are turned off for the moment. Then install Auslogics Disk Defrag, turn on the option to relocate your system files, click ‘Settings | Program Settings | Schedule’ and set it to run every few days to keep your drive running optimally.

At your service

A near two-minute wait before we could access the web was far too long. To cut this down we needed to reduce the work that Windows had to do during the boot process, and one effective way to do this was to work on our Windows services. Launching the Services applet (‘services.msc’) revealed the many changes that could be made.

For instance, the Distributed Link Tracking Client maintains links between NTFS files across a network and is started by default. We don’t use the service, though, and you probably don’t either: double-clicking it and setting the Startup Type to ‘Disabled’ will turn it off. IP Helper is similarly pointless unless you have access to an IP6 network, and the Windows Media Player Network Sharing and Media Center Extender services can go unless you’re using them to share your music and videos.

Other services can be configured to start with a delay, giving priority to other tasks and helping your PC to become usable more quickly. The Background Intelligent Transfer Service is important when downloading Windows Updates, but it doesn’t have to be available when you start your PC. Double-click this and set its Startup Type to ‘Automatic (Delayed Start)’. Try the same with Disk Defragmenter, Windows Backup, Windows Search and Windows Update.

We noticed many unnecessary third-party services. Installing Nero 9 got us a Nero BackItUp Scheduler 4.0 service, for example; a LightScribe service assists when labelling discs; and a Visual Studio 2008 Remote Debugger had appeared from somewhere. We weren’t using any of these, so we disabled them all.

Many more could safely have their start-up type set to ‘Automatic (Delayed Start)’: Apple Mobile Device (bundled with iTunes), seven SQL Server services and five from VMware (part of VMware Workstation) all got this treatment. (Don’t choose anything security-related, though: vital services relating to firewalls or antivirus tools must be allowed to start as quickly as possible.)

These changes worked well, cutting our raw boot time from 26 to 24 seconds, while the ‘IE-usable’ time plummeted from 107 to 81 seconds: a significant improvement. But there was more to come.

Startup simplifications

Filling up a PC with numerous start-up programs will really slow it down, yet software authors continue to do this by default, so it’s a good idea to prune your start-up tasks on a regular basis.

Start by quickly browsing your ‘Start | All Programs’ menu. Is there anything you no longer need? Uninstall it now.

Next, we launched msconfig on our test PC, clicked the Startup tab and found 29 programs listed, many of them unnecessary. QuickTime, iTunes, Adobe Reader, Adobe Acrobat, Orbit Downloader, PowerDVD and RealPlayer are all very useful tools, but we didn’t want any of them to launch at boot time.

Other applications install some components that may or may not be useful to you. GoogleToolbarNotifier protects your Google toolbar search settings from unauthorised changes, for instance: that might be handy in some cases, but you may already have antivirus software that does something similar. Magix Movie Editor had added an application called Trayserver that appeared to be unnecessary, and our Cyberlink software had installed a host of tools that seemed less than essential, including ‘cyberlink brs’ (something to do with Blu-ray, apparently), Cyberlink MediaLibrary Service, the Language Application, the StartMen Application and the MUI StartMenu Application.

There may be a few redundant start-up programs that have been there since your PC arrived. Ours included LightScribe, a disc-labelling tool that we weren’t using, and CTXfiHlp, a Creative tool that apparently assists with providing Help functionality, but as we’ve yet to need that, the program felt like something we could do without. Another we found was LG Firmware Update, which checks online for new DVD drive firmware. That’s handy, but we don’t need to run it every boot. However, if you turn this off, make sure that you run it manually regularly.

A program to check for DVD firmware updates is useful, but you don’t need to run it at every boot. Disable this to save some time.

The precise results of all this tweaking will depend on how your PC is configured, but we saw immediate benefits. There was less disk thrashing at boot time, IE was now usable in only 71 seconds, and we’d freed up more than 100MB of RAM for the rest of our system.

Optimise your apps

We’ve concentrated on cleaning up Windows clutter, but your apps can also collect pointless add-ons.

Take Internet Explorer, for instance. While installing software, we accepted every offer of a shiny new IE add-on, with the result being that we now had four extra toolbars. Clicking ‘Tools | Manage Add-ons’ and disabling these freed up a surprisingly high 28 to 36MB of RAM, cut four seconds off the time it took for IE to load and then shaved half a second off every subsequent relaunch.

Typical Microsoft inefficiency? Apparently not. We had also accumulated eight Firefox extensions – AdBlock Plus, DownloadThemAll and so on – and uninstalling those halved the browser’s relaunch time and saved us around 26MB of RAM. So by all means keep the extensions you use, but remember that they come at a price – get rid of any that are surplus to requirements.

It’s a similar story with Microsoft Office. Outlook 2007, for instance, comes with many unnecessary add-ons, and programs like iTunes will install more (without even asking). Disabling all but the key search add-on saved 19MB of RAM on our test system (see the ‘Optimising Outlook’ box for the details), and while the initial launch appeared little different, subsequent launches now required only around 0.4 seconds. Clear unwanted emails out of your inbox for a further speed boost, then check Word, Excel and other Office components for further unnecessary add-ons (though don’t remove anything unless you’re sure you don’t need it).

Clean up your system

Congratulations, you’ve done the hard work – it’s time to clean up. Click Start, type cleanmgr and press [Enter] to launch Disk Cleanup. Follow the instructions and clean up as much of the junk that it finds as you can.

You can get more thorough clean-up help from a tool like CCleaner. It’s not a magic solution – we tried it, and cleaning our Registry made no difference at all to any benchmarks – but it does give you a central place to clean up your browser’s temporary files. That really did help, cutting another five seconds off the time it took IE to load and become usable.

After one further defrag to take advantage of our additional free hard drive space, that was it. So what had our efforts achieved?

Boot time, originally 22 seconds, had initially risen to 30, but we’d brought it back down to 24. The time it took IE to load and display Google, first 28 and at its height a horrible 140 seconds, was now 35.

Initial launch times for Outlook and Firefox were 25 per cent faster. Task Manager showed that system activity had fallen by 30 per cent. We had 300MB more RAM available, and our applications had been tuned to require less than they previously did.

Our work had got us close to the goal of brand-new PC performance. Now it was time to take the next step and make our system go faster than it had ever gone before.

Mar 04

Firmware bug
Firmware bug
By Windell H. Oskay
Used Under Creative Commons

Yesterday morning I got several updates delivered to my laptop via Windows Update.  These were not security patches that are typically delivered by Microsoft on the second Tuesday of the month (commonly referred to as Patch Tuesday).  But these were non-security related updates to the system.  An example of one was an update to the daylight savings functionality, seems that governments around the world are still adjusting the start dates (see  http://support.microsoft.com/KB/979306 if you want the details).

Seeing the updates reminded me that it had been a while since I checked my various devices for updates to the firmware.  This was a good reminder, so I spent a few minutes checking the devices and bringing them up to the latest versions.

Keeping your firmware up to date is just as important as keeping your operating system and applications up to date.  Firmware updates will often correct application issues, close security holes, improve performance and even deliver new functionality.

The IEEE has a very dry, but functional definition of firmware:

The combination of a hardware device and computer instructions and data that reside as read-only software on that device

I tend to think of firmware as this magical layer of software abstraction that has a very intimate relationship with the hardware, but I am kind of a software romantic.

Firmware is becoming increasingly important in computing as we have more and more intelligent hardware devices.  I bet the average person carries at least 1 device that has updatable firmware on it and many of us who are “mobile” workers can carry 3 or more (I have 3 on me right now: Zune, Mobile Phone and laptop).  Even the speaker dock that I have for my Zune has firmware in it.

Firmware updates are different

One of the things that is so nice about Windows Update is that it can be set to automatically update the system by the user (in a home situation) or by the administrator (in a corporate situation).  For the most part your updates are on auto pilot at that point, with the exception of getting prompted for a reboot if an update requires one.

Note: I don’t mean to be a Microsoft “fan boy” in praising Windows Update here; the Apple software update process is similar and just as reliable.  There are philosophical differences between the two; Microsoft’s updates are more numerous, but much smaller in size and Apple generally prefers fewer, but much larger updates.  There are also update processes for software applications other than the operating system as well: Apple Update for Windows, Adobe, Firefox, etc.

Updates to firmware are generally not as seamless and carefree as the Operating System Updates.  Almost no hardware systems pull down the updates and apply them automatically.  The processes by which you apply the updates also vary greatly:

  • The Zune and iPhone firmware updates are pulled down automatically and applied when you tether the devices, but they require software on the machine to accomplish it.
  • The BIOS updates on a computer usually require you to download an specialized installer that updates the firmware the next time you reboot
  • Home routers and access points generally have you download a binary file and upload it through the management interface

The slightly more complicated update process goes to the specialized nature of firmware, because it is at such a low level the update needs a little more care than updating a software application or even an operating system.

When was the last time that you updated your firmware?