Archive

Posts Tagged ‘ubuntu’

Maintaining your XFS with XFS Filesystem Reorganiser xfs_fsr to defrag

January 25th, 2009 5 comments

File Systems are a hairy topic, on Windows you should be using NTFS (the days of FAT are long gone!) but on Linux, BSD and *Solaris we still have a wide variety to pick and choose depending on our needs. I’ve always been a JFS and XFS fan (previously ReiserFS) until Btrfs goes mainstream (which is one thing to hangout for in Linux Kernel 2.6.29!) and often I’d have a mixture of all three. Our main server at home – affectionately dubbed Zeus, after our lovable Australian Customs puppy Zeus, uses XFS, JFS and Ext3.

JFS to manage the home directories and core file system, ReiserFS for the temp folder and XFS for the heavy file shares – which span multiple terrabytes of files over a LVM (with each file being 1-2Gb in size). The reasoning behind opting for XFS over another file system for the file server was that XFS performs incredibly well under heavy load and scales well when you know the files are big (over 500Mb). Overall I’ve always felt that XFS does provide consistent performance and scalabilty in comparison to the others – but you may think otherwise.

Unfortunately, XFS – whilst quite an excellent file system for managing large files, it seems, suffers from fragmentation over time (especially true if you use your file system for DVR – eg, a Myth backend host) or if the disk gets close to filling up. Luckily there are two utilities that XFS has to manage this fragmentation.

  • xfs_db – XFS Debug Information
    Used to examine an XFS filesystem for problems or gather information about the XFS file system.
  • xfs_fsr – File System Organiser
    Improves the organisation of mounted file systems. The reorganisation algorithm operates on one file at a time, compacting or otherwise improving the layout of the file extents (contiguous blocks of file data).

In Debian/Ubuntu (and derivatives) these two utilities are found in the package xfsdump. Using these two utilities we can workout the health of the file system (xfs_db) and hopefully tune/optimise it (xfs_fsr). I took the plunge last night and optimised Zeus’s main file storage partition:

Filesystem            Size Used Avail Use% Mounted on
/dev/sdf7              40G  3.5G   37G   9% /
varrun               1014M  4.5M 1010M   1% /var/run
varlock              1014M  8.0K 1014M   1% /var/lock
udev                 1014M  112K 1014M   1% /dev
devshm               1014M     0 1014M   0% /dev/shm
lrm                  1014M   34M  980M   4% /lib/modules/2.6.22-15-generic/volatile
/dev/sdf6            1023M   38M  986M   4% /boot
/dev/sdf10            235G  173G   63G  74% /home
/dev/sdf9              10G  544K   10G   1% /opt
/dev/sdf8              10G  2.7G  7.4G  27% /var
/dev/mapper/Storage
                      2.3T  1.9T  408G  83% /media/LVM/Storage
/dev/sde1             466G  396G   71G  85% /media/Backups

As you can see, the LVM “Storage” mount has just under 20% free space and the non-LVM partition for “Backups” has 15% free space. Both these are XFS volumes, to find the health of the two use the xfs_db command to gather some information.

$ sudo  xfs_db -c frag -r /dev/mapper/Storage
$ sudo  xfs_db -c frag -r /dev/sde1

