-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add aufs to zram_init #7
Comments
Mounting anything (except the currently created filesystem) is beyond the scope of this project. Remember: one tool - one job. There are sufficiently many tools for mounting various filesystems: From the classical /etc/fstab ("mount -a") over the systemd mount-unit nonsense up to specialized and advanced tools like squashmount (the latter is perhaps what you are actually looking for). Since it appears that you are using Ubuntu or Debian and you are thus damned to systemd, probably the correct way to mount something with aufs (BTW: There is also overlay[fs] and also other alternatives like unionfs-fuse), the "correct" way to configure your aim is probably to create a corresponding systemd mount-unit (or service if you use a more advanced mounting tool), making a dependency on the zram-init service. |
But you've added to zram_init ext2 / 4 (in zram-init->):
Add please aufs block in this place. The rest I do myself including unit to systemd Please,please,please :) |
That's a different story: Some filesystem has to be generated and mounted so that zram can be used. There's some theoretical alternatives to ext2/4 (e.g. xfs, btrfs, zfs), but given the nature of zram this would probably not make a big difference.
This would not work: aufs cannot be used instead of ext2/4/xfs/btfs/zfs/... It must be used in addition after creating and mounting that filesystem. It is like creating some files on the freshly created filesystem: There might be some reasons why one would like to have this for some systems, but it is a task which has nothing to do at all with zram in the first place and therefore should be done by an independent script/unit. |
But when the \tmp already mounted, you can not create aufs. Create aufs need immediately after ext4 created in zram, but before mounting. This moment occurs in just zram-init. |
No. Despite its name, "aufs" is not a file system in the sense that it can access block devices: It can only merge two (or more) already mounted directories. |
Ok. I try. Thanks. |
But! :) Then need modify zram_tmp.service? |
I try create aufs_tmp.service.
But in boot log:
Please help fix this error. if i execute mount in terminal all work fine. |
Probably it suffices to generate /etc/systemd/system/zram-tmp.service.d/newdir with the content
Concerning your error: maybe you have to |
To mount uses a other type of units. Next, I bring a working unit:
cat /etc/systemd/system/tmp.mount
It is important to specify the name of just such a file. |
It is necessary to change the line in tmp.mount:
To free space on the / tmp summed from of all layers free space. |
Not sure whether this is really what you wanted: With the default policy of aufs, half of your directories in /tmp will go directly to disk, the other to zram. However, it seems that aufs does not support a policy to use one filesystem until a certain size is reached. In any case, as I said in the beginning, all this has nothing to do with zram in the first place: I will leave this bug open so that users can see your example. |
Ok. Thanks. |
Unfortunately aufs does not know how to divide the files. Therefore, if there are two brunch: 1GB (zram) and 5GB (disk). Let's start recording for the first brunch. 2GB file. When the is over free space in the first brunch, you will receive the message "no space left". Although the logic of the file should be split into parts and record continued in the second brunch. So aufs does not fit for the problem. |
But the problem can solve btrfs! Maybe add btrfs in zram-init? :) btrfs allows you to combine zram and the file on the disk in a single coherent file system. |
I have never tried btrfs and have not installed the kernel and userspace tools. |
Ok i try. |
I used instead zram-init (it is inconvenient to do such) set of unit files. /etc/systemd/system/tmp.mount
/etc/systemd/system/mnt-tmpfs.mount
/etc/systemd/system/btrfs_tmp.service
First mounted tmpfs, then in it is created image0 file. The same file (image0) created by me by hand on the disc (use "dd"). Then in these files created btrfs and it is mounted in / tmp Unfortunately recording on tmpfs image0 and disk image0 occur in the order as want btrfs. With this I still can not do anything. So the data is distributed between the disk and parallel tmpfs. But maybe that's a plus since btrfs is to use the speed optimization |
This does not really help you with the btrfs scheduling policy, but some comments. The purpose of zram-init is actually to support the latter: In your above setting, this means that instead of /etc/systemd/system/mnt-tmpfs.mount you should use some /etc/systemd/system/zram1.service which sets up the device /dev/zram1 (or another device) and creates a btrfs on it (in your case, without mounting it); when the service is stopped, it should free the memory again. The new release zram-init-3.8 actually supports filesystem creation with btrfs (in addition to ext2 or ext4), and moreover, if you specify the special directory "-", it will actually not mount. Thus, the writing of the unit zram1.service is simplified (an example is given in zram-init-3.8). |
btrfs I used because it supports data compression. However, discard + ssd in btrfs probably should return a page in memory when they are freed, but I'm not sure. If used in conjunction with btrfs zram the compression will have to pass in zram. Maybe I'll try. Thank you. |
Need to add aufs in zram_init because it will integrate zram + tmp in ram + tmp in disk. Operating procedure:
When zram (/tmp or /var/tmp) full, the data will be written to the disk.
The text was updated successfully, but these errors were encountered: