VirtualBox

Virtualbox is a way to run another operating system within an already running operating system. Originally written by Sun Microsystems, and now owned by Oracle when they bought Sun in 2010, it is one of a dozen Virtual Machine software offerings.

One way I use it is to run Windows and Linux on the same PC at the same time with near-native speed. I call it ‘simultaneous boot’. Here is how I did it.

Start with a multi-core GB memory machine. I suggest at least 4 64-bit cores that support VM in the BIOS (i5-Intel) and 8 GB of RAM. Be sure you have a large disk, such as Seagate’s 1TB $59.00 Barracuda special. You will NEED 64-bit processor and motherboard support for more than 3GB of memory.

Partition and install Windows (XP, 7, etc…) 64-bit on a hard drive first. Windows assumes it owns everything so it is best to let it think that way.

Next partition and install Linux (Ubuntu, Fedora, etc…) 64-bit on the same drive, being careful to skip the existing windows partitions. It will install a boot loader (GRUB, etc…) that allows you to select which operating system you want to run.

http://pagead2.googlesyndication.com/pagead/show_ads.js

Test it out and boot several times between Windows and Linux.

Enable the VM extensions on the motherboard’s BIOS. This will allow one VM to have exclusive rights to whatever number of CPUs you have assigned it.

Download VirtualBox 64-bit from Oracle’s web site, as it has the VRDP, and USB extensions, but mostly because it can handle raw virtual disks. This is where the magic comes in. Normal VMs create files under the host operating system that the guest thinks are real disk drive partitions. In raw VM disks the filesystem for the guest are native to the guest, thereby making it as fast as greased lighting.

If your first drive on the machine is what you want, use ‘PhysicalDrive0’. For me, it’s the second one, so I use ‘PhysicalDrive1’. Be sure to Right Click cmd.exe in the Windows menu and select ‘Run as Administrator’ to enable access to raw disk.

