Tuesday, January 26, 2010
Expanding the root partition on Windows & Ubuntu
Tuesday, January 19, 2010
Fusion 3.0 slow down...fixed!
Tuesday, January 5, 2010
Resizing a RHEL 4 & 5 LVM in a VMWare Guest
So, I have a RHEL 5.3 image running under VMWare Fusion. I needed more space in order to install some more software... easy I thought until I tired it and with the help of several blogs and other posting, I thought I would put my recipe into words. So the challenge is to add and extra 2GB into the root filesystem
Step 1 - Cleanly shutdown your VMWare guest
Suggest that you shutdown cleanly as you can to ensure that all other steps go smoothly.
Step 2 - Remove your Snapshots of the Guest
VMWare Fusion on a Mac forces you to remove any snapshots before you can re-size the disk
Step 3 - Resize the disk
There are some command line tools for doing this, but in the 'Hardware Settings' for the guest you can resize a disk (in VMWare Fusion and above).
Step 4 - Restart your Guest
Restart you guest
Step 5 - Look at your disk space
If you look at the disk psace from your guest, you will see that it show no extra disk space! This is simply because the O/S has not seen the added space yet. Use "df" to take a look at the mounted volumes on your system.
[root@localhost ~]# df -hAs you can see, we have 427M if space left on the root file-system "/".
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
3.8G 3.2G 427M 89% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 233G 173G 61G 74% /mnt/hgfs
Step 6 - Make sure that there is free space
You can next check if the O/S can see the free space. Use the utility "parted" to view the partitions.
[root@localhost ~]# partedStep 7 - Make a new partition out of the free space
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 6440MB 6333MB primary lvm
6440MB 8587MB 2147MB Free Space
(parted) quit
In the step above you can see the free space, which starts at 6440MB and ends at 8587MB. You now need to make a new partition, using "parted" again
[root@localhost ~]# partedWe have a new partition out of the free space... but we have not finished yet!
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext3
Start? 6440
End? 8587
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 107MB 107MB primary ext3 boot
2 107MB 6440MB 6333MB primary lvm
3 6440MB 8587MB 2147MB primary
(parted) quit
Step 8 - Create the Physical Volume from the Partition
Now that we have a partition on the disk we now create a physical volume using the "pvcreate" command.
[root@localhost ~]# pvcreate /dev/sda3The device name (/dev/sda3) came from Step 7, concatenating the device name (/dev/sda) with the partitions number (3) to get /dev/sda3.
Physical volume "/dev/sda3" successfully created
Step 9 - Determine the Volume Group
Now that we have a partition, we need to add it into the Volume Group. First find the name of the volume group using the "vgscan" command.
[root@localhost ~]# vgscanStep 10 - Add the partition into the Volume Group
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2
Now add the partition into the volume group using the "vgextend" command.
[root@localhost ~]# vgextend VolGroup00 /dev/sda3Here's where we got the information from
Volume group "VolGroup00" successfully extended
- VolGroup00 came from Step 8
- /dev/sda3 came from Step 7, concatenating the device name (/dev/sda) with the partitions number (3) to get /dev/sda3
Next we have to tell the Logival Volumn Manager (LVM) that we have an additional partition to add. We do this using the "lvextend" command.
[root@localhost ~]# lvextend -l +63 /dev/VolGroup00/LogVol00 /dev/sda3What the command says above is the following
Extending logical volume LogVol00 to 5.84 GB
Logical volume LogVol00 successfully resized
- Use partition /dev/sda3
- On Volume /dev/VolGroup00/LogVol00 (the name comes from Step 5)
- By 63 extents, this is roughly 2GB. There are other options that let you specific this in terms of GB, percentage free etc.
The the Logical Volume is just a collection of space. Typically you then take this space and create a file-system. Given that we have a file-system we want to extend it with the space we just added to the Logical Volume. We do this with the "resize2fs" command.
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00This command takes all the space we added to the Logical Volume... now the acid test, do we see the free space in the file-system?
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 1531904 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 1531904 blocks long.
Step 13 - Check for free space
Check for the free space, using the "df" command.
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 3.2G 2.3G 59% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 233G 173G 61G 75% /mnt/hgfs
Success! You can see we now have an extra 2GB of free space! Go make yourself a cup of tea.
Sunday, July 5, 2009
Ant, SCP and EC2
I got the error
Turns out that the default deployment of Ant (1.7) did not contain this jar on Mac OS-x 10.5. So I had to do two thingsBUILD FAILED
Deploy.ant.xml:57: Problem: failed to create task or type scp
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-/usr/share/ant/lib
-/Users/alvinrichards/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
- Download the binary distribution of Ant 1.7, unpack the jar and copy ant-jsch.jar to /usr/share/ant/lib
- Download the implementation of the SSH java code from JCraft and copy it to /usr/share/ant/lib
2. I still can't SCP to EC2
So I know I can scp -i to this EC2 host, but the following Ant task fails
<scp localfile="dba.war"
todir="root@xxxx:/usr/java/apache-tomcat-6.0.14/webapps/"
keyfile="xxxx-Amazon-LAMP-image-keypair">
with
BUILD FAILED
/Volumes/Develop/Develop/Projects/HarpoonDeployMK9a/Deploy.ant.xml:57: neither password nor passphrase for user root has been given. Can't authenticate.
Turns out that you need the following in the SCP task for it to work with EC2
trust="yes"
passphrase="xxx"
Friday, July 3, 2009
End of life... Oh Amazon stop making me do work!
Talk about a "Dear John" letter. In the end it was not much work, just needed to download the latest version of Typica 1.5.2a and then changeDear Amazon SQS Customer,
This is a friendly reminder about the upcoming deprecation and end-of-life for the Amazon SQS 2006/2007 WSDL.
import com.xerox.amazonws.sqs.Message;import com.xerox.amazonws.sqs.MessageQueue;import com.xerox.amazonws.sqs.QueueService;import com.xerox.amazonws.sqs.SQSException;
import com.xerox.amazonws.sqs2.Message;import com.xerox.amazonws.sqs2.MessageQueue;import com.xerox.amazonws.sqs2.QueueService;import com.xerox.amazonws.sqs2.SQSException;
The only problem so far is that the old version of Typica (0.8) included in the jar ch.inventec.Base64Coder.class which is need to run. I resorted to including the old Typica jar on the class path after a fruitless search for this class elsewhere.
So I'm no back running with the new WSDL and a happier Jeff Bezos.
Now I just have to rip out the code that did on demand scaling and load balancing...
Sunday, March 8, 2009
VMWare Fusion Shared Printer Fun (or three hours to print a single page)
- Ensure that your Mac can print to the shared machine. Simply try printing a page from Safari. If that does not work, then Google way to fix a "regular" printing problem.
- Set the Network mode on the VM to "Bridged"
- Reboot the VM
- Install the right Printer Drivers (mine was an Epson RX500)
- Install Apple's "Bonjour for Windows"
- Follow the install directions for Bonjour for Windows, accepting all the defaults
- ... and if you are lucky if works