Archive

Posts Tagged ‘solaris’

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

Sun ushers in VirtualBox 2.1 with cool new features!

December 18th, 2008 2 comments

VirtualBoxIt only feels like last month Sun released VirtualBox 2.0 and they’ve just released 2.1 which brings a plethora of additional goodies… from the changelog:

  • Support for hardware virtualization (VT-x and AMD-V) on Mac OS X hosts
  • Support for 64-bit guests on 32-bit host operating systems (experimental; see user manual, chapter 1.6, 64-bit guests, page 16)
  • Added support for Intel Nehalem virtualization enhancements (EPT and VPID; see user manual, chapter 1.2, Software vs. hardware virtualization (VT-x and AMD-V), page 10))
  • Experimental 3D acceleration via OpenGL (see user manual, chapter 4.8, Hardware 3D acceleration (OpenGL), page 66)
  • Experimental LsiLogic and BusLogic SCSI controllers (see user manual, chapter 5.1, Hard disk controllers: IDE, SATA (AHCI), SCSI, page 70)
  • Full VMDK/VHD support including snapshots (see user manual, chapter 5.2, Disk image ?les (VDI, VMDK, VHD), page 72)
  • New NAT engine with signi?cantly better performance, reliability and ICMP echo (ping) support (bugs #1046, #2438, #2223, #1247)
  • New Host Interface Networking implementations for Windows and Linux hosts with easier setup (replaces TUN/TAP on Linux and manual bridging on Windows)

Some key things to note here, those “cool” people that run OS X can now get hardware virtualisation. Even if you have a 32bit host operating system your able to run 64bit hosts so long as you enable hardware acceleration on the CPU (AMD-V or Intel-VT) as VirtualBox’s Hypervisor requires this to work. A couple of other major additions – tested personally, include the enhanced virtualisation on the new Nahalem processors (Extended Page Table & Virtual Processor Identifier – see below) and the starting block for OpenGL (and later DirectX) Acceleration in XP and Vista. Testing this on OpenGL gave some decent performance though its still got a bit of work to do.

The move to include 3D acceleration is an interesting one, considering VMWare recently acquired Tungsten Graphics – who is the company behind Mesa, TTM memory manager and Gallium3D.  Interesting times ahead – as always :)

What’s an Extendable Page Table & that VPID thing???

Virtualisation in the Intel world comes in two flavours, the Intel VT-x and Intel VT-i Architectures. The VT-x is for IA-32 processors, whilst the VT-i is for Itanium processors.

Intel took a slice of the Virtualisation pie offered by AMD’s Pacifier architecture in implementing a method of translating ordinary IA-32 page tables from the guest-physical addresses to the host-physical addresses used to access memory. This way, guest’s can handle their own page tables directly and page-faults associated with them directly and minimize the (sizable) overhead associated with translating. This is known as Extended Page Tables (EPT).

Virtual Processor Identifiers (VPIDs) on the other hand allows a hypervisor (or a VMM) to assign a non-zero VPID to each virtual processor with the initial processor (VPID = 0) assigned to the hypervisor itself. This way, the CPU can use the VPIDs to tag translations in the Translation Lookaside Buffer (TLB) which removes the performance penalties associated with flushing TLBs on VM Entry and exit.

Both these two bits of technology (along with NMI-window exiting)  come on the Nahelem processor‘s Virtualisation enhancments. If your interested in a more indepth explanation see the article Solving Virtualisation Challenges with VT-X and VT-I from the Intel Technology Journal.

