Home » Information » How To » Networking
Networking
Resize a VMWare Disk

Resizing a VMWare Disk

The first thing to realize is that with VMWare player, you CAN NOT resize a VM Disk. You must have at least VMWare Server. No worries though, VMWare Server is free for the downloading. We are starting with a 5GB VMware Drive that is full:
  1. Shut Down your Virtual Machine.The VMWare Drive must be shutdown before resizing
  2. Resize the VMWare Disk. The following pre will resize the disk to 20GB. Use whatever numbers make sense for you here.
    	lance@rcis1:~$ vmware-vdiskmanager -x 20Gb Win2K.vmdk
    Using log file /tmp/vmware-lance/vdiskmanager.log
      Grow: 100% done.
    The old geometry C/H/S of the disk is: 10402/16/63
    The new geometry C/H/S of the disk is: 16383/16/63
    Disk expansion completed successfully.
    
    WARNING: If the virtual disk is partitioned, you must use a third-party
             utility in the virtual machine to expand the size of the
             partitions. For more information, see:
             http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647
    
    If you reboot into your operating system, you will see the changed disk.
    This hasn't really solved our problem though. We still have a C: drive that is full and a bunch of unallocated space.
  3. Reboot the Virtual Machine with a recent Linux Live Distribution. I recommend Ubuntu. Update your .vmx file to either point to your cdrom drive or an iso image:
    			ide1:0.deviceType = "cdrom-raw"
    			ide1:0.autodetect = "TRUE"
    		
    -or-
    			ide1:0.fileName = "livecd.iso"
    			ide1:0.deviceType = "cdrom-image"
    			ide1:0.autodetect = "TRUE"
    		
    You may also have to go into the Virtual Bios (F2) and set the cdrom as the primary boot device
  4. Resize your disk partition. Using gparted (System . . Administration . . Partition Editor), select the primary hard drive (sda) and expand the partition (Probably sda1) to the full size of the drive.
  5. Reboot into your guest operating system. You will either need to update the vmx file or change the bios to keep the system from booting into the LiveCD. If you are using a Windows Guest, it will need to CHKDSK the drive.
  6. Enjoy your newly resized VMWare Disk.

 
Ring the Bell on Linux

Ever run a long operation in a terminal on Linux? You don't want to have to keep checking back to see if the operation has completed, but you don't want to waste time letting the session sit idle after completion. To make Linux ring the terminal bell, thus alerting you when your job is complete, you can use the echo command.

echo -e "\a"

In context, you would most likely do something like this:

tar cvj /homes.tbz /home && echo -e "\a"

 
DHCP and Windows Vista

So you have a network merrily rolling along with a Linux Server providing DNS, DHCP, Samba File Sharing, OpenVPN Access, BackupPC for client backups, Asterisk providing VoIP Services, maybe a Joomla based Intranet. Everyone is happy . . . until . . . someone brings in their shiny new Laptop running Windows Vista. Try as you might, you can't get Vista to pick up an IP Address from your DHCP Server. You could set a static IP address, but remember, this is a laptop and it needs to work from home and the local coffee shop. Where do you go from here?

The first troubleshooting step was to google it and you found out about the Vista DHCP Broadcast Flag change. You have made the registry hacks and nothing has helped. Nevermind the fact that Vista SP1 enables the Broadcast Flag toggle automatically, it still doesn't work.

So, you stop your dhcp server and run it in foreground debugging mode:

# /etc/init.d/dhcpd stop
# dhcpd -f -d

You watch as Vista does a DHCP Discover, your server provides a DHCPOffer and Vista never accepts the offer. What is wrong?

Turns out that while rewriting a perfectly good TCP/IP stack borrowed from BSD, Microsoft made the DHCP Client extra-picky. The first thing they did was to require the Broadcast flag, which the RFCs state SHOULD be supported, not MUST be supported. The next thing they did was to require the DHCPOffer flags to be set just so, in the name of security, of course.

So, why are we running foul of Vista, and more importantly, how can we appease it?

Our first mistake it seems was running Linux instead of Windows Server. Of course we have a stable and productive machine happily providing services for just the cost of the hardware. All would be well if we plunked down the coin for the Windows Server Licenses, applied our monthly patches, installed AntiVirus Software, etc.

But no, we can make it work. Lets take a look at our dhcpd.conf file:

#
# Default LTSP dhcpd.conf config file.
#
server-identifier           localhost;
ignore client-updates;

authoritative;

subnet 10.1.1.0 netmask 255.255.255.0 {
    range 10.1.1.200 10.1.1.252;
    option broadcast-address 10.1.1.255;
    option routers 10.1.1.1;
    option domain-name "example.com";
    option domain-name-servers 10.1.1.1;
    option netbios-name-servers 10.1.1.1;
    option subnet-mask 255.255.255.0;
}

