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

Mount / with 'discard'? #2479

Closed
jpouellet opened this Issue Dec 3, 2016 · 21 comments

Comments

@jpouellet
Contributor

jpouellet commented Dec 3, 2016

I am wondering if there is a reason we do not enable discard for the root filesystem.

I just reclaimed ~10gb of real dom0 disk space by enabling discard on / in a particularly offending StandaloneVM (and dd-ing a bunch of garbage to a file & removing it).

I imagine doing so would afford similar savings for TemplateVMs which accumulate lots of update churn over time.

Relevant tickets:

  • #2478 (where I did some testing)

@jpouellet jpouellet referenced this issue Dec 3, 2016

Open

Qubes Manager Decomposition for Qubes 4.0 #2132

7 of 7 tasks complete
@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Dec 3, 2016

Member

For StandaloneVM it indeed may help, but for AppVM unfortunately not - dm-snapshot do not pass DISCARD operations to lower level. But if dm-linear do, it still may worth enabling it for / too, to have it working in StandaloneVM and TemplateVM. Do I understand correctly that you claim it do work there?

Member

marmarek commented Dec 3, 2016

For StandaloneVM it indeed may help, but for AppVM unfortunately not - dm-snapshot do not pass DISCARD operations to lower level. But if dm-linear do, it still may worth enabling it for / too, to have it working in StandaloneVM and TemplateVM. Do I understand correctly that you claim it do work there?

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Dec 4, 2016

Contributor

Do I understand correctly that you claim it do work there?

Unless I am misinterpreting the below (root-curr & final disk field), yes:

[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |    disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |   6170 MB | 10240 MB | 6648 MB |
[user@dom0 ~]$ qvm-run -p standalone-discard-test 'sudo dd if=/dev/urandom of=/var/garbage'
dd: writing to ___/var/garbage___: No space left on device
8045185+0 records in
8045184+0 records out
4119134208 bytes (4.1 GB) copied, 46.8408 s, 87.9 MB/s
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+----------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |     disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+----------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |  10097 MB | 10240 MB | 10575 MB |
[user@dom0 ~]$ qvm-run -p standalone-discard-test 'sudo rm /var/garbage'
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |    disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |   6170 MB | 10240 MB | 6647 MB |
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
Contributor

jpouellet commented Dec 4, 2016

Do I understand correctly that you claim it do work there?

Unless I am misinterpreting the below (root-curr & final disk field), yes:

[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |    disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |   6170 MB | 10240 MB | 6648 MB |
[user@dom0 ~]$ qvm-run -p standalone-discard-test 'sudo dd if=/dev/urandom of=/var/garbage'
dd: writing to ___/var/garbage___: No space left on device
8045185+0 records in
8045184+0 records out
4119134208 bytes (4.1 GB) copied, 46.8408 s, 87.9 MB/s
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+----------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |     disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+----------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |  10097 MB | 10240 MB | 10575 MB |
[user@dom0 ~]$ qvm-run -p standalone-discard-test 'sudo rm /var/garbage'
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
                    name | on |   state | updbl | type | label | priv-curr | priv-max | root-curr | root-max |    disk |
-------------------------+----+---------+-------+------+-------+-----------+----------+-----------+----------+---------+
 standalone-discard-test |  * | Running |   Yes |      |   red |     65 MB |  2048 MB |   6170 MB | 10240 MB | 6647 MB |
[user@dom0 ~]$ qvm-ls -d standalone-discard-test
@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Dec 4, 2016

Is it worth it to simply add discard for '/' to templates, or will that result in slightly higher CPU usage in appVMs where discard requests are simply generated and forgotten?

I think it may be the former: Adding discard to the '/' entry in the templates is very easy fix that cascades to newly created standalone VMs, and appVMs would be trying to write to '/' only rarely so probably no performance hit.

tasket commented Dec 4, 2016

Is it worth it to simply add discard for '/' to templates, or will that result in slightly higher CPU usage in appVMs where discard requests are simply generated and forgotten?

I think it may be the former: Adding discard to the '/' entry in the templates is very easy fix that cascades to newly created standalone VMs, and appVMs would be trying to write to '/' only rarely so probably no performance hit.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Dec 22, 2016

AFAIK, templates still need qvm-trim-template, so that doc would be the same. What the proposed change actually affects is the root fs of certain standalone VMs (which inherit /etc/fstab from templates).

If we assume that some users will opt to make moderate-heavy use of standalone VMs (from PVM templates), then this change will be a real benefit to them.

tasket commented Dec 22, 2016

AFAIK, templates still need qvm-trim-template, so that doc would be the same. What the proposed change actually affects is the root fs of certain standalone VMs (which inherit /etc/fstab from templates).

If we assume that some users will opt to make moderate-heavy use of standalone VMs (from PVM templates), then this change will be a real benefit to them.

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Dec 22, 2016

Actually, the upgrade docs could have a separate word about using 'fstrim /' internally after upgrading standalone VMs. Otherwise, I think there are very few other docs affected by this. We could put a blurb in doc/templates about standalone VMs generated from Linux/PVM templates: How they do not use COW on root fs and can fstrim it internally.

tasket commented Dec 22, 2016

Actually, the upgrade docs could have a separate word about using 'fstrim /' internally after upgrading standalone VMs. Otherwise, I think there are very few other docs affected by this. We could put a blurb in doc/templates about standalone VMs generated from Linux/PVM templates: How they do not use COW on root fs and can fstrim it internally.

andrewdavidwong added a commit to QubesOS/qubes-doc that referenced this issue Dec 22, 2016

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
Member

andrewdavidwong commented Dec 22, 2016

@tasket: Added.

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Dec 22, 2016

Oops, I added some also...
QubesOS/qubes-doc#254

tasket commented Dec 22, 2016

Oops, I added some also...
QubesOS/qubes-doc#254

@jpouellet jpouellet referenced this issue in QubesOS/qubes-doc Dec 22, 2016

Merged

Add Standalone VMs and TRIM/discard #254

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Nov 27, 2017

Since this is flagged as R4.0 I'll go ahead and state how relevant this is to the new release:

  1. Templates now seem to easily trim their root volumes... Should be no special cases and no significant performance issues when adding discard to fstab.

  2. dom0 root now has a problem where it expands too much, especially when backing up/restoring large amounts of data. Adding discard to root in the fstab should resolve this.

tasket commented Nov 27, 2017

Since this is flagged as R4.0 I'll go ahead and state how relevant this is to the new release:

  1. Templates now seem to easily trim their root volumes... Should be no special cases and no significant performance issues when adding discard to fstab.

  2. dom0 root now has a problem where it expands too much, especially when backing up/restoring large amounts of data. Adding discard to root in the fstab should resolve this.

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package qubes-core-agent_4.0.19-1+deb8u1 has been pushed to the r4.0 testing repository for the Debian jessie template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing jessie-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-agent_4.0.19-1+deb8u1 has been pushed to the r4.0 testing repository for the Debian jessie template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing jessie-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot qubesos-bot referenced this issue in QubesOS/updates-status Jan 24, 2018

Closed

core-agent-linux v4.0.19 (r4.0) #384

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package qubes-core-agent_4.0.19-1+deb9u1 has been pushed to the r4.0 testing repository for the Debian stretch template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing stretch-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-agent_4.0.19-1+deb9u1 has been pushed to the r4.0 testing repository for the Debian stretch template.
To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing stretch-testing, then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc24 has been pushed to the r4.0 testing repository for the Fedora fc24 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc24 has been pushed to the r4.0 testing repository for the Fedora fc24 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc25 has been pushed to the r4.0 testing repository for the Fedora fc25 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc25 has been pushed to the r4.0 testing repository for the Fedora fc25 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc26 has been pushed to the r4.0 testing repository for the Fedora fc26 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package python2-dnf-plugins-qubes-hooks-4.0.19-1.fc26 has been pushed to the r4.0 testing repository for the Fedora fc26 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Jan 24, 2018

Automated announcement from builder-github

The package core-agent-linux has been pushed to the r4.0 testing repository for the CentOS centos7 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

Automated announcement from builder-github

The package core-agent-linux has been pushed to the r4.0 testing repository for the CentOS centos7 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.0-current-testing

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Feb 6, 2018

Automated announcement from builder-github

The package qubes-core-agent_4.0.20-1+deb9u1 has been pushed to the r4.0 stable repository for the Debian template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

Automated announcement from builder-github

The package qubes-core-agent_4.0.20-1+deb9u1 has been pushed to the r4.0 stable repository for the Debian template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Feb 6, 2018

Automated announcement from builder-github

The component core-agent-linux (including package python2-dnf-plugins-qubes-hooks-4.0.20-1.fc26) has been pushed to the r4.0 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Automated announcement from builder-github

The component core-agent-linux (including package python2-dnf-plugins-qubes-hooks-4.0.20-1.fc26) has been pushed to the r4.0 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@qubesos-bot

This comment has been minimized.

Show comment
Hide comment
@qubesos-bot

qubesos-bot Feb 6, 2018

Automated announcement from builder-github

The package core-agent-linux has been pushed to the r4.0 stable repository for the Fedora centos7 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Automated announcement from builder-github

The package core-agent-linux has been pushed to the r4.0 stable repository for the Fedora centos7 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@tasket

This comment has been minimized.

Show comment
Hide comment
@tasket

tasket Mar 18, 2018

Should this be re-opened for dom0? R4.0 disc allocation has dom0 lv on par with domU lvs -- the need to discard is the same. I've personally experienced a space shortage after restoring and also handling disk images and working with template packages in dom0.

Here is another thread:
https://groups.google.com/d/msgid/qubes-users/c4167148-718d-635a-b439-43b28ecedf1b%40riseup.net

tasket commented Mar 18, 2018

Should this be re-opened for dom0? R4.0 disc allocation has dom0 lv on par with domU lvs -- the need to discard is the same. I've personally experienced a space shortage after restoring and also handling disk images and working with template packages in dom0.

Here is another thread:
https://groups.google.com/d/msgid/qubes-users/c4167148-718d-635a-b439-43b28ecedf1b%40riseup.net

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 18, 2018

Member

For dom0 it is tracked by #3226

Member

marmarek commented Mar 18, 2018

For dom0 it is tracked by #3226

@marmarek marmarek closed this Mar 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment