Re: Auto-resize partition when create VM

2013-11-21 Thread Shanker Balan
On 21-Nov-2013, at 5:40 pm, Nux!  wrote:

> On 21.11.2013 12:05, Fariborz Navidan wrote:
>> Hi.
>> Can I write down the above into a shell script and add it to first boot?
>> Can I then resize the root volume?
>
> Yes, those commands will extend your root LVM over to the new DATA disk that 
> you added.
> However, you must only run that ONCE, running it at every boot will likely 
> wipe out the data from it and re-add it to the LVM so be careful.
> Another gotcha is that if you add yet another DATA disk, it will be called 
> /dev/vdc or /dev/vdd and so on, you will need to add some extra logic into 
> your scripts to make sure you will not lose any data.
>

cloud-init has resize hooks. Maybe those could work on CloudStack templates 
also.


--
@shankerbalan

M: +91 98860 60539 | O: +91 (80) 67935867
shanker.ba...@shapeblue.com | www.shapeblue.com | Twitter:@shapeblue
ShapeBlue Services India LLP, 22nd floor, Unit 2201A, World Trade Centre, 
Bangalore - 560 055

CloudStack Bootcamp Training on 27/28 November, Bangalore
http://www.shapeblue.com/cloudstack-training/




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 or related companies. 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. ShapeBlue Services India LLP is a company 
incorporated in India and is operated under license from Shape Blue Ltd. Shape 
Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is 
operated under license from Shape Blue Ltd. ShapeBlue is a registered trademark.


Re: Auto-resize partition when create VM

2013-11-21 Thread Carlos ReƔtegui
Fariborz
Not sure if it is clear from your emails or not but the disk size you are 
selecting in the add instance wizard is not the root disk size, instead it is 
the size of an extra disk that will be available and attached to your instance. 
Hopefully Nux's emails make more sense to you now. 

> On Nov 21, 2013, at 4:05 AM, Fariborz Navidan  wrote:
> 
> Hi.
> Can I write down the above into a shell script and add it to first boot?
> Can I then resize the root volume?
> 
> 
>> On Thu, Nov 21, 2013 at 3:22 PM, Nux!  wrote:
>> 
>>> On 21.11.2013 11:30, Fariborz Navidan wrote:
>>> 
>>> If I use LVM on template, can I add a script that resizes the root logical
>>> volume (LV) via LVM on the first boot? Then how to get the allocated disk
>>> size from cloudstack?
>> 
>> If you user LVM inside the template, then once you add another disk (if
>> you're on KVM it's going to be called "/dev/vdb") you can just do:
>> - pvcreate /dev/vdb
>> - vgextend ExistingVolumeGrop /dev/vdb
>> - lvextend -l +100%FREE /dev/ExistingVolumeGrop/VolumeName
>> - resize2fs /dev/ExistingVolumeGrop/VolumeName
>> 
>> All the above can be run live, no reboot required (if you use ext4).
>> 
>> 
>> 
>> --
>> Sent from the Delta quadrant using Borg technology!
>> 
>> Nux!
>> www.nux.ro
> 
> 
> 
> -- 
> Fariborz Navidan
> Sales & Technical Manager
> Shetab Rayan Limited.
> www.shetabrayan.com


Re: Auto-resize partition when create VM

2013-11-21 Thread Nux!

On 21.11.2013 12:05, Fariborz Navidan wrote:

Hi.
Can I write down the above into a shell script and add it to first 
boot?

Can I then resize the root volume?


Yes, those commands will extend your root LVM over to the new DATA disk 
that you added.
However, you must only run that ONCE, running it at every boot will 
likely wipe out the data from it and re-add it to the LVM so be careful.
Another gotcha is that if you add yet another DATA disk, it will be 
called /dev/vdc or /dev/vdd and so on, you will need to add some extra 
logic into your scripts to make sure you will not lose any data.



--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


Re: Auto-resize partition when create VM

2013-11-21 Thread Fariborz Navidan
Hi.
Can I write down the above into a shell script and add it to first boot?
Can I then resize the root volume?


On Thu, Nov 21, 2013 at 3:22 PM, Nux!  wrote:

> On 21.11.2013 11:30, Fariborz Navidan wrote:
>
>> If I use LVM on template, can I add a script that resizes the root logical
>> volume (LV) via LVM on the first boot? Then how to get the allocated disk
>> size from cloudstack?
>>
>
> If you user LVM inside the template, then once you add another disk (if
> you're on KVM it's going to be called "/dev/vdb") you can just do:
> - pvcreate /dev/vdb
> - vgextend ExistingVolumeGrop /dev/vdb
> - lvextend -l +100%FREE /dev/ExistingVolumeGrop/VolumeName
> - resize2fs /dev/ExistingVolumeGrop/VolumeName
>
> All the above can be run live, no reboot required (if you use ext4).
>
>
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>



-- 
Fariborz Navidan
Sales & Technical Manager
Shetab Rayan Limited.
www.shetabrayan.com


Re: Auto-resize partition when create VM

2013-11-21 Thread Nux!

On 21.11.2013 11:30, Fariborz Navidan wrote:
If I use LVM on template, can I add a script that resizes the root 
logical
volume (LV) via LVM on the first boot? Then how to get the allocated 
disk

