Thursday, March 3, 2011

Howto: Clone and increase HD of virtualbox VDI files

Step 1:
-------

Open VirtualBox Go to File->Virtual Media Manager
Should list the VDI lets say its "HDA.vdi", right click on this and press "release" accept it.

Step 2:
-------

Go to the folder where HDA.vdi exists, in my case its H:\VM\HDA.vdi

H:\VM> "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonevdi HDA.vdi backup.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: b3e241ab-d783-42f7-893e-52fc9bf43c3e

Step 3:
-------

Increase the HD size.

H:\VM> "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd ubuntu.vdi --resize 50000 <--- this is 50GB
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Howto: Swap memory increase with swap file

-----------------------------------------------------------------------------------
swap partition vs swap file
* Linux Optimization
I have been trying to find the performance differences between a swap partition and a swap file in Linux.

I have found several affirmations that swap partitions are better, but lots also say they are the same (at least for kernels 2.6).

I can find some differences that can help you make the good choice, or when to use swap on file or partition.

Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot).

Swap partition are better in case of full disk where the swap file could be created fragmented.

On the other hand swap files are good if you need to change the size of the swap memory regularly as it is easier to resize the swap file that the whole partition, you may say you can have two swap partitions and enable or disable as you need, but you will be wasting the space of the disabled swap partition.

The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation.

I may also think that one is a good complement of the other whenever you may need more swap memory, and your system is already installed, in that case you can add swap memory with swap files.

If you have any experiences on this topic please post your comments, and also read this article
------------------------------------------------------------------------------------
How to create a swap file?
sudo dd if=/dev/zero of=/swapfile bs=1024 count=100000
------------------------------------------------------------------------------------
This will create file (swapfile) of size 100 MB (round)
sudo mkswap /swapfile
------------------------------------------------------------------------------------
add this file to your swap pool
sudo swapon /swapfile
------------------------------------------------------------------------------------
This will do the job, now you have 100 more Mbytes of swap memory.
------------------------------------------------------------------------------------

Wednesday, March 2, 2011

HowTo: Using shared folders in virtualbox

This I think is how you mount

Postby Telcontar2k8 » 24. Feb 2008, 00:14
Edit March, 26th 2008: Ok, I've just installed a fresh Ubuntu 8.04 on my Virtualbox 1.5.6 with a Windows Vista Home Premium Host. I followed my own tutorial really step by step, and my shared folder are mounting on start-up.
Be aware that this tutorial is only working for Ubuntu, since other Linux distribution have different ways of loading modules and even dealing with fstab.
Maybe other users could write the files, which needed to be modified within other distributions, below.
I will now add some remarks with red in the text below to point out possible errors.
________________________________________________
Attention: As of March 30th 2008 this HowTo has to be seen as "Maybe working" since some users reported that after following this tutorial the shared folders still didn't work.
If you can figure out where the error is please give me a hint, so I can change this.
________________________________________________
Hey, I recently had a similar problem. I knew the right code lines, but they didn't seem to work. A friend of mine helped me then in finetuning everything. But before I start my how to, some general facts: I used this commands on a Windows Vista Home Premium Host and a Ubuntu 7.10 Guest. Maybe there are some little differences to other guests.
So here is my little how to include a shared folder in fstab:

This tutorial is about, how to mount windows-Folder into a Linux Folder of your current home directory, NOT about mounting a windows partition into a linux folder or mounting a windows partition into a new linux partition (as a new devise) within your guest.

1st step: Include the virtualbox Guest Additions as described in the Virtualbox Manual
2nd step: Shut down the virtual machine
3rd step: Create a Permanent Shared Folder
(In a deactivated machine go to Edit -> Shared Folder) --> make sure they are permanent (tick the checkbox), otherwise the guest won't find them after a reboot.
4th step: Start the virtual machine
5th step: Open a terminal
6th step: Check wether Guest Additions were installed successfully. After you have typed in the command "lsmod | grep vb" you should see the modules vboxvfs and vboxadd approximately like that:
vboxvfs 42048 0
vboxadd 25128 11 vboxvfs

If you don't see those modules you have to check your installation of the guest additions and restart with step 4. --> with Ubuntu 8.04 only Virtualbox 1.5.6 works so far
7th step: Create a folder within your virtual machine to which you want to mount your exchange folder. --> pay attention to the rights of this folder. You need to have read,write and execute rights. See the chmod manpage for further details about granting rights. If given everybody every right just to make sure it works
8th step: Go to the folder /etc
9th step: Use your favorite editor to open the file "modules" of this folder. Be sure you have root rights, otherwise you could maybe not be able to save it. You could for example use the command "sudo gedit modules".
10th step: After the last line you write now vboxvfs and in the next line vboxadd. Then save save and close this file.
11th step: Now open the file fstab which is contained in the same folder. Again open it with root-rights, so you are able to save your changes.
12th step: After the last line you write now:
NameOfTheSharedFolderInVirtualbox NameOfYourMountFolderInLinux vboxsf defaults 0 0
in my file it looks approximately like this:
exchange /home/someuser/someos vboxsf defaults 0 0

Instead of defaults you can use every kind of rights for your mount point as described in the man pages of mount (man mount)-->someuser is my own username, someos is the folder created in step 7, where the windows folder will be into. If this folder is empty in your host it will be empty in your guest, so I recommend to put an empty testfile in the host folder just to see whether the mount was successful

When now starting the virtual machine, the folder should me mounted automatically (it does in mine)


Btw: If you want to mount a shared folder manually, I usually used the command
mount -t vboxsf exchange /home/someuser/someos
till I got this working

HowTo: Install guess additions in virtualbox ubuntu guestOS

Installing guest additions

Here are a few additional packages needed for the Guest Additions.
These packages enables you to create kernel modules. For Debian and Debian based distro's like Ubuntu, you need the following packages:

dkms
build-essential
linux-headers-generic

Step1 :
sudo apt-get update
Step2 :
sudo apt-get install dkms build-essential linux-headers-generic
Step3 :
sudo apt-get install virtualbox-ose-guest-x11

Tuesday, March 1, 2011

VirtualBox piix4_smbus Error

VirtualBox 3.2.10 gives me the following error message when booting Ubuntu 10.10:
piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr

This error is caused by VM having no smbus but Ubuntu always trying to load the module. It doesn’t affect anything but is a bit annoying – to fix: -

1. Check module is being loaded: -

lsmod | grep i2c_piix4

2. If so, blacklist it in /etc/modprobe.d/blacklist.conf, by adding the following to the end of the file :-

blacklist i2c_piix4

3. Update the initramfs

update-initramfs -u -k all

ubuntu volume mutes

Volume mutes on every reboot

Here are the steps to fix this problem

1. Run 'alsamixer' in the Terminal
2. Get the settings where you want them and press Esc to exit
3. Run 'sudo alsactl store 0' in the Terminal
4. Run 'sudo gedit /etc/rc.local' in the Terminal
5. Add "/sbin/alsactl restore" to the end of that file and save it
6. Reboot and test the results!