Here is the disk we want to use, Partitions:
1 = Windows 7 ‘System Space’ (type 07)
2 = Windows ‘C:’ (type 07)
5 = Ubuntu ‘swap’ (type 82)
6 = Ubuntu ‘/’ filesystem (type 83
–> they show up as SATA drive 1 <–

cd C:Program FilesOracleVirtualBox
VBoxManage.exe internalcommands listpartitions -rawdisk \.PhysicalDrive1
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /32 /33  12  /223/19           100         2048
2       0x07  12  /223/20  1023/254/63        499899       206848
5       0x82  1023/254/63  1023/254/63          7720   1024002048
6       0x83  1023/254/63  1023/254/63        446147   1039814656



We need to register the Ubuntu partitions with VB using ‘internalcommands createrawvmdk…’. I want partitions 5 and 6 from the list above.

VBoxManage.exe internalcommands createrawvmdk -filename D:VirtualBoxubuntu.vmdk -rawdisk \.PhysicalDrive1 -partitions 5,6 



Now create a new VM in VirtualBox, and choose the existing disk you created above (D:VirtualBoxubuntu.vmdk). Also choose ‘Use Host Disk Cache’ for the SATA controller, and PXII System extensions. Allocate two (half) the CPUs you have, and half (4GB) of memory.

When you boot Ubuntu in VirtualBox it will display the Grub menu:
===> Choose the Linux partition ONLY!!! booting back into a running Windows system will corrupt the disk!!! <====

When I booted into Linux from VirtualBox the window manager did not start, leaving me looking at a black screen with the Login: prompt. To fix this I booted the machine into Linux and removed the proprietary Nvidia video driver, restarted the machine again and selected a lower screen resolution from the default video driver. Now boot back to Windows, run VirtualBox and select Linux from the GRUB menu. The GUI window manager video worked for me!

Now is a good time to install the VirtualBox Host Add-ons from the Device menu. This gets you better video, mouse, USB and file sharing.

References:
http://chaits.accosted.net/?p=54
http://www.neowin.net/forum/topic/784138-howto-boot-existing-ubuntu-partition-using-virtualbox-inside-windows/
http://www.virtualbox.org/manual/ch09.html#rawdisk


Remote Desktop Windows Protocol



To access the box remotely set the VM Display tab ‘Remote Access’ check box on, and change the port to something other than 3389, such as 5000. Leave the Authentication to NULL and time out 5000. Make sure the 3D and 2D video acceleration are turned off.

Start the VM, but leave it at the Login window. Start a Windows Remote Desktop program (RDP, not VNC) and enter the IP address of the Host PC, NOT the VM’s IP, with the trailing port number. For example:
1.2.3.4:5000

If all goes well you will see some warning about non-authentication connection, then click OK and your Linux Login GUI should display. You are in! One funny aspect of this is that using RDP on the local machine has a better display than VirtualBox, due to lowered screen resolution and it has better control over the full-screen view. I need to experiment more with the display settings.

References:
Mac OS X
Windows XP
Windows 7
Linux


Remote Desktop VNC Protocol



To set up VNC to Ubuntu running under Windows 7 Virtualbox you can use the NAT Advanced port forwarding settings and Ubuntu’s tightvncserver (sudo apt-get install tightvncserver). On Windows you can get a VNC client from TightVNC.

  1. Under Virtualbox setting for Ubuntu, select Network
  2. Change NAT adapter (the default) port forward:
  3. host port: 5902 – guest port: 5902

  4. Start Ubuntu, run:
    tightvncserver :2
  5. Test- Windows 7-> Connect to ‘localhost:2’
  6. Test- Other host -> Connect to ‘<ip address of Windows 7 PC>:2’


  7. References:
    Mac OS X
    Windows and Linux


    The speed of Windows and VM-Ubuntu are exceptionally fast, as if they are both running natively. I have half the CPU and memory allocated to the VM. The other nice advantage is if VirtualBox quits working, I can still dual-boot into both operating systems.

    You can also export your entire VM setup and data, then import it somewhere else. Oracle has several examples of that here where you can try out some of their complicated-to-set-up tools without all the muss-and-fuss. I’m not sure how it would export the raw disks.

    Hope this helps.

Music Server

Sockso is a Java based web server to play your mp3 music collection from a central computer to any computer. Based on open source, it is extremely easy to set up and run. You simply point it to a filesystem directory, let it scan, and when finished point your browser to http://localhost:4444.

A few things about security you should be aware of, lest the DCMA police disconnect your ISP and send you downtown. Secure your music site with passwords, and require pre-registration.

When you unzip the install, go to the bin directory and start it up:
If you are on windows -> windows.bat
If you are on linux -> linux.sh

A nice GUI will appear with tabs across the top.

Go to the Users tab, and click the check-boxes: Require login, and Disable registering. Then press the button: Create User, and make yourself an account. This will require you to pre-create an account for anyone wanting to play your music collection.

Now go to Collection and press the Add Folder button. Navigate to your collection of mp3s. When you have all your folders, press the Scan Now button and let it rip for a while.

An hsql database will be created in your home folder; ~/.sockso

-rw-r--r-- 1 me me 2572141 2011-05-01 09:48 database.script
-rw-r--r-- 1 me me     419 2011-05-01 09:48 database.properties
-rw-r--r-- 1 me me   13468 2011-05-01 10:08 database.log
-rw-r--r-- 1 me me      16 2011-05-01 10:15 database.lck

This is a memory-only database that is saved in ascii file database.script. This is important because you want to back your mp3 database up if you create playlists and users, otherwise they will be lost.

Another important item with sockso is how it gets the music mp3 file details from ID tags embedded in the .mp3 file itself. If you buy songs through Amazon they come pre-loaded with all the info you need, but if you copy your CDs, they may not. You can download an mp3 editor and add ID-tags yourself. A good open source and cross platform one is EasyTAG.

Apache sites can host Sockso in a virtual host, like this:

<VirtualHost *:80>
        ServerAdmin webmaster@example.com
        DocumentRoot /data/domains/example.com/www/public/
        ProxyRequests Off
        ProxyPass / http://www.example.com:4444/
        ProxyPassReverse /  http://www.example.com:4444/

        ServerName music.example.com
        ServerAlias music.example.com

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Which allows a URL such as => http://music.example.com
Just be aware that you need to keep the sockso GUI running to server the web pages and songs.

Songs can be played in several formats, such as flash, javascript, external winAmp pls playlists, etc…

In summary, it is nice to have access to your music wherever you go and to be able to share it with close friends. Organizing playlists can be a fun way to discover your lost songs, if you have 1000s of files, and also having your friends start their own music server.

Pleasant sounds….