CONTEXT

Oct/2010: By good fortune, I am now the happy owner of an HP Mini 5103 netbook. This is a nice step up from my previous netbook (an original Asus EEEPC Surf 2G, with a ~800mhz celeron-Mobile CPU) - far more usable keyboard size, bigger screen, astonishing battery life, and better whomph in the CPU capability (hyperthreaded Intel Atom CPU, 'current variety' so pretty decent performance for a non-dual-core atom).

By default, the HP Mini 5103 is configured to boot up to Windows 7 Professional. Of course, it was important for me to install Linux - and with my recent success with Ubuntu 10.04 on my primary workstation (Laptop) - this was the first thing to try.

Oddly enough, HP has the hard drive in the mini sliced up in a way that makes it 'not immediately trivial' to just 'add in' Ubuntu. There are 4 primary partitions on the 250gig HDD by factory default; so no room to add an extended / or other partitions into which Linux can reside. I was reluctant to entirely throw away Windows, since 'sometimes' it is a handy thing to have around. Additionally, being a modern netbook, it comes with NO recovery media of any kind; nor the option of generating recovery media. (Instead, there is a hidden partition on the HDD which you can elect to boot from at startup, if you wish to recovery to stock factory install Windows config).

So, it required a bit of digging, first to determine how the unit was configured and what the slices were doing; and then a bit of effort to reconfigure things.

The basic config of the 4 slices in the factory default config are, more or less:

  1. Boot partition, ~315Mb, NTFS, contains windows 7 boot loader and associated files
  2. Windows 7 OS partition, ~231Gb, NTFS, the actual windows instance
  3. Windows recovery partition, hidden, NTFS, ~16 Gb, contains 'WIM" windows image / HP restore app.
  4. HP _TOOLS partition, Win95-Fat32, ~2 Gb, contains 2 small linux HP custom boot environments: One to support "quicklook" (quick boot mini-OS that displays Outlook data/schedules/contacts) and "QuickWeb" - a mini linux distro which gives you wireless & wired network; a web browser with flash support; and not much else - but it boots quickly.

I wasn't keen to throw away the "QuickWeb" mini-linux environment in particular, so I didn't want to clobber slice 4 outright.

I was concerned that any major changes to Slice 1 or Slice 2 would render Win7 unbootable, which was an endpoint to avoid, all things being equal

I wanted to preserve, if possible, slice 3 since it contained my only official windows install media / recovery option.

So. Steps taken, concisely:

  • Created a bootable "System Rescue CD" 1gig USB memory stick (http://www.sysresccd.org/Main_Page)
  • Booted sysRescCD environment, attached an external SATA HDD connected via generic SATA-to-USB connector (the $25 kind sold at NewEgg, misc Ebay vendors, etc)
  • used 'tar' to make straight tarball backups of content from slices 1,3,4 onto the external SATA drive.
  • used 'sfdisk -d /dev/sda > capture-file' to capture internal disk partition layout info
  • ran 'partimage' from the SysRescueCD and took 'partimage backups' of slices 1,2,3,4 just to be thorough.
  • captured boot block of the HDD as per hints from partimage website, http://www.partimage.org/Partimage-manual_Backup-partition-table
  • note that all this file activity (writes) to external drive via USB - is not fast. So don't do this when you are in a big hurry and have nothing else to do.

Once I had backups created to my satisfaction...

  • ran cfdisk and deleted slice 4
  • ran gparted and resized slice 3 (Windows 7 environment, with bulk of HDD space allocated) so that it is ~40 gigs smaller
  • created a new "extended" partition using the freed up "slice 4" and allocated all free space (~40 gig) to this
  • created new logical partitions within this extended partition, as follows:
    • ~512mb slice for linux boot
    • ~2000mb for linux swap
    • majority of balance (approx 38Gb) for linux root
    • ~750mb for HP_TOOLS partition for QuickWeb/QuickLook mini-environment.
  • Note that HP_Tools partition was given this ID when creating it with Gparted. I think this is important for it to be picked up properly (unless the HP just points to 'last slice on disk?' to get to the QuickWeb/QuickLook environment?

Once this resize and reallocation of slices was completed.. it is possible to proceed to the next phase.

  • Format the last (HP_TOOLS) partition as W95-Fat32 (VFAT) via mkfs.vfat
  • restore the tarball backed up content into this slice
  • reboot system to see how things behave
    • Windows 7 still boots, but first time booting it forces a chkdsk run to check disk integrity, since the HDD has been resized (this is normal behaviour after a Windows resize via Gparted)
    • Once windows booted, powered off
    • Pressed the first "QuickLook" button instead of the main power switch
      • appears to start to launch the quick look environment, but gives an error. Sigh. Good thing I don't plan on using this feature / don't routinely use Outlook as my email-calendar environment.
      • Power off system
    • Press the second "QuickWeb" button instead of the main power switch
      • HP Logo comes up, looks good - indeed - we have a working "Mini Web environment" available. Nice. This appears to work normally. Power off
  • Finally, boot the system from Ubuntu 10.04 install media (for some reason, this HP mini refuses to boot with my bootable USB key that I've used on numerous Ubuntu Netbook installs - odd) - but it was able to boot fine from an external DVDRom drive attached via USB_to_IDE converter
    • Proceed with a normal Ubuntu install - manually allocate the boot, root, swap slices - since layout is slightly atypical here, the auto installer isn't quite certain how to proceed.
    • Install chugs along smoothly, done in ~10 minutes as usual.
    • Reboot, pouf, Ubuntu is very happy. First boot, need to have wire network connection (not wireless) to run updates and install Broadcom hardware driver support. After reboot, wireless networking works.
    • Note that all hardware seems to be detected and work well - video; network; wireless; webcam, sound, mic; it even has "mute main speakers when headphone plugged in" working out-of-box with no tweaks, which is nice.
    • Funny Caveat: I had previously setup a 4gb SD Flash memory card in Win7 for use as a "ready boost" device. I popped this back in at this point. The next time I power down and reboot Ubuntu - it fails to boot - giving me errors that it can't mount my boot partition. Weird. Power off, remove the SD memory, power on - Ubuntu boots perfectly, no questions asked.
    • Had a look in /etc/fstab and I can't see there is any way that the SDB flash card would interfere with SDA disk slice allocations -- but anyhow, I really don't feel like debugging this; and don't really need the 4gb readycache boost for Win7 (won't be using windows much as the primary OS for this machine is now UbuntuLinux). Ah well.

I've been using this machine for a few days now and it works really smoothly. Suspend when lid is closed; battery life is great (easily above 6 hours - maybe 8+ depending on what you are doing, I haven't had enough days of testing yet). The keyboard is really easy to use, the spacing is almost 'normal'.

Funny enough, my 14" screen laptop now feels positively 'huge' after working on the netbook. So I suspect I will still use my 'big' laptop as my primary workstation, and use the netbook as my 'onsite project, meeting, or travel' machine. Certainly the battery life on the netbook is way better than the laptop, and the size / weight is excellent on the netbook.

So. This is all written up here, in this kind of brief-ish format, with a fair bit of technical detail, in case it is of any use or interest to others with similar model HP netbooks / who are in a bind for setting up dual-boot Linux/Windows environments and would prefer to not simply throw away the content of the factory install HDD.


Misc Tech Ref Capture Info:

SFDISK Slice Layout - Before and after

BEFORE
------
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=   614400, Id= 7, bootable
/dev/sdb2 : start=   616448, size=452124672, Id= 7
/dev/sdb3 : start=452741120, size= 31457280, Id= 7
/dev/sdb4 : start=484198400, size=  4184064, Id= c

# note that sda was boot device, USB key, in this instance.


AFTER
-----
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=     2048, size=   614400, Id= 7, bootable
/dev/sda2 : start=   616448, size=368637577, Id= 7
/dev/sda3 : start=452741120, size= 31457280, Id= 7

EXTENDED PARTITION:
/dev/sda4 : start=369254086, size= 83473679, Id= 5

LOGICAL PARTITIONS WITHIN THE EXTENDED:
/dev/sda5 : start=369254088, size=   514017, Id=83
/dev/sda6 : start=451185588, size=  1542177, Id= b
/dev/sda7 : start=369768448, size=  3905536, Id=82
/dev/sda8 : start=373676032, size= 77508608, Id=83


FDISK CAPTURE - AFTER:
----------------------
root@tim-hp-mini:/copy# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x34606539

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              39       22985   184318788+   7  HPFS/NTFS
/dev/sda3           28182       30140    15728640    7  HPFS/NTFS
/dev/sda4           22986       28181    41736839+   5  Extended
/dev/sda5           22986       23017      257008+  83  Linux
/dev/sda6           28086       28181      771088+   b  W95 FAT32
/dev/sda7           23018       23261     1952768   82  Linux swap / Solaris
/dev/sda8           23261       28085    38754304   83  Linux

note that things are even more confused here than I realized - sda8 is not the last cyl block allocated slice on the disk; because of how I actually created sda6 for the HP_TOOLS slice. Great fun.  But it still works, amazingly enough.  This suggests .. whatever is called on HP_MINI when you press the "quickWeb" power-button -- must be seeking out the slice labelled "HP_TOOLS" and booting from that device.


FOOTNOTE:

Why? WHY? You can just use WUBI to install Ubuntu 'inside' Windows. Well, yes, that is true. However, it is 'nicer' in theory to not have your linux install depend on filesystem integrity of windows? Plus purists might suggest performance is better? And additionally, amusing: When I first did a wubi install, it was fine, but it also was 'poisoned' and failed to boot due to presence of the SDB SD-memory 4gig "smart cache" card - and initially I didn't recognize the pattern / or the cause for the failure of Ubuntu to boot up. So at that point I proceeded with the 'proper' install of Ubuntu - which amazingly enough worked pretty well.

So. Lots of fun.