Dual Boot, Dual MAC

My desktop machine runs a Linux/Windows dual boot. It runs Linux 90% of the time, with Windows only used for playing games.

Rather than have to remember which operating system is running at the time, I decided to forcibly make Windows use a different MAC address. This means that I can now assign each machine a different hostname in DNS. Checking which operating system is running is now as simple as pinging the hostname corresponding to the operating system.

You can change this is both Linux and Windows, but I decided to keep my main operating system using the machine's original MAC address. Changing this in Windows involves editing a value in Device Manager:

Monitor Sleep on Screen Lock

I lock my screen when I know I'm popping away from the computer for a few minutes. It therefore makes sense to place the screen(s) in sleep mode while I'm away.

On Linux, I use this handy script from a fellow called Marco. I've packaged it up for Debian and Ubuntu users to make it easier to install, and can be downloaded from here.

On Windows, I use this little program from a fellow called Kevin.

Create a keyboard shortcut to each and use that as your new lock screen shortcut. It makes a big difference if you use dual monitors like me. :-)

NTFS Junction Points

When I moved my boot drive over to a 64GB SSD, I knew I was going to have to keep most of the larger files on my mechanical drive, but I didn't really want to have some applications running from C:\Program Files and others running from E:\Program Files. I wanted to keep my new SSD setup as close to my previous mechanical primary drive setup.

My initial reaction was to try to mount the mechanical drive as a folder within the SSD drive, but this was rather limited. It may as well have just been a different partition rather than a partition inside another partition.

The solution was to use NTFS Junction Points. They are essentially the same as symlinks in the Unix world. These are essentially shortcuts from one folder to another, but applications cannot tell the difference and treat them as the same. This means I can move my Downloads folder to my mechanical drive, create a Junction Point from C:\Users\username\Downloads to E:\Downloads.

Clicking into C:\Users\username\Downloads shows the contents of the E:\Downloads folder, and no changes are required in any applications.

To create a Junction Point, first move the folder location using the Location tab in folder Properties (only required if the folder is a special folder such as My Music, My Downloads etc.), delete the original folder, and then create the junction point using the mklink command from the command prompt. Your command prompt will require administrator privileges to do this.

C:\Windows\system32>mklink /J C:\Users\username\Music G:\Music

Cygwin Ping

If you use Cygwin, you may notice that when you try to use the ping command, you get an error.

This is because typing ping in a Cygwin terminal window executes the *nix version of ping rather than the Windows ping. The *nix ping requires low level socket access that is only available when running as an Administrator. Because there is no sudo command in Cygwin, the only way to acquire administrator privileges is to quit your current terminal window and restart it with the privileges. This is rather cumbersome if you simply want to check whether a server is running.

The solution is to create an alias to the Windows ping in your .bash_profile file. That means any time you run the ping command, you are now running the windows version which requires no admin rights.

Add the following line to the .bash_profile file (create it if necessary) in your home directory.
alias ping='$SYSTEMROOT/system32/ping'

Before:

user@host ~
$ ping google.com
ping: socket: Operation not permitted

After:

user@host ~
$ pingw google.com

Pinging google.com [173.194.36.104] with 32 bytes of data:
Reply from 173.194.36.104: bytes=32 time=24ms TTL=56
Reply from 173.194.36.104: bytes=32 time=23ms TTL=56
Reply from 173.194.36.104: bytes=32 time=23ms TTL=56
Reply from 173.194.36.104: bytes=32 time=23ms TTL=56

Ping statistics for 173.194.36.104:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 23ms, Maximum = 24ms, Average = 23ms

If you require the *nix native version of ping at any time, you can simply run /bin/ping google.com with admin rights.