By jmgm
Dear sirs,
I´ve found a work around for creating an LVM Volume on a small droplet, since they don´t come with LVM out of the box. This solution is not meant for production, as it adds a lot of I/O overhead an a bit of slowness. But for replication a system which runs LVM is good enough.
First of all, we need to create new file on the disk, which will be our virtual hard drive:
This is a 40GB Disk so it will take a while, change 4026 to 2048 if you need 20GB or 10000000 to
1000000 if you need 4G
dd if=/dev/zero of=/lvm.img bs=4096 count=10000000
After that, we wil attach it to a loop device: losetup /dev/loop0 /lvm.img
We will create just one partition on it: fdisk /dev/loop0 << EOF n p 1
w
EOF sync
22256 is the magic number where the first partition starts, so we will attach it to /dev/loop1 losetup -o 32256 /dev/loop1 /dev/loop0
That´s all :)
Now we just to create the physical volume as we were working with an actual hard drive.
pvcreate /dev/loop1 vgcreate vol_vms /dev/loop1
How it helps more poor people as me that cannot afford a bigger droplet just for the LVM feature.
Regards
PS: You can destroy your entire system if you make a mistake on most the steps.
Juan
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sorry, in an explanation I´ve made a mistake, it is: <br>32256 is the magic number where the first partition starts, so we will attach it to /dev/loop1 <br>losetup -o 32256 /dev/loop1 /dev/loop0
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.