Here we’re asking xfs_db to open the file system in a readonly mode (-r) passing in a command (-c)  to get the file fragementation data (frag) for the device (/dev/*). When we use the frag command, it returns information only pertaining to the file data in the filesystem as opposed to the fragmentation of freespace (which we can guage with passing the freesp command). The output of the commands appear below for Zeus.

thushan@ZEUS:~$ sudo  xfs_db -c frag -r /dev/sde1
actual 189356, ideal 148090, fragmentation factor 21.79%

thushan@ZEUS:~$ sudo  xfs_db -c frag -r /dev/mapper/Storage
actual 406056, ideal 21584, fragmentation factor 94.68%

Wow! The LVM partition (which spans 4 drives) has around 95% fragementation! Yikes!!! The parition has quite a few Virtual Machine images, various large files (DV Captures etc). The “Backup” (sde1) on the other hand isnt as badly fragmented.

So right now we’ve found our problem and its time to fix it. First thing to do – and realise that we can fix this on a live running system – is to try and find a time where the partition will be used very little (like overnight) so you let its do its thing without unnecessary burden. Then lets make use of the File System Organiser utility (xfs_fsr) and ask it to reorganise our parition to the best of its ability.

$ sudo xfs_fsr -t 25200 /dev/mapper/Storage -v
$ sudo xfs_fsr -t 25200 /dev/sde1 -v

Now this is much simpler, the xfs_fsr utility is being told to reorganise /dev/* with a timeout (-t) of 7hrs  (60 * 60 * 7 = 25200) which is specified in seconds. Because I like to see how much is done I also specified the verbose output option (-v). Let it do its thing and hopefully when you return you will have the last bit of output showing the extents before, how many after and the inode, something like this:

extents before:5 after:1 DONE ino=4209066103
ino=4209066107
extents before:5 after:1 DONE ino=4209066107
ino=4209066101
extents before:4 after:1 DONE ino=4209066101
ino=4209066091
extents before:3 after:1 DONE ino=4209066091
ino=4209066093
extents before:3 after:1 DONE ino=4209066093
ino=4209066105
extents before:2 after:1 DONE ino=4209066105
ino=4209066143
extents before:27 after:1 DONE ino=4209066143

Now its time to go back and check how well the file system reorganising was:

$ sudo  xfs_db -c frag -r /dev/mapper/Storage

And the results?

thushan@ZEUS:~$ sudo  xfs_db -c frag -r /dev/mapper/Storage
actual 21652, ideal 21584, fragmentation factor 0.31%

Lovely! What a difference and you’ll notice the improvement immediately if you start moving or transfering files around.

Ideally, you may want to setup a cron task to let this process run (maybe with a lower timeout) overnight or when theres low-load. Whats great about the xfs_fsr utility is that its smart enough to remember where it finished up last time and continue from there. Its a shame Ubuntu doesnt do this already.

{lang: 'en-GB'}
Share

Ubuntu 8.10: Intrepid Ibex Released!

October 31st, 2008 1 comment

With the amount of coverage surely to be taken by Windows 7 we can’t forget the other side of the force, Ubuntu 8.10 Intrepid Ibex was released a few hours ago.

Believe it or not I actually stayed up waiting for it to hit the servers, then hopped over to the iinet FTP server (mirror’d by the Internode servers also) as the 3FL Mirror (Westnet) wasn’t up to date (it is now!) and started leeching the sucker.

8.10 brings:

  • Linux Kernel v2.6.27 – which has the new Atheros driver, improved webcam support and support for the UBFIS file system, among other things documented on KernelNewbies.
  • Support for the UBIFS file system – especially for SSD/Flash drives in the hope it will improve performance and longetitivity of such devices.
  • GNOME v2.24 – which brings a slew of improvements including a tabbed nautilus.
  • X.Org v7.4 – includes Xorg-Server 1.5 which brings faster startup/shutdown times, hot-plugging for input devices.
  • Network Manager 0.7 – which adds 3G and PPPoE connectivity
  • Dynamic Kernel Module support – recompiles kernel modules automajically when kernel is updated.
  • LOTS more, documented in the 8.10 Release notes.

Mono 2.0, Python 2.6 and OpenOffice 3.0 didnt make the cut but will be present in 9.04 already dubbed the Jaunty Jackalope.

Download Ubuntu 8.10 and give it ago. For a complete look at Ubuntu 8.10, checkout these reviews:

Whilst I’ve had to hurry off to work with barely a few hours of sleep I did catch a few minutes of usage after a speedy install thanks to the USB installation method.

{lang: 'en-GB'}
Share

COOL TOOL: Throwaway the CDs & DVDs, use your Flash Drive + UNetbootin to install Linux!

October 11th, 2008 No comments

I’ll admit it, I still have a floppy-drive attached to my maturing beast, which is primarily used as my day-to-day development box. Floppies come in handy for that odd install of XP or below that require RAID drivers (though you can just use nLite and bundle it by default).

But what about the CD-R’s and DVD-R’s in the days of Cloud Browser based Operating Systems (funny)? I recall burning ISOs like no tomorrow when new versions of Ubuntu were released – and I’m sure everyone else who has gone down the Linux or BSD route has had similar experiences.

But before you go burning that ISO at the next install (maybe Ubuntu Intrepid Ibex at the end of the month) you might want to consider an alternate route – and whats more, I’ll bet you it will install faster on newer systems.

I bought a Corsair Voyager GT 16Gb (pdf info-sheet) flash drive a few months back, whilst I’ve been fairly disappointed that its advertised speed fell short of expectations due to the Samsung manufactering process changes, I still kept it dear to myself having paid about AUD$109 for it. (I name things, the drive was dubbed DrSporky). Even though its rated at about 34MB/S read (so realistically it should do about 25-30MB/s) I’ve managed to clock about 19-21MB/s copying a 500Mb file using Teracopy – a real benchmark not a synthetic test and 8Mbp copying it back to the drive (see below). Nothing to sneeze at, but the difference between the GT and the non-GT was the 30MB/s+ read-speed I figured.

I use it almost daily and it carries around a bootable version of Ubuntu 8.04 (Hardy Heron) thanks to the multi-platform utility UNetbootin.

UNetbootin is written in C++ using the Qt4 Toolkit engine (full information is available on the Universal Netboot Installer page on Launchpad) so its compatible on Windows and Linux. Simply download the latest version, insert your USB drive and either let UNetBootbin download the distro you’d like to try _or_ browse to the Disk image to one you’ve already grabbed.

Give it a go and see what you think, installing Ubuntu 8.04.1 on a mates system (ASUS P5KPL-CM & Core E2180) took less than 10minutes (at most 20 if you inlude boot and configuration)!!! The best part is that you can easily reuse it easily formatting etc *AND* store your own things ready to utilise whenever you need it.

So the next time you got install _anything_ give UNetbootin ago and make use of that fast USB Drive instead of wasting CD/DVD writables that you usually endup throwing away.

{lang: 'en-GB'}
Share

HOWTO: Network Monitoring with nTop in Ubuntu

September 28th, 2008 4 comments

ntop is a network probe that shows how much the network is being utilised with very little overhead and impressive graphical representation via the web. Its definately a must-have tool if you run a fileserver.


The version of ntop on the ubuntu mirrors is 3.2.x, so I set out to update to the latest release this weekend (3.3.x released in June last year).

This install is being done on Ubuntu 7.10 using ntop 3.3.7.

First up lets download the distribution of ntop we’re going to be installing. This is the internode mirror in Australia, but you can find your closest mirror via sourceforge.

$ wget http://internode.dl.sourceforge.net/sourceforge/ntop/ntop-3.3.7.tar.gz

Next we need to extract the files to a folder.

$ tar -xvf ./ntop-3.3.7.tar.gz

Next up lets install/make sure we have all the dependencies we need to build this version.

$ sudo aptitude update
$ sudo aptitude install build-essential linux-headers-$(uname -r) librrd2-dev libtool libpcap-dev tcpdump librrd2 rrdtool rrdtool-tcl libgdbm-dev libgdbm3 automake autoconf automake1.7 debhelper gettext html2text intltool-debian libgd2-noxpm-dev libjpeg62-dev libncurses5-dev libssl-dev libwrap0-dev po-debconf

Once the dependencies are installed you can go into the extracted folder and tell it to setup the environment and configure it.

$ cd ./ntop-3.3.7/
$ chmod +x ./autogen.sh
$ ./autogen.sh

This will make sure your environment is correctly setup and configure to build the necessary make files. There shouldn’t be any errors at this point as you have installed all the correct dependencies. Nextup we need to build the application and install it.

$ make
$ sudo make install

Then you can start nTop by running the following command:

$  sudo ntop -P /usr/local/lib/ntop/

There we have it, browse to http://localhost:3000 and you’ll be running the latest and greatest ntop.

{lang: 'en-GB'}
Share

Ubuntu 8.04.1 LTS Released

July 4th, 2008 No comments

Ubuntu 8.04 was released when I was in Japan, but it didnt stop me from downloading it – sucked it up at ~5Mbps which was bloody ridiculous!

Now we can finally get our hands on the first update to this LTS, Ubuntu 8.04.1 which contains – amongst a slew of bug-fixed packages – Firefox 3.0 Final. More information on the changes are posted on the Ubuntu mailing list release notification.

I’m still running 7.10 on the server at home – until I get the bawls (and time!) to redo the lovely server ZEUS has become to be! In the meantime, my Dell M1330 is upgrading to the 8.04.1 release as I write.

Grab a copy of Ubuntu 8.04.1 today!

On a side note, just recently saw the release of Sabayon Linux 3.5 which brings some really cool things to the table, I’ve downloaded the LiveDVD and considering giving it a go.

{lang: 'en-GB'}
Share