Dedicated to my late brave, beautiful and silly mummy, Debra Ross. I love you mumster.

Skip navigation

Category archive for bsd

Because archives are so much easier than having just hundreds of posts on the home page. I learned that the hard way.

My kingdom for a bigger notebook hard drive

An ominous sign of things to come?
An ominous sign of things to come?

It’s crunch time: alas after months of neglect and with so many assignments and projects active and being worked on at any one time, my internal 149 gibibyte (aka 160 gigabyte) hard drive has finally been maxed out. Bummer!

Having used Windows, Linux, FreeBSD, NetBSD and Mac OS X on computers with drives that are nearing breaking point, I do appreciate how incredibly stable the BSDs and Mac are under capacity stress. By comparison the general wisdom with Windows (at least when I still exclusively used it before 2003) was that you must reserve at least 10% of your drive at all time to maintain stability, NTFS included. By comparison, this MacBook Pro has been close full for a while now and still only EyeTV and the slow as molasses Microsoft Office 2008 for Mac applications are capable of crashing it.

As I’ve discovered the hard way though, notebook computers present their own set of storage challenges! For most of my life I’ve been a desktop computer user; it was only in 2006 when I made the decision as a computer science student studying overseas that a souped up notebook computer would make more sense for taking around to different houses and around campus than a new desktop.

Of course the problem with said notebook computers is that you can’t just easily slide in an extra hard drive when your existing one starts to fill up! Sure you can buy external drives, but they still won’t match the performance of the internal drive. What happens then is I tend to backup material to the external drives, but projects I’m compiling, editing video for or otherwise working on end up staying on the internal drive.

VMware Fusion 2.0 beta 2 New Virtual Machine Assistant
What can I say, I love toying around and exploring operating systems!

This is also a problem for virtual machines which I spend lots of time using and writing about. To satisfy my own addiction and fanaticism for studying operating systems, as well as for my work which involves compiling and testing applications, I have multiple VMs on this internal drive. Running these virtual machines on an external drive is completely out of the question given the performance would really, really suffer. Having 12 virtual machines which combined take up 72GiB on a 149GiB notebook drive though is also completely out of the question!

With my desktops in the past I tended to dedicate a smaller drive with the fastest RPM for the operating system and two larger, equally sized drives mirroring each other (later using RAID instead of software) for the data. On my current desktop back in Singapore which I SSH and SFTP into from here in Adelaide I have FreeBSD 7.0 AMD64 on its own dedicated, 10,000RPM SATAII drive with 32MiB of cache shared with binaries, and two 7,200 RPM drives for the home directories, port collections, documentation and served data. Ideally I’d love to have another super fast drive just for /swap too!

On this laptop I’ve got everything under the sun on one drive. Perhaps partitioning the drive and assigning the /Users directory to a secondary partition might help to compartmentalise the information and improve performance. On BSD and Linux it’s trivial to assign the /home directory to a separate volume, on Mac OS X I’m not so sure. Seems like I have some homework ahead of me!

This much taken up, on a 149GiB internal notebook drive. Bummer!
This much taken up… on a 149GiB internal notebook drive.

Of course it probably wouldn’t hurt cleaning this drive out either. I have a few Ruby scripts which I run each afternoon which cleans up my desktop and puts files in the appropriate places, but it can’t determine what is safe to delete and what isn’t. I need an electronic secretary I think. Make someone sign a NDA, then go through my drive and get rid of things. No, wait… perhaps that isn’t such a good idea.

As my fabulous father always says after ringing me from his office in Singapore which has more paper, books, phone receivers, emails and blood pressure tablets than Parliament House: "All I need is a time machine Ruben… then I’d work just fine"

My OS pipe dream, and HP developing a Linux distro?

According to a CNET News report, HP is rumoured to be creating an alternative operating system to Windows, based probably on Linux. From the report:

Is the biggest PC vendor in the world looking to give customers an option besides Windows?

An article appearing in BusinessWeek this week cites anonymous sources who say Hewlett-Packard is at least looking into it. “Sources say employees in HP’s PC division are exploring the possibility of building a mass-market operating system,” the article states.

The operating system would reportedly be Linux-based, but would be tweaked to be more accessible to mainstream users.

If this rumour is true, I think it’s a fantastic move on HP’s part. Apple has shown with Mac OS X that a superior user experience can be achieved outside the realm of Windows by leveraging the power of a free and open source operating system under an aesthetic user interface, on hardware created specifically for the OS and vica versa!

What I’ve always said I’d love to see; and this development might be a step in the right direction; is a break from the monoculture of Windows replaced by a mixture of operating systems that can communicate through open standards. This is perhaps a weakness with efforts like Ubuntu, Debain and other GNU/Linux distributions; they are emulating the Windows model with all the problems associated with all the trillions of different combinations of hardware that they could potentially run on. For people like me who revel in tinkering with computers this isn’t a problem, but for people who actually have work to do on their machines and don’t have a degree in computer science it’s just a pain in the arse.

I’m imagining a time in the not too distant future when:

  • there are an interesting assortment of operating systems such as Mac OS X on Apple computers, HP Linux on HP computers, Dell Haiku on Dells, ASUS Minix on EEEs…
  • despite their different architectures they can all exchange documents with each other and read them without trouble
  • they can all run software written for others with little or no modification through compatibility layers and standardised APIs that everyone respects
  • instead of terms being dictated by one software vendor in Redmond, computer hardware companies modify the software for their customers needs
  • computers become nice to use again
  • vanilla versions of operating systems such as Debian GNU/Linux and FreeBSD continue to exist separately (as well as being the foundations of the custom OSs above) for power users and computer enthusiasts, just as sports cars exist for motoring enthusiasts!

I know it’s a pipe dream that will almost certainly never happen. A nerd can dream though right?

And as for the article specifically related to HP exploring other options besides Windows, any chance HP would create an OpenVMS laptop or consumer desktop? That would be a VERY compelling product! Pipe dream number 2!

VMware Fusion 2.0 beta2 with FreeBSD review

UPDATE: An abridged version of this review has been picked up by the fine folks over at BSD News. If you’ve arrived here from there, all my FreeBSD and NetBSD posts can be found in the aptly-named BSD category. Cheers :-)

I’ve loved using virtualisation software ever since I had an early version of Connectix Virtual PC for my iMac DV back in the early 2000s, and later their Windows version before they were bought out by Microsoft. Virtual PC was mostly intended for people to use recent versions of Windows on Mac OS 8, but I preferred using it for resurrecting classic operating systems such as DOS/Windows 3.x which we had on our first home machine, and playing around with Linux distributions without going through tedious partitioning.

My predictably unnecessarily verbose introduction aside, the latest virtualisation software I’m using on a regular basis is VMware Fusion for Mac OS X, and I’ve been very pleased with it. The second beta release for version 2.0 is out now, and I spent my Sunday afternoon trying out build 107508 with a handful of my most used operating systems, plus FreeDOS for fun!

VMware Fusion 2.0 beta 2 Virtual Machine Library
VMware Fusion 2.0 beta 2 Virtual Machine Library

The most noticeable difference initially between this latest beta and version 1 of Fusion is the redesigned Virtual Machine Library. Taking a cue from Virtual PC, the plain text listing of virtual machines has been revised to include screenshots for the suspended machines. While I think this is a extremely useful and welcome addition for quickly recognising machines visually, I think the Mac-like glossy finishes are a bit overdone. Also despite making the interface more Mac-like overall, I can’t help but think the New, Open and Settings would better be served by a regular toolbar at the top of the window.

The New Virtual Machine Assistant has been improved to allow for more boot and drive options. You’re no longer limited to choosing from a physical or virtual optical disc; you can choose to use an existing virtual drive or even none at all: a VERY welcome addition! Before you run the machine the first time you’re asked whether you want to modify settings too, which means you no longer have to start the machine at the end of the assistant and hastily shut it down to fine tune its configuration.

VMware Fusion 2.0 beta 2 New Virtual Machine Assistant
VMware Fusion 2.0 beta 2 New Virtual Machine Assistant

Speaking of configuration, the Virtual Machine Settings window has been drastically redesigned to make it look much more like the Mac System Preferences application, and to make it easier to access all the new options and virtual devices you can configure. Amongst the new goodies are the ability to configure floppy drives, parallel ports, serial ports, and multiple virtual hard drives. When I saw these additions, I literally jumped out of my chair and screamed "HELL YEAH!"

Fusion 2.0 beta 2 also allows you to visually scale and stretch live running virtual machine displays. Even just a little bit of scaling adversely affects the readability of text, but perhaps for other applications such as full screen gaming which needs to be scaled to fit to an unsupported resolution this might be useful.

VMware Fusion 2.0 beta 2 New Virtual Machine Assistant
Demonstration of the live visual scaling in beta 2. Both the NetBSD and Slackware virtual machines are set to 1024×768 but the latter has been scaled down.

Now for the bad news. I’m not sure if this is a temporary setback as a result of it being a beta version (I did disable debugging checks), but graphical performance in BSD operating systems on my original generation MacBook Pro is nothing short of abysmal. VMware provides welcome additions for FreeBSD, but even installing these in FreeBSD 6.3 Release and using them with the compat6x layer in FreeBSD 7.0 Release made no difference to the overall sluggishness. NetBSD 4.0 was just as bad, without any additions.

This slow performance was most pronounced when I started Xorg on FreeBSD or XFree86 on NetBSD. Typically starting an X11 environment in VMware Fusion 1.x takes less than a second followed by several seconds for loading the desktop environment or vanilla window manager. With Fusion 2.0 beta 2, both FreeBSD and NetBSD take over 5 minutes just to start X11, and another few minutes just to load something as lightweight as Fluxbox… if you want to load Xfce or KDE it takes over a whopping 10 minutes.

To check whether this was a problem with BSD, I tried Slackware Linux 12.1 with the same versions of KDE, Xfce and Xorg; and while it still felt a little sluggish it still managed to load all three in a reasonable amount of time.

Given I need to use FreeBSD for my studies I just can’t use this beta release on a production machine, but if you primarily use Windows or Linux you could probably try it out.

Western Digital MyBook DHCP adventure

Before I go any further, I’d like to warn you that this post about using FreeBSD to assign an address to a Western Digital MyBook drive is unnecessarily verbose. See, I could have just as easily said "this post is long".

Writing about theoretical uses for software is one thing, but figuring out how to apply software to a problem practically, and actually getting it work, is one of the greatest feelings in the world alongside writing a fantastic piece of software yourself to solve a problem. It makes me feel useful and gives me a rush quite unlike anything else.

And he’s available ladies! Unbelievable though it may seem! Come on! He also makes a mean Earl Grey latte. Any bidders? Anyone?

Case in point, my sister and I had a problem in our new house in Adelaide. Before I left Singapore, I bought a gigabit ethernet Western Digital MyBook 1GB World Edition NAS drive and loaded it up with all our media: movies, shows, music, podcasts, BSD disk images, ebooks. By using a simple network drive, we spared ourselves having to bring a separate computer down with us.

Our makeshift home network consists of each of our laptops and the aformentioned network drive which are all connected through short Cat-6 ethernet cables to a 5 port gigabit ethernet switch. To compensate for the lack of a router, I assigned my sister’s MacBook and my MacBook Pro static IP addresses and I knew the network drive could also be assigned one. Very cool.

Our very fancy new home network
Our very fancy new home network.

Now here’s the kicker: for some reason in their infinite wisdom Western Digital decided not to ship the MyBook with a default IP address. This means it requires a DHCP server (Wikipedia link) to initally provide it with an address. I realised that without a router with a built in DHCP server, this network drive wouldn’t get an address, and therefore there’d be no way for me to log into it to assign it a static IP! Catch 22, chicken and the egg, a Bruce Schneier fact, call it what you will.

So within a few minutes I had configured a home network with two laptops and an inaccessible, address-less network drive. It seemed not having a router with a built in DHCP server would make this setup impossible. A quick Perl script determined that indeed only the two laptops were in our subdomain range:

#!/usr/bin/env perl

for ($i = 1; $i < 255; $i++) {
  system “ping -a -c 2 192.168.1.$i”
}

print "Western Digital engineers love DHCP it seems\n";

At this point I had to make a tough decision. To access our media network drive I could either be patient and wait a week until we got our new broadband modem with a built in router, or I could be impatient. Grilled cheese sandwich. Grillec cheese sandwich?

I decided to do the latter and give it what it wanted: a DHCP server! In place of a router, I would configure a one-time use FreeBSD virtual machine with a software DHCP server which would assign the address to the network drive, so I could log into it remotely and assign it a static IP.

My FreeBSD virtual machine showing the DHCP server coming online
My FreeBSD virtual machine showing the DHCP server coming online

After setting up a generic VMware Fusion virtual machine on my MacBook Pro, I mounted a FreeBSD 7.0-RELEASE ISO I had on already had on my hard drive and installed it with all the default options. I skipped configuring everything in the system installer except than the network card. I declined to use DHCP when it asked, and assigned it a static IP.

After rebooting the VM, I logged in as root and installed the isc-dhcp3-server package from ports.

I didn’t bother adding anything fancy to the /usr/local/etc/dhcpd.conf other than defining the pool of addresses and required options:

option domain-name "chuckpeddle";
option subnet-mask 255.255.255.0;

default-lease-time 3600;
max-lease-time 86400;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.120 192.168.1.129;
}

Next, to check what addresses our makeshift DHCP server has assigned, I created the default dhcpd.leases file:

# touch /var/db/dhcpd.leases

Finally, I enabled the dhcpd daemon in /etc/rc.conf and told it what card I wanted FreeBSD to listen for DHCP requests on. On VMware Fusion 1.1.3, the network card in FreeBSD is le0, but you can always check to make sure by using ifconfig -a

dhcpd_enable="YES"
dhcpd_ifaces=”le0″

The moment of truth had arrived! I turned off my Western Digital MyBook NAS drive, rebooted the FreeBSD virtual machine, then turned the network drive back on again. After a minute of waiting, sure enough the /var/db/dhcpd.leases file reported that it had assigned an address…

lease 192.168.1.129 {
  starts 6 2008/08/02 14:37:12;
  ends 6 2008/08/02 15:37:12;
  binding state active;
  next binding state free;
  …
  client-hostname “RubenerdNAS”;
}

… and automagically the Finder on my MacBook Pro reported it had found a new samba share (with it’s irreverent sense of humour)! My network drive had been resurrected from the dead!

My Western Digital MyBook in the Finder
My Western Digital MyBook in the Finder

Finally, after all of that I was able to go to my web browser and log into the damned network drive’s configuration page and change the IP address to a static one.

I still can’t help but wonder why Western Digital decided not to include a default address.

Western Digital NAS config screen, and the FreeBSD DHCP virtual machine
Western Digital NAS config screen, and the FreeBSD DHCP virtual machine

And now if you’d excuse me, I’m off to watch an episode of Cranky Geeks. From my network drive. PHEW!

Backing up CDs to ISOs on FreeBSD

I remember back in 1995 when I was 9 years old our family excitedly got its first CD-ROM drive. This was just before we moved to Singapore and were still living in Australia, and that small little Creative Hex Speed optical spinning wonder cost us a small optical spinning fortune. It was proudly installed above the 5.25 inch floppy drive in our generic 486SX PC clone tower. It came with 10 CDs, we had 2 already. I still have that CD-ROM drive.

MENTAL NOTE: Spend less time on the introductions and more on the actual content on the post. Nobody cares about your first CD-ROM drive!

Here we are in 2008 and despite the fact I haven’t toasted or bought a CD for years I’m literally swimming in thousands of them. As a Windows user back in the dark days I remember I used Nero Express to create backup ISOs out of CDs, then either burn those ISOs to a single DVD or store them on a backup hard disk. Fortunately FreeBSD has similar capabilities with the venerable command line dd utility.

Spiffy somewhat related icons from the Tango Desktop Project
Spiffy icons from the Tango Desktop Project

Insert the CD you want to copy (no, really?), then enter the line below. Substitute acd0 with an alternative device if you have multiple optical drives:

# dd if=/dev/acd0 of=[YOUR_NAME_OF_IMAGE].iso bs=2048

This will take some time. Naturally the CPU power your machine has and the read speed of your optical drive will affect performance. A 52x optical drive on my 3.0GHz E8400 Core 2 Duo desktop takes a few minutes, my MacBook Pro a few minutes longer still, I’m sure our family 486 with a hex speed drive would take considerably longer!

For what it’s worth, the same procedure can be used on NetBSD and Mac OS X from my own testing. Just switch the virtual device /dev/acd0 with the relevant line for your OS. Isn’t BSD heritage fantastic? :-)

FreeBSD AMD64 is good for you

Now that I’ve redefined the purpose of my primary desktop machine to make it a lean, mean code compiling machine, file server and Bittorrent downloader, it’s graphical performance is much less important. Therefore I’ve wiped Debian off it and reinstalled FreeBSD, but this time instead of settling on the standard x86 version so as to use the proprietary Nvidia graphics drivers, I’ve installed the full blown AMD64 64-bit version!


top

It’s so nice to be back in my familiar FreeBSD environment where everything on the drive is logically and securely organised, where I can use the FreeBSD ports system, where tcsh is the default shell not bash, and where everything works the way I’m used to. Plus running the 64-bit version it can access all of my RAM and generally feels more responsive as a result.


dmesg

For what it’s worth, after dappling in Debian GNU/Linux, I still prefer Slackware with Pkgsrc. FreeBSD and NetBSD are still the best though :-).

Any questions?

Tunneling X11 through SSH on Mac OS X

As I increasingly use and rely upon Unix-like operating systems such as FreeBSD (and GNU/Linux) on desktops, I tend to forget at times that I’m using a sophisticated server installed locally to generate my graphical environments, namely X11. And just as with any server I can call it up from another machine and use its services.

X11.app X11 was built specifically to serve graphical applications over networks, and can still be used in this way by employing SSH on the client, and installing the desired applications on the server. My primary desktop is a DIY running FreeBSD 7.0 (more on my debacle with Debian GNU/Linux in a later post!), and my primary mobile machine is an original generation MacBook Pro.

USELESS ASIDE: Given the fact it’s about time for my half-yearly move back to Adelaide, Australia I’ve been contemplating how best to access my desktop machines here in Singapore using my MacBook Pro which I’ll be taking with me. These are the things that keep my up at night.

To access desktop applications on a remote Unix-like machine on your Mac, fire up your Terminal and use the regular SSH command, but with the -X flag:

% ssh -X [USERNAME]@[HOST MACHINE]
% Password: [PASSWORD]

Provided you have installed X11.app from either your Tiger or Leopard install DVD; or better yet downloaded the latest community build of Xquartz from MacOSForge; you should now be able to enter in the name of a graphical application and have it appear!

Tunneled FreeBSD X11 apps on Mac OS X
Tunneled FreeBSD X11 apps running on Mac OS X through SSH

For example, I entered % xfce4-panel and used that to launch some of my favourite apps, as you can see above. Over my local home gigabit ethernet connection and even at Starbucks on the free Singapore public WiFi networks the applications felt like they were running on my local machine.

You may recognise the Xfce panel from my previous post on Xfce and Openbox. There’s a reason for that; I’m using the panel remotely from the same machine. Ain’t [computer] science wonderful?

Plus then you can do things like run local Mac applications and the remote X11 applications on the same screen:

Tunneled FreeBSD X11 apps on Mac OS X
Xfce’s Thunar file manager compared to Leopard’s Finder

Fun with Xfce part 4: Using Openbox

What started as a mini series on the Xfce Desktop Environment on my university intranet has evolved into an open ended exploration on my public blog, and I’m having lots of fun doing it! Scroll down to the end of this post to view links to the previous posts in the series.

Part of the Xfce desktop environment is Xfwm, the Xfce window manager. Xfwm provides sophisticated and pretty composting effects such as drop shadows and alpha transparency on windows and menus, while still using less memory and power than competing desktop window managers. Despite this, for much slower machines even Xfwm can be overkill.

ASIDE: "Window managers" draw the widgets, title bars, resize handles and other elements onto application windows. "Desktop environments" such as KDE, GNOME and Xfce bundle their own window managers along with software developed specifically for their environments, such as Thunar for Xfce.

Enter Openbox, again! Openbox is an extensible, standards compliant, very minimalistic window manager that can be used by itself or in place of a desktop environment’s default window manager to further reduce memory and processor resources. The separate obconf utility provides a nice graphical control panel you can use to switch themes and adjust settings.

The Obconf window and Xfce Settings menu entry
Openbox running in Xfce with the bundled "Mikachu" theme

Most reputable package managers carry both Openbox and obconf, check your distribution’s repositories. To install them on my favourite BSD flavours for example:

FreeBSD ports system or package
# cd /usr/ports/x11-wm/openbox && make install clean
# cd /usr/ports/x11-wm/obconf && make install clean
or:
# pkg_add -rv openbox
# pkg_add -rv obconf

NetBSD pkgsrc
# cd /usr/pkgsrc/wm/openbox && make install clean clean-depends
# cd /usr/pkgsrc/wm/obconf && make install clean clean-depends

Now we want to kill the active Xfwm process in Xfce and open our glorious Openbox replacement. Fire up your Terminal and enter:

% killall xfwm4 ; openbox & exit

It really is smaller in every sense of the word isn’t it? To make sure Openbox is used by default whenever you start Xfce, quit Xfce and check "Save sessions for future login".

The Obconf window and Xfce Settings menu entry
Don’t worry, CC looks pretty confused herself!

You’ll also notice that the "Openbox Configuration Manager" has added itself to the Xfce Settings menu! Click on it and have fun with all the different themes, button positions, font sizes and arrangement settings.

Related posts

RichardDawkins.net