As you can see from the comments, this dhcpd.conf file was based on the LTSP configuration that ships with Ubuntu. By simply moving a few things around, we can get our server to send out packets that are not too hot, not too cold and vista will happily accept them:

option domain-name "example.com";
option domain-name-servers 10.1.1.1;
option netbios-name-servers 10.1.1.1;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;

subnet 10.1.1.0 netmask 255.255.255.0 {
    range 10.1.1.200 10.1.1.252;
    option broadcast-address 10.1.1.255;
    option routers 10.1.1.1;
}

Fire up the dhcp server using the new setup:

# dhcpd -f -d

And thats it. By moving domain-name, domain-name-servers, netbios-name-servers and subnet-mask out of the subnet section and into the global section, we have a configuration that works with Vista. What if you have multiple subnet sections that need different values? I'll leave that as an exercise for the reader. Just don't forget to restart the dhcp service:

# /etc/init.d/dhcpd restart
 
Transcoding Windows Mobile Media

Transcoding videos to Windows Mobile Format (.3gp)

Windows Mobile Phones with cameras record video using MP4 with AMR audio. Once you have this video, you might want to do something else with it, like transcode it to a flash video. You also might want to take an existing AVI file and convert it to a format that Windows Mobile Media Player will play.

These steps will take you through the process using a PC running Ubuntu. I have tested this with 7.10 (Gutsy) and 8.04LTS (Hardy) If you use other Linux Distributions, the steps should be similar. If you don't run Linux, you can download and Burn an Ubuntu install disc from www.ubuntu.com. You can use CDBurnerXP to burn the ISO file to a disc. The installer will walk you through repartitioning your hard drive to make room for Ubuntu. If you don't have the nerve for repartitioning, you can either install Ubuntu as a Windows Application using the wubi Ubuntu Installer or if you have plenty (1GB+) of memory, you can use the excellent VMWare Player and download an Ubuntu Virtual Appliance.

So, you have Ubuntu running and you are ready to start transcoding. In order to do so, you will need a few things.

MP3Lame, svn & build-essential

First, you will most likely want MP3 support so let's grab that. Since we are going to be compiling stuff, lets get build-essential also.:
sudo apt-get install lame liblame0 liblame-dev build-essential svn

AMR

Next, you are going to need AMR Support. I grabbed the most recent NB and WB files from http://ftp.penguin.cz/pub/users/utx/amr/ :
cd /usr/local/src
mkdir amr
cd amr
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.1.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
tar xvjf *bz2
cd amrnb-7.0.0.1
./configure --prefix=/usr
make
sudo make install
cd ../amrwb-7.0.0.2
./configure --prefix=/usr
make
sudo make install

FFMPEG

Now we need to download and build the latest ffmpeg. Sure, Ubuntu comes with ffmpeg, but not with amr.
cd /usr/local/src
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-libamr-nb --enable-libamr-wb --enable-libmp3lame --enable-nonfree --prefix=/usr
make
sudo make install

If all went well, we should have a shiny new ffmpeg ready to transcode videos. To make life easier, I use a bash script:
vid2phone:
#!/bin/bash
until [ -z "$1" ]
do
BASENAME=`basename "$1" | tr [:space:] _ | tr . -`
ffmpeg -i "$1" -r 15 -s 320x240 -vcodec mpeg4 -acodec libamr_nb -ar 8000 -ab 4.75k -ac 1 $BASENAME.3gp
shift
done
This takes any number of video files as command line parameters and attempts to create MPEG4 15fps amr mono files with the same base name and a .3gp extension.

Converting a Phone Video to Flash Video

Now that you have ffmpeg configured, you can use it to create a flash video from your phone videos:
ffmpeg -i infile.mp4 -vcodec flv -acodec libmp3lame -ar 11025 outfile.flv

 
Queued Asterisk .call files

Say you have a small Asterisk installation with a single outgoing Zap channel and you want to throw a bunch of call files at it.  If you move them all into the outgoing directory at once, Asterisk will try to call them all and only the first one will work.  The rest will all fail because the channel is unavailable.  What you need is a way to move them one at a time into the outgoing directory. 

 

This pair of bash scripts does just that: (Note the popast script runs forever.)

popast 

#!/bin/bash
#script to sanely move call files
echo popast: checking for files2
while [ 1 ] ; do
    echo popast: inwhile1
    while [ -e /var/spool/asterisk/outgoing/*call ] ; do
        echo popast: inwhile waiting for call completion
        sleep 5
    done
    echo popast: calling mvfile
    mvfile queued/*call
done
echo popast: done

mvfile

#!/bin/bash
#script to sanely move call files
echo mvfile: $1
mv $1 /var/spool/asterisk/outgoing/
 

 
<< Start < Prev 1 2 Next > End >>

Page 1 of 2