Line 1: |
Line 1: |
− | Typical external resource when dumping a container (especially LXC/Docker) -- is a mount point whose root sits outside of the container's root. This situation was intended to be resolved using [[plugins]] but turned out to be ''so'' frequent, that we introduced a non-plugin way of handling them.
| + | __TOC__ |
| + | |
| + | One of typical external resources when dumping a container (especially LXC/Docker) is a mount point whose root sits outside of the container's root. This situation was intended to be resolved using [[plugins]] but turned out to be common enough to introduce a built-in way of handling it. |
| | | |
| == What is external bind mount == | | == What is external bind mount == |
Line 20: |
Line 22: |
| == How to teach CRIU to dump them == | | == How to teach CRIU to dump them == |
| | | |
− | By default CRIU doesn't dump such mountpoints, because there's no way CRIU will be able to restore it -- the root of these mounts is out of the scope of what CRIU dumped. In the logs you would see the message like | + | By default CRIU doesn't dump such mountpoints, because there's no way CRIU will be able to restore it -- the root of these mounts is out of scope of what CRIU dumped. In the logs you would see a message like |
| | | |
| 34:/bar doesn't have a proper root mount | | 34:/bar doesn't have a proper root mount |
| | | |
− | which will mean, that the mountpoint /bar has inaccessible root. | + | which means the mountpoint /bar has inaccessible root. |
| | | |
− | To dump and restore them there's the <code>--ext-mount-map KEY:VAL</code> option that sets up external mounts root mapping. | + | To dump and restore them there's the <code>--external mnt[KEY]:VAL</code> option that sets up external mounts root mapping. |
| | | |
− | On dump, KEY is a mountpoint inside container and correspoding VAL is a string that will be written into the image as mountpoint's root value. | + | On dump, KEY is a mountpoint inside container, and corresponding VAL is a string that will be written into the image as mountpoint's root value. |
| | | |
− | On restore KEY is the value from the image (VAL from dump) and the VAL is the path on host that will be bind-mounted into container (to the mountpoint path from image). | + | On restore, KEY is the value from the image (VAL from dump), and the VAL is the path on host that will be bind-mounted into container (to the mountpoint path from image). |
| | | |
| For example, if we want to dump the task above we should call | | For example, if we want to dump the task above we should call |
| | | |
− | criu dump ... --ext-mount-map /bar:barmount | + | criu dump ... --external mnt[/bar]:barmount |
| | | |
| The word <code>barmount</code> is an arbitrary identifier, that will be put in the image file instead of the original root path | | The word <code>barmount</code> is an arbitrary identifier, that will be put in the image file instead of the original root path |
Line 43: |
Line 45: |
| On restore we should tell CRIU where to bind mount the <code>barmount</code> from like this | | On restore we should tell CRIU where to bind mount the <code>barmount</code> from like this |
| | | |
− | criu restore ... --ext-mount-map barmount:/foo | + | criu restore ... --external mnt[barmount]:/foo |
| | | |
| With this CRIU will bind mount the /foo into proper mountpoint. | | With this CRIU will bind mount the /foo into proper mountpoint. |
| + | |
| + | == Auto detection == |
| + | |
| + | In case one wants CRIU to autodetect and dump all the external bind mounts, and there is no need to change host mount points on restore, one can use a special syntax: |
| + | |
| + | criu dump ... --external mnt[]:''flags'' |
| + | |
| + | Note here is nothing inside square brackets, and the optional <code>:''flags''</code> argument can contain the following characters: |
| + | |
| + | ; <code>m</code> |
| + | : Also enable dumping of external master mounts (as in <code>mount --make-slave</code>) |
| + | ; <code>s</code> |
| + | : Also enable dumping of external shared mounts (as in <code>mount --make-shared</code>) |
| + | |
| + | By default, neither master nor shared external mounts are not dumped (if found, dump is aborted). Note if <code>''flags''</code> are not given, semicolon is optional. |
| + | |
| + | === Examples === |
| + | |
| + | criu dump ... --external 'mnt[]' |
| + | |
| + | Auto detect and dump all external bind mounts. |
| + | |
| + | criu dump ... --external 'mnt[]:s' |
| + | |
| + | Auto detect and dump all external bind mounts, including the shared ones. |
| + | |
| + | criu dump ... --external 'mnt[]:sm' |
| + | |
| + | Auto detect and dump all external bind mounts, including the shared and the master ones. |
| + | |
| + | == Old days == |
| + | |
| + | For now the same behavior is configured with the <code>--ext-mount-map KEY:VAL</code> option. Soon this option will be [[deprecation|deprecated]]. |
| | | |
| [[Category:HOWTO]] | | [[Category:HOWTO]] |
| [[Category:External]] | | [[Category:External]] |