Monday, August 17, 2015

Dual-booting (Win/Linux) with a USB Drive


This article covers the topic of dual-booting a primarily Windows box to Linux.  Nothing particularly cosmic about this, but there are some gaps in the google knowledge base out there on this.  I boil this down to the essentials with a working model.


So, the scenario is you have a box with Windows hard drive but you'd like to be able to boot to a Linux distro on occasion without disrupting the universe (and that Win hard drive).  

For the second hard drive - I went with this jewel: SanDisk USB 3.0 128GB.  It's quite healthy on both speed and capacity.  

For the Linux distro - I like Ubuntu for desktop use.  Doing an install of it to that USB drive is trivial; just build yourself another drive (USB, whatever) with the install image and set your USB drive as the target for the install.

Now to the tricky part - time.  The Ubuntu install will reset your BIOS clock to UTC time.  That's normally considered a good thing.  You typically want your hardware clock on UTC, not local time.  Unfortunately, Microsoft operates in a different universe when it comes to this topic of time.  Windows expects the BIOS/hardware clock to be in local time.  So, if you do nothing - next time you boot to Windows, you'll see UTC time reflected in Windows - not your local time.  That's an annoyance and a real issue if you have apps that are dependent on an accurate time setting.

The options to correct this are either set the hardware clock to local time and configure Linux to deal with it or leave the clock on UTC and configure Windows to handle that.

The second option (configure Windows for UTC) is a beating that involves registry manipulations.  Configuring Linux to handle local time on the hardware clock is way easier.

Step 1:  Reset the hardware/BIOS clock back to local time.  If you have access to the BIOS, that's simple.  If your BIOS is locked down, it's still simple.  The Linux shell command below will do it:
$ sudo hwclock -w --localtime

The hwclock command provides direct access to the BIOS clock.  The command above sets the BIOS clock to the current Linux local system time.  Assuming you're using NTP, your BIOS clock will be set to a very accurate time.

Step 2:  Configure the Linux O/S to expect localtime from the BIOS clock (instead of UTC).  To do this, simply make the edit below to the /etc/default/rcS file.
# assume that the BIOS clock is set to UTC time (recommended)

That variable is set to 'yes' by default.  Just change it to 'no'.

No comments:

Post a Comment