size from cloudstack?


If you user LVM inside the template, then once you add another disk (if 
you're on KVM it's going to be called "/dev/vdb") you can just do:

- pvcreate /dev/vdb
- vgextend ExistingVolumeGrop /dev/vdb
- lvextend -l +100%FREE /dev/ExistingVolumeGrop/VolumeName
- resize2fs /dev/ExistingVolumeGrop/VolumeName

All the above can be run live, no reboot required (if you use ext4).


--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


Re: Auto-resize partition when create VM

2013-11-21 Thread Fariborz Navidan
If I use LVM on template, can I add a script that resizes the root logical
volume (LV) via LVM on the first boot? Then how to get the allocated disk
size from cloudstack?

Regards.
TIA


On Thu, Nov 21, 2013 at 2:54 PM, Nux!  wrote:

> On 21.11.2013 11:19, Fariborz Navidan wrote:
>
>> Hi.
>> I want to cloudstack for vps service provisioning. So end user should be
>> confortable and can start using his/her right away. Am I choosing wrong
>> system for this purpose? Th reason I choose CloudStack is that it is free
>> and let me offer offerings with different storage types (SSD, SATA) on the
>> same host node via Storage Tags
>>
>
> Well, this disk size inheritance is an annoyance to many people, but at
> this point in time if you need to add extra disks and you know it's going
> to be a standard, then why not add some code in your VM to format and mount
> the 2nd disk at first boot?
>
> Lucian
>
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>



-- 
Fariborz Navidan
Sales & Technical Manager
Shetab Rayan Limited.
www.shetabrayan.com


Re: Auto-resize partition when create VM

2013-11-21 Thread Nux!

On 21.11.2013 11:19, Fariborz Navidan wrote:

Hi.
I want to cloudstack for vps service provisioning. So end user should 
be
confortable and can start using his/her right away. Am I choosing 
wrong
system for this purpose? Th reason I choose CloudStack is that it is 
free
and let me offer offerings with different storage types (SSD, SATA) on 
the

same host node via Storage Tags


Well, this disk size inheritance is an annoyance to many people, but at 
this point in time if you need to add extra disks and you know it's 
going to be a standard, then why not add some code in your VM to format 
and mount the 2nd disk at first boot?


Lucian

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


Re: Auto-resize partition when create VM

2013-11-21 Thread Fariborz Navidan
Hi.
I want to cloudstack for vps service provisioning. So end user should be
confortable and can start using his/her right away. Am I choosing wrong
system for this purpose? Th reason I choose CloudStack is that it is free
and let me offer offerings with different storage types (SSD, SATA) on the
same host node via Storage Tags


On Thu, Nov 21, 2013 at 2:44 PM, Nux!  wrote:

> On 21.11.2013 11:11, Fariborz Navidan wrote:
>
>> SolusVM does this autpmatically! Isn't it possible to make it fully ready
>> just after instance is created?
>>
>
> Well, it's not the cloud software's job to format and mount your drives.
> If you are not comfortable with doing it manually you can install Webmin
> and use that.
>
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>



-- 
Fariborz Navidan
Sales & Technical Manager
Shetab Rayan Limited.
www.shetabrayan.com


Re: Auto-resize partition when create VM

2013-11-21 Thread Nux!

On 21.11.2013 11:11, Fariborz Navidan wrote:
SolusVM does this autpmatically! Isn't it possible to make it fully 
ready

just after instance is created?


Well, it's not the cloud software's job to format and mount your 
drives. If you are not comfortable with doing it manually you can 
install Webmin and use that.



--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


Re: Auto-resize partition when create VM

2013-11-21 Thread Fariborz Navidan
SolusVM does this autpmatically! Isn't it possible to make it fully ready
just after instance is created?


On Thu, Nov 21, 2013 at 2:33 PM, Nux!  wrote:

> On 21.11.2013 10:57, Fariborz Navidan wrote:
>
>> Hi.
>>
>> When a new VM from template is created the main partition is not resized
>> to
>> the sized defined in disk offering. So the volume has space but not
>> usable.
>> How make it resize automatically when a VM is created?
>>
>
> When you create an instance from a template it will inherit the template's
> disk size. Any extra disk that you add is not handled automatically in any
> way, you need to format and mount it ad labam.
>
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>



-- 
Fariborz Navidan
Sales & Technical Manager
Shetab Rayan Limited.
www.shetabrayan.com


Re: Auto-resize partition when create VM

2013-11-21 Thread Nux!

On 21.11.2013 10:57, Fariborz Navidan wrote:

Hi.

When a new VM from template is created the main partition is not 
resized to
the sized defined in disk offering. So the volume has space but not 
usable.

How make it resize automatically when a VM is created?


When you create an instance from a template it will inherit the 
template's disk size. Any extra disk that you add is not handled 
automatically in any way, you need to format and mount it ad labam.



--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


Auto-resize partition when create VM

2013-11-21 Thread Fariborz Navidan
Hi.

When a new VM from template is created the main partition is not resized to
the sized defined in disk offering. So the volume has space but not usable.
How make it resize automatically when a VM is created?

Regards.