+1 Regards
Geoff Higginbottom D: +44 20 3603 0542 | S: +44 20 3603 0540 | M: +447968161581 geoff.higginbot...@shapeblue.com -----Original Message----- From: Rohit Yadav [mailto:rohit.ya...@citrix.com] Sent: 04 January 2013 17:21 To: cloudstack-users@incubator.apache.org Subject: RE: DevCloud : how to customize VHD template Hi Youri, Thanks for sharing your anecdotes. You should post a blog so your solution becomes google-able. Kudos, Rohit ________________________________________ From: Youri Bonnaffé [youri.bonna...@activeeon.com] Sent: Friday, January 04, 2013 10:32 PM To: cloudstack-users@incubator.apache.org Subject: DevCloud : how to customize VHD template Hello, As I've had issues to create and customize an instance template using DevCloud, I would like to share how I finally did it. My goals were to reuse the TTY Linux template, add some custom programs in the template and create a boot script; basically to be able to quickly start an autoconfigured instance. Resizing the VHD template is achievable using vhd-util : * Download the TTY template using the Cloudstack web client * On the Xen host, aka the DevCloud virtualbox VM, you can use vhd-util vhd-util resize -n mytemplate.vhd -j output.log -s 200 (to extend its size to 200M) * On the Xen host create a block device mapped to the VHD file using tap-ctl here is a sample script to will do it ($1 MUST be an absolute path) *device=$(tap-ctl allocate) deviceid=${device#/dev/xen/blktap-2/tapdev} echo $deviceid spawn=$(tap-ctl spawn) pid=${spawn#tapdisk spawned with pid } echo $pid tap-ctl attach -p $pid -m $deviceid tap-ctl open -p $pid -m $deviceid -a vhd:$1 * * Use resize2fs */dev/xen/blktap-2/tapdev...IDOFDEVICE *to expand the partition size (fsck might be needed, do it) * Now if you mount the device *mount /dev/xen/blktap-2/tapdevID some_folder * you should see a partition of 200M instead of the 50M default TTY Linux template While you are at it you can edit files since the image is mounted. * Unmount it when you are done * Remove the block device * pid=$1 deviceid=$2 tap-ctl close -m $deviceid -p $pid tap-ctl detach -m $deviceid -p $pid tap-ctl free -m $deviceid* Then can you can import back the VHD template file using the Cloudstack web client. I hope it will be helpful to someone, I've been struggling for days to do it (I'm not familiar with Xen technologies thought). Youri, ShapeBlue provides a range of strategic and technical consulting and implementation services to help IT Service Providers and Enterprises to build a true IaaS compute cloud. ShapeBlue’s expertise, combined with CloudStack technology, allows IT Service Providers and Enterprises to deliver true, utility based, IaaS to the customer or end-user. ________________________________ This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Shape Blue Ltd. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error. Shape Blue Ltd is a company incorporated in England & Wales.