directory based storage in lxc

blueice

Renowned Member
Sep 30, 2009
28
5
68
Greece
icehosting.com
Hello,
i have try the v4 beta, and i want to ask if we can have a directory based storage in lxc (like in openvz)
This can be very helpfull because we can change the size very easy.
Also think with directory based storage we can have and the minimum overhead, so faster performance
Thanks
 
Hi,
With zfs it is Dir based.
For management reason the image base is easyer to handle also the performance is nearly the same.
 
Thanks for the fast answer.
Can we have the option to have Dir based storage and to ext4 also?
One another reason is because in the servers with SSD disks if i have a small image with many writes then this part of the SSD can killed easy.
I have try the zfs but the hard disk performance is lot slower that the ext4, so i prefer to stay in ext4 and miss the benefits of the zfs.
Thank you
 
Thanks for the fast answer.
Can we have the option to have Dir based storage and to ext4 also?
One another reason is because in the servers with SSD disks if i have a small image with many writes then this part of the SSD can killed easy.
I have try the zfs but the hard disk performance is lot slower that the ext4, so i prefer to stay in ext4 and miss the benefits of the zfs.
Thank you

All SSDs are doing wear leveling. You can write the same sector many times, but the actual written SSD zone is different on each write.
 
Hi,
With zfs it is Dir based.

Could you please tell me how can I create a dir-based container with ZFS in 4.0beta? I can't see any way to do that (besides setting CT disk size to 0 but that's just dir-based, doesn't need ZFS).
 
Hi,
With zfs it is Dir based.
For management reason the image base is easyer to handle also the performance is nearly the same.
I don't think so, with Image Based you will:
  1. Can not browse VPS to copy/rename/delete/move file
  2. Can not directly copy/rename/delete/move file between host and VPS
  3. If you need Image Base then you can use KVM instead -- that's why we use OpenVZ rather than KVM
  4. Can not copy/sync partially, this is very useful if you have million files (i.e: emails) which need to backup/copy
  5. Can not do virus scan from host to VPS, you must install virus scan per VPS
  6. With Dir Based you can directly edit VPS file like #nano /vz/private/$VMID/home/username/file.txt. This feature very useful if you use VPS as Web Hosting
So please provide Dir Based or better an option to select Image or Dir Based.
 
I don't think so, with Image Based you will:
<reasons>
So please provide Dir Based or better an option to select Image or Dir Based.

Also, the OpenVZ method allowed for expanding and shrinking as required. If a container needed an extra 100GB for some temporary files, you could just increase it, then decrease it later when those files were gone. You can effectively "move" the free space from one container to another.
This is the one reason I'm still on 3.4. I just can't see a way to work with 4.x the way I currently do, and I can't afford to just throw more storage at it.

I see a hint above that ZFS might be the solution... Is it? Can I install PVE from the CD, choosing ZFS as the filesystem, and be able to shrink my containers? I'm going to go try it on my test box, but I have my doubts.
 
Jip, with ZFS you just change the quota of the dataset. Like with OpenVZ before.

Care to explain a bit more? I can't see anything like that happening.

I reinstalled Proxmox choosing ZFS-RAID0 in the installer. I then created a CT with default 8GB storage, and like before I could expand this, but not shrink it.

You used the word "quota" too... There's a tickbox labeled "Enable quota" in the CT creation dialog... Is that what you mean? Because it's greyed out for me. Pretty sure it was greyed out when I used XFS too.

So if it's possible to do it just like OpenVZ, I'd love to hear how.
 
Hnargh....ok...you're right ;) At least with PVE tools:

Code:
pct resize 143 rootfs 4G
unable to shrink disk size

ZFS itself can do:

Code:
root@test:~# df -h /
Filesystem  Size  Used Avail Use% Mounted on
rpool/vm/subvol-143-disk-1  8.0G  370M...

Code:
zfs setrefquota=4G rpool/vm/subvol-143-disk-1

Code:
root@test:~# df -h /
Filesystem  Size  Used Avail Use% Mounted on
rpool/vm/subvol-143-disk-1  4.0G  370M...

Then do not forget to modify the size parameter in the line containing the rootfs inside /etc/pve/lxc/XXX.conf.
 
I finally got around to testing this today.
The above command is slightly wrong.... At least for my test install. I had to run:
Code:
zfs refquota=<size> <diskpath>
Not sure if this is a change in zfs or a typo in morph027's post. But aside from that, I can confirm it works great. I might now have some hope of finally upgrading.

And, for those wondering... If you attempt to shrink below the currently used size, zfs catches your mistake and errors out... I tried lowering a 1.1GB container down to 1GB, and it bombed out saying "size is less than current used or reserved space".

Edit: Interesting note - even if you don't update the pve config for the container, if you add space via the GUI, it adds to the true size, not the incorrect size in the config. The GUI then correctly shows the true size.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!