- install smbfs
$sudo apt-get install smbfs
- use ‘mount’ to mount the file share
- for mount you need to create a local folder that will be the mount point for example create a folder test under /media
- then mount the share using
$sudo mount -t smbfs -o username=myusername //192.168.0.10/sharename /media/test
- myusername – is a valid username on the windows machine
- the ip address is the ip of the windows machine
- sharename is the name given to the share on the windows machine
- This will prompt you for the passwor d- the password for myusername on the windows machine
- on successful password you will be able to see the contents of the sharedfolder under /media/test
- Note: if you this is the first time you are using sudo in this shell session or if sudo has timed out there will be two password prompts first for the sudo next for the share mount. you could avoid this by doing
$sudo -v
before doing the sudo mount
- to umount
$sudo umount /media/test
Friday, 22 October 2010
access windows shared from ubuntu/linux
Monday, 18 October 2010
creating a xen windows vm
Create the image of the windows server installation cd using:
#dd if=/dev/cdrom of=/tmp/windowssrv2k3.iso
0. In your workstation terminal type:
#xhost
#ssh -X user@systemname
1. first create a partition for the disk using lvm command:
#lvcreate --size 50G --name winshared01_root XenVolGroup01
2. Create a configuration directory /xen/winshared01
3. virt-install --prompt
4. edit the configuration file by changing "boot" from 'c' to 'd'. Also change "sdl" value from 0 to 1 and also "vnc" value from 1 to 0 and adding cdrom as to point to windows image
5. then start the domU using
#xm create winshared01
6. Follow the instructions in windows installation screen
To delete volume group:
lvremove -f /dev/XenVolGroup01/winshared01_root
#dd if=/dev/cdrom of=/tmp/windowssrv2k3.iso
0. In your workstation terminal type:
#xhost
#ssh -X user@systemname
1. first create a partition for the disk using lvm command:
#lvcreate --size 50G --name winshared01_root XenVolGroup01
2. Create a configuration directory /xen/winshared01
3. virt-install --prompt
4. edit the configuration file by changing "boot" from 'c' to 'd'. Also change "sdl" value from 0 to 1 and also "vnc" value from 1 to 0 and adding cdrom as to point to windows image
5. then start the domU using
#xm create winshared01
6. Follow the instructions in windows installation screen
To delete volume group:
lvremove -f /dev/XenVolGroup01/winshared01_root
Monday, 11 October 2010
How to increase size of an LVM inside a xen VM.
First increase the lv in the xen host
Log into the VM and use 'parted to create a new disk - This part is only for the new Redhat 5.x servers.
Next - This part is only for the new Redhat 5.x servers.
Next
When you run 'resize2fs' is may come up with a message 'Please run 'e2fsck -f /dev/VolGroup00/dev2_root' first.' then please run the command as requested then rerun the resize2fs command.
Expanding DomU Logical Volumes
Get the Logical Volume name and path:
So you gave your Xen virtual machine a 10GB Logical Volume and not it's not enough eh? This is easy to fix.
According to lvdisplay the path to our Logical Volume is /dev/vgsys/lvvirt.
Hot Resizing Logical Volume:
Resizing the Logical Volume is actually very easy, you'll be amazed.
Hot Resizing the filesystem:
lvextend -L +5G /dev/VolGroup/fred
parted (parted) mkpart primary 5363 10.7GB (parted) quit
lvm> lvmdiskscan / dev/ramdisk [ 16.00 MB] /dev/root [ 2.50 GB] /dev/ram [ 16.00 MB] /dev/hda1 [ 101.94 MB] /dev/VolGroup00/LogVol01 [ 2.38 GB] /dev/ram2 [ 16.00 MB] /dev/hda2 [ 4.89 GB] LVM physical volume /dev/ram3 [ 16.00 MB] /dev/hda3 [ 5.00 GB] lvm> pvcreate /dev/hda3 Physical volume "/dev/hda3" successfully created lvm> vgextend VolGroup00 /dev/hda3 Volume group "VolGroup00" successfully extended lvm> lvextend -L +5G /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 7.50 GB Logical volume LogVol00 successfully resized lvm> exit
[root@rednfs01 ~]# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39
(29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /;
on-line resizing required Performing an on-line resize of
/dev/VolGroup00/LogVol00 to 1966080 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 1966080 blocks long.
Expanding DomU Logical Volumes
Get the Logical Volume name and path:
So you gave your Xen virtual machine a 10GB Logical Volume and not it's not enough eh? This is easy to fix.
We start by using the lvdisplay command to get the path to the Logical Volume
[ root@vs /srv/xen ] lvdisplay
--- Logical volume ---
LV Name /dev/vgsys/lvvirt
VG Name vgsys
LV UUID XMWzWW-oZih-A5uH-91Sa-7l1y-8cqf-18KcNB
LV Write Access read/write
LV Status available
# open 1
LV Size 60.00 GB
Current LE 1920
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Name /dev/vgsys/lvvirt
VG Name vgsys
LV UUID XMWzWW-oZih-A5uH-91Sa-7l1y-8cqf-18KcNB
LV Write Access read/write
LV Status available
# open 1
LV Size 60.00 GB
Current LE 1920
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
According to lvdisplay the path to our Logical Volume is /dev/vgsys/lvvirt.
Hot Resizing Logical Volume:
Resizing the Logical Volume is actually very easy, you'll be amazed.
lvresize --size +10G /dev/vgsys/lvvirt
This lvresize command specifies to add 10GB to /dev/vgsys/lvvirt. This will only take a second.Hot Resizing the filesystem:
resize2fs /dev/mapper/vgsys-lvvirt
That's really it! You can only hot resize if the Filesystem is getting larger. If you need to shrink it then you'll have to take the Volume offline first. Isn't this easier than dealing with partitions that are too small?Friday, 8 October 2010
Installing Windows on Xen
This article will address installing Windows 2003 server on Xen 3.x running on headless Centos server
The dom0 xen server is headless making it much difficult to transfer the graphical interface.
I thought installing windows was quite easy on xen by following various articles on the internet but it needed some troubleshooting and investigation to clearly install windows on xen as most of the articles show that the vnc or graphical display will automatically pop out. But the reality is that it is quite a task to figure out which options to configure for the display to come out and how to configure the configuration file properly as I struggled without proper errors in case the machine fails to boot as the disk in not bootable error. In that case we need to configure the options 'boot=d' instead of 'boot=c' and also change the cdrom option to the iso file properly in the domU config file. Then also have to do
1) xhost
2) ssh -X
3) virt-install --prompt
and follow the instructions
4) xm destroy
5) edit the configuration file according to the example given below
6) see that sdl = 1 and vnc = 0 is configured in case we need host access directly instead of vnc
7) xm create
At this point if everything is good the graphical installation should pop out on to the workstation. if not check /var/log/xen/qemu*, /var/log/xen/xend.log
Still I can't get VNC to work with the current setup will work on it afterwards if I have time but mainly I've managed to install the windows on xen using sdl.
The dom0 xen server is headless making it much difficult to transfer the graphical interface.
I thought installing windows was quite easy on xen by following various articles on the internet but it needed some troubleshooting and investigation to clearly install windows on xen as most of the articles show that the vnc or graphical display will automatically pop out. But the reality is that it is quite a task to figure out which options to configure for the display to come out and how to configure the configuration file properly as I struggled without proper errors in case the machine fails to boot as the disk in not bootable error. In that case we need to configure the options 'boot=d' instead of 'boot=c' and also change the cdrom option to the iso file properly in the domU config file. Then also have to do
1) xhost
2) ssh -X
3) virt-install --prompt
and follow the instructions
4) xm destroy
5) edit the configuration file according to the example given below
6) see that sdl = 1 and vnc = 0 is configured in case we need host access directly instead of vnc
7) xm create
At this point if everything is good the graphical installation should pop out on to the workstation. if not check /var/log/xen/qemu*, /var/log/xen/xend.log
Still I can't get VNC to work with the current setup will work on it afterwards if I have time but mainly I've managed to install the windows on xen using sdl.
Preparation Windows image
To create windows installation image is optional, and just describes a way that I’ve set things up that makes it easier to commission more than one VM. You can also use /dev/cdrom instead with the help of virt-manager.
Create a folder for the ISO image. the folder could be named like this /tmp/windows, we’ll use this directory to store a windows dump image from CDROM.
Put your windows installation disc in the CDROM drive.When it’s mounted, issue a command as follows:
dd if=/dev/cdrom of=/tmp/windows/windows-xp.iso
dd if=/dev/cdrom of=/tmp/windows/windows-xp.iso
If the CDROM cannot mounted automatically, you might need to mount it yourself. It would take a long time to dump a full windows images depending on the disc’s size.
Create DISK file for Virtual Server
After that, we need to create a disk image file for the virtualized WinXP. Here we store this file in a new sub directory /srv/xen. You might need to create this directory yourself if you are using CentOS. The hard drive of the virtual machine can be created like this:
nice dd if=/dev/zero of=/srv/xen/winxp.img bs=1024k seek=4096 count=0
Dont forget that raw disk is also supported by Xen
If we want to use logical volumes we can create a logical volume as follows:
lvcreate --size 30G --name windowstest_root XenVolGroup01
nstall Windows in Xen Containervirt-install -n winxp -r 256 -f /srv/xen/winxp.img -b xenbr0 --sdl -v -c /tmp/windows/windows-xp.iso
or we can use the following for interactive install:
virt-install --prompt
This command will create a configuration file /etc/xen/winxp, start the new virtual machine, and try to connect to it. Here’s a bit problematic. As you may wonder how we gain the access to windows graphic desktop during the installation.Generally there are two ways:
1, Using the physic server’s graphic instead. When you have grphic access to physic server, you can use virt-manager’s grphic interface to control the process.
2, You can use VNC client to connect virtual windows XP directly. By default when the installation started, there’s a VNC server running at localhost. It’s configurable in /etc/xen/winxp, you can set which socket it should bind to, and what password can be used to connect this running windows.Some other adjustings to /etc/xen/winxp are highly recommended. We need to make note that when any error happened, the winxp should be shut down soon not hanging or doing some other crappy things that only god knows.* ‘on_crash‘ should be changed to ‘destroy‘.
* Change the line on_reboot = ‘restart’ to on_reboot = ‘destroy’. This will ensure that Windows doesn’t restart during setup without our permission, which will be required for ACPI support in the guest to be set up properly.
* Add file:/var/lib/xen/images/winxp-install.iso,hdb:cdrom,r’, to the list in the line disk = [ ... ]
* Add new line boot = ‘d’ (preferably after the line disk = [ ... ].).
name = "winxp" uuid = "821cc805-ecc3-cc1a-20de-79d4bc99c134" maxmem = 256 memory = 256 vcpus = 1 builder = "hvm" kernel = "/usr/lib/xen/boot/hvmloader" boot = "d" pae = 1 acpi = 1 apic = 1 localtime = 0 on_poweroff = "destroy" on_reboot = "destroy" on_crash = "restart" device_model = "/usr/lib64/xen/bin/qemu-dm" sdl = 0 vnc = 1 vncunused = 1 vnclisten = "127.0.0.1" vncpasswd = "virtual-chen" keymap = "en-us" disk = [ "file:/srv/xen/winxp.img,hda,w", "file:/tmp/windows/windows-xp.iso,hdc:cdrom,r" ] vif = [ "mac=00:13:34:ae:70:3b,bridge=xenbr0" ] serial = "pty"
Then re-launch the virtual machine with “xm create winxp“,and use VNC to connect the virtual OS, and direct the installation process. When finished, setup tries to reboot, it will instead be shut down. Don’t panic, this is intentional and was created by the line on_reboot = ‘destroy’ that we modified in the config file.Things to do when installation finishedNow we need to recover the settings that we’ve made to /etc/xen/winxp:* Change the line boot = ‘d’ to boot = ‘c’* Change the line on_reboot = ‘destroy’ to on_reboot = ‘restart’Continue the setup process by restarting the virtual machine with “xm create winxp“. Run through the rest of the normal Windows setup process, for example add the machine to the domain.Install TightVNC in the guest so that you can access the guest remotely, so that the virtual machine is accessble while we are not logged into the physical machine. Boot the virtual machine with xm create winxp. If successful, the virtual machine will not show a display, but will show up in the results of xm list and you can connect to it with vncviewer,TightVNC, etc.Trouble shootingIf something goes wrong and you can’t connect via VNC or rdesktop, you can use virt-manager (aka Applications → System Tools → Virtual Machine Manager) to connect directly to the virtual machine’s console and see what it’s doing. Please keep note that using virt-manager depends on graphic destop at the physical server, which always eats lots of system resourncesFollowing is the forum entry which helped me figure out my error:Upon further investigation the 'exception looking up...' is a harmless warning.I changed the configuration file toon_poweroff = 'preserve'
on_reboot = 'preserve'
on_crash = 'preserve'This then allowed me to connect with VNC since the domain is not destroyed on a failed boot or crash. This showed the error messageCDROM boot failure : 0002I then reverted to the original cdrom access syntaxdisk = [ 'file:/etc/xen/win2000.img,ioemu:hda,w', ',hdc:cdrom,r' ]This then shows the following console outputata0 master : QEMU ...
ata0 slave : Unknown device
ata1 master: QEMU CD-ROM ...
ata0 slave: Unknown deviceCDROM boot failure code : 0003
Boot from CD-Rom failed
FATAL: Could not read the boot diskI know the boot disk is readable, and a bootable Windows 2000 CD. >>>> Anyone any ideas?I then created a copy of the CD ROM as a disk file, and changed the disk line to readdisk = [ 'file:/etc/xen/win2000.img,ioemu:hda,w', 'file:/etc/xen/win2000.iso,hdc:cdrom,r' ]And wow! windows boots. Now to get a clean Windows install working fully.PS. pardon the poor file locations - this is a scratch install until I get everything working.Also appologize for taking so long on this, it has taken a bit of infrastructure to be able to set up for testing. As a result, responses shoudl come more quickly now.
As I understand it now, your remaining problem is using the CDROM itself vs an iso image file? For this you would need to specify the disk line as:disk = [ 'file:/etc/xen/win2000.img,ioemu:hda,w', 'phy:/dev/hdc,ioemu:hdc:cdrom,r' ]Assuming your CDROM drive is /dev/hdc. If it is not you can replace the /dev/hdc piece with the physical location of your cdrom drive on the dom0YEAH !
Now I can get the console.
VNC has a really slow rendering.
But "ssh -X" looks nice.References:https://issues.rpath.com/browse/RPL-749
http://planet.admon.org/howto/install-windows-xp-in-xen-centos/
http://osdir.com/ml/os.netbsd.ports.xen/2007-10/msg00041.html
Subscribe to:
Posts (Atom)