Other Changes in 2.1

  • VMM: signi?cant performance improvements for VT-x (real mode execution)
  • VMM: support for hardware breakpoints (VT-x and AMD-V only; bug #477)
  • VMM: VGA performance improvements for VT-x and AMD-V
  • VMM: Solaris and OpenSolaris guest performance improvements for AMD-V (Barcelona family CPUs only)
  • VMM: ?xed guru meditation while running the Dr. Web virus scanner (software virtualization only; bug #1439)
  • VMM: deactivate VT-x and AMD-V when the host machine goes into suspend mode; reactivate when the host machine resumes (Windows, Mac OS X & Linux hosts; bug #1660)
  • VMM: ?xed guest hangs when restoring VT-x or AMD-V saved states/snapshots
  • VMM: ?xed guru meditation when executing a one byte debug instruction (VT-x only; bug #2617)
  • VMM: ?xed guru meditation for PAE guests on non-PAE hosts (VT-x)
  • VMM: disallow mixing of software and hardware virtualization execution in general (bug #2404)
  • VMM: ?xed black screen when booting OS/2 1.x (AMD-V only)
  • GUI: pause running VMs when the host machine goes into suspend mode (Windows & Mac OS X hosts)
  • GUI: resume previously paused VMs when the host machine resumes after suspend (Windows & Mac OS X hosts)
  • GUI: save the state of running or paused VMs when the host machine’s battery reaches critical level (Windows hosts)
  • GUI: properly restore the position of the selector window when running on the compiz window manager
  • GUI: properly restore the VM in seamless mode (2.0 regression)
  • GUI: warn user about non optimal memory settings
  • GUI: structure operating system list according to family and version for improved usability
  • GUI: prede?ned settings for QNX guests
  • IDE: improved ATAPI passthrough support
  • Networking: added support for up to 8 Ethernet adapters per VM
  • Networking: ?xed issue where a VM could lose connectivity after a reboot
  • iSCSI: allow snapshot/diff creation using local VDI ?le
  • iSCSI: improved interoperability with iSCSI targets
  • Graphics: ?xed handling of a guest video memory which is not a power of two (bug #2724)
  • VBoxManage: ?xed bug which prevented setting up the serial port for direct device access.
  • VBoxManage: added support for VMDK and VHD image creation
  • VBoxManage: added support for image conversion (VDI/VMDK/VHD/RAW)
  • Solaris hosts: added IPv6 support between host and guest when using host interface networking
  • Mac OS X hosts: added ACPI host power status reporting
  • API: redesigned storage model with better generalization
  • API: allow attaching a hard disk to more than one VM at a time
  • API: added methods to return network con?guration information of the host system
  • Shared Folders: performance and stability ?xes for Windows guests (Microsoft Of?ce Applications)

Performance & Updates

Overall, on the two different machines that I’ve tried the new 2.1 release on, they’ve both “felt” snappier (QX6850 and a Core i7 965Earchitecture summary) but unlike the 1.6 release – which was somewhat flakey for me, 2.x releases of VirtualBox are solid.

3D Acceleration Option

Dont take my word for it, download and try it out.

Gets me a VirtualBox 2.1

Grab your copy and try it out.

  • VirtualBox 2.1.0 for Windows hosts x86 | AMD64
  • VirtualBox 2.1.0 for Solaris and OpenSolaris hosts x86 | AMD64

Give it a shot, heck try OpenSolaris 2008.11 on there just for kicks!

{lang: 'en-GB'}
Share

OpenSolaris 2008.11 out the door!!!

December 3rd, 2008 No comments

OpenSolaris 2008.11 has just been released, it encompasses some super cool new features and I’ve been waiting patiently to try this OS – need something new to learn!

The OpenSolaris 2008.11 operating system is a point of integration for the installation, desktop, and package management system projects on OpenSolaris.org. Today, the OpenSolaris 2008.11 live CD is available with the following feature updates:

ZFS Time Slider and Songbird;suspend/resume and CPU power management; Distribution Constructor and Prototype Automated Installer; WebStack with 64-bit MySQL, CherryPy, and DTrace for Ruby; GNOME 2.24, OpenOffice.org 3.0, and Firefox 3; Many F/OSS applications added, including top, sudo and Emacs; 700 additional man pages and Package Manager online help

Just a bit of background, OpenSolaris is based on Solaris, which was originally released by Sun Micro-Systems in 1991. Sun decided to release Open-Solaris to build a developer community around their Solaris product. Eventually it seems they will be basing technology for Solaris from OpenSolaris. So you know OpenSolaris will rock your world if its backed by Sun.

Download page for OpenSolaris 2008.11 or Direct Download of ISO and the 2008.11 Release notes.

Checkout the newly revamped OpenSolaris website, in particular the Learn area. Personally I’m looking forward to seeing the ZFS, Virtualisation Enhancements and DTrace loving.

{lang: 'en-GB'}
Share