[lxc-users] writeback cache for all container processes?
Fajar A. Nugraha
list at fajar.net
Thu Feb 5 07:30:31 UTC 2015
On Mon, Feb 2, 2015 at 8:35 PM, Fajar A. Nugraha <list at fajar.net> wrote:
> On Mon, Feb 2, 2015 at 7:45 PM, Tomasz Chmielewski <mangoo at wpkg.org>
> wrote:
>
>>
>>> If you want to disable sync for the container, the best you can do is
>>> probably use some filesystem that can do so. For example, zfs has
>>> "sync=disabled" per-dataset settings. So you can have "sync=standard"
>>> for filesystems used by the host, and "sync=disabled" for filesystems
>>> used by containers.
>>>
>>
>> That's a weird advice, given that lxc are Linux containers, and ZFS is
>> not in Linux kernel (I know that there are some 3rd party porting attempts,
>> but it's not really applicable in many situations).
>>
>>
> Honestly, that's the best advice I can give. It's straightforward, simple,
> and works.
>
> There are lots of zfsonlinux users using it on production environment.
> Even lxc-create supports zfs as backingstore, to a degree (man lxc-create).
> And doing the above is the equivalent of having eatmydata running on
> everything that access that dataset.
>
>
FYI, this is what I just tested on ubuntu utopic with lxc 1.1.0 from daily
ppa
# zfs get sync,compression rpool/lxc
NAME PROPERTY VALUE SOURCE
rpool/lxc sync disabled inherited from rpool
rpool/lxc compression lz4 inherited from rpool
# lxc-create -B zfs --zfsroot=rpool/lxc -t download -n test -- -d ubuntu -r
utopic -a amd64
Using image from local cache
Unpacking the rootfs
---
You just created an Ubuntu container (release=utopic, arch=amd64,
variant=default)
To enable sshd, run: apt-get install openssh-server
For security reason, container images ship without user accounts
and without a root password.
Use lxc-attach or chroot directly into the rootfs to set a root password
or create user accounts.
# df -h | grep test
rpool/lxc/test 46G 184M 46G 1% /var/lib/lxc/test/rootfs
# zfs get sync,compression,compressratio,used,logicalused rpool/lxc/test
NAME PROPERTY VALUE SOURCE
rpool/lxc/test sync disabled inherited from rpool
rpool/lxc/test compression lz4 inherited from rpool
rpool/lxc/test compressratio 2.04x -
rpool/lxc/test used 183M -
rpool/lxc/test logicalused 371M -
# lxc-start -n test
# lxc-ls -f --running
NAME STATE IPV4 IPV6 GROUPS AUTOSTART
--------------------------------------------------
test RUNNING 10.0.4.111 - - NO
# lxc-attach -n test -- hostname
test
# lxc-attach -n test -- df -h
Filesystem Size Used Avail Use% Mounted on
rpool/lxc/test 46G 142M 46G 1% /
cgroup 12K 0 12K 0% /sys/fs/cgroup
none 100K 4.0K 96K 4% /dev
none 4.0K 0 4.0K 0% /sys/fs/cgroup/cgmanager
none 1.2G 48K 1.2G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 5.9G 0 5.9G 0% /run/shm
none 100M 0 100M 0% /run/user
# lxc-stop -n test
--
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150205/c4e03c1d/attachment.html>
More information about the lxc-users
mailing list