Skip to content
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

Store volatile.img in separate location #1527

Open
marmarek opened this issue Dec 19, 2015 · 5 comments
Open

Store volatile.img in separate location #1527

marmarek opened this issue Dec 19, 2015 · 5 comments
Labels
C: storage community dev This is being developed by a member of the community rather than a core Qubes developer. P: major Priority: major. Between "default" and "critical" in severity. S: in progress Status: in progress. The assignee is currently working on this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@marmarek
Copy link
Member

marmarek commented Dec 19, 2015

Community Dev: @v6ak
PoC: https://gist.github.com/v6ak/d5d49375d59cfae8e455
Discussion: https://groups.google.com/forum/#!topic/qubes-users/X0BBZ-kfix0


@v6ak https://groups.google.com/d/msgid/qubes-users/1f975e13-45bb-4146-b651-a59b07560a29%40googlegroups.com

I am trying to move my volatile.img files to another location. There are
two (three) reasons for it:

  1. Some additional secrecy; the filesystem is encrypted by a password from
    /dev/random, so no one can read the volatile.img files after reboot.
  2. Performance (+ reduces wear when used with SSD): The filesystem for is
    tuned for performance at the cost of consistency when computer is forcibly
    turned off. This is undesirable for main FS, but OK for a dedicated
    filesystem for this purpose.

I have prepared such a temporary filesystem to be mounted under /largetmp.
(Well, I might change it just to /tmp.) There is nothing I have problem
with, so I'll share the details below.

Now, I would like to move all the volatile imgs there. I have grepped for
volatile.img in Qubes sources. The easiest (though somewhat hacky) way to
do this seems to be adding the following line before truncate command to
/usr/lib/qubes/prepare-volatile-image.sh:
ln -s "/largetmp/volatile-$(printf %s "$FILENAME" | base64 -w0 | sed
's#/#:#g')" "$FILENAME"

(...)

Linked message contains also PoC

Related to #904

@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. P: major Priority: major. Between "default" and "critical" in severity. labels Dec 19, 2015
@marmarek marmarek added this to the Far in the future milestone Dec 19, 2015
@andrewdavidwong
Copy link
Member

@v6ak: Just checking in. Did you happen to continue to do any work on this after your last update? Any further progress or findings you're willing to share with us would be much appreciated!

@v6ak
Copy link

v6ak commented Apr 23, 2016

It seems that it is up-to-date. As a quick hack for 3.0 (and probably also for 3.1, though it might require minor changes), it seems to work perfectly.

A clean solution, would, however, require some code refactoring. As far as I remember, the current code for 3.0 (and probably also for 3.1) assumes that volatile.img is located in the VM's directory. I am not sure where are those assumptions made (it might be few places and is might be many different places as well), so I've decided to use the hacky symlink approach, which partially preserver the assumption of same directory for volatile.img.

And I am totally unsure what changes are brought by 3.2/4.0 branches. Either there might be some refactoring that makes this change easier or there might be something that breaks my approach and makes it even harder to refactor the code.

andrewdavidwong added a commit that referenced this issue Jun 7, 2016
@andrewdavidwong andrewdavidwong added C: other community dev This is being developed by a member of the community rather than a core Qubes developer. S: needs review Status: needs review. Core devs must review contributed code for potential inclusion in Qubes OS. labels Jun 9, 2019
@andrewdavidwong andrewdavidwong modified the milestones: Far in the future, Release 4.1 Jun 9, 2019
@andrewdavidwong
Copy link
Member

andrewdavidwong commented Jun 9, 2019

@v6ak, would you be willing to package your contribution according to our new package contribution procedure?

@andrewdavidwong andrewdavidwong added S: in progress Status: in progress. The assignee is currently working on this issue. and removed S: needs review Status: needs review. Core devs must review contributed code for potential inclusion in Qubes OS. labels Jun 9, 2019
@v6ak
Copy link

v6ak commented Jun 9, 2019 via email

@marmarek
Copy link
Member Author

marmarek commented Jun 9, 2019

Each VM still have volatile volume. By default it is used for swap only, but if root volume in template-based VM is read-only, then dm-snapshot within VM is used to for CoW layer (same as it was in R3.2).
By default root volume is exposed read-write, and CoW is done by LVM in dom0.

You can set rw volume property using qvm-volume tool. And you can also create separate storage pool for volatile volumes and use it either for individual VM (qvm-create --pool volatile=...) or set as global default (qubes-prefs default_pool_volatile ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: storage community dev This is being developed by a member of the community rather than a core Qubes developer. P: major Priority: major. Between "default" and "critical" in severity. S: in progress Status: in progress. The assignee is currently working on this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

No branches or pull requests

4 participants