Difference between revisions of "Ploop/Mount helpers"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(created)
 
(rm translate tags)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Despite the fact that ploop is not a file system, a trick exist
 
Despite the fact that ploop is not a file system, a trick exist
to make it look and feel like so -- i.e. to use usual <code>mount</code>
+
to make it look and feel like so i.e. to use usual <code>mount</code>
 
and <code>umount</code> commands rather than the {{Man|ploop|8}} tool.
 
and <code>umount</code> commands rather than the {{Man|ploop|8}} tool.
This article describes why and how, and lists caveats and limitation.
+
This article describes how it works and can be used.
  
 
== Introduction ==
 
== Introduction ==
Line 21: Line 21:
  
 
== Mounting ==
 
== Mounting ==
 
Normally, ploop is mounted by <code>ploop mount</code> command.
 
  
 
You can use the following syntax to mount a ploop device and the filesystem inside it:
 
You can use the following syntax to mount a ploop device and the filesystem inside it:
Line 44: Line 42:
 
== Unmounting ==
 
== Unmounting ==
  
Normally, ploop is unmounted by <code>ploop umount</code> command.
+
To unmount, DiskDescriptor can be specified:
 +
 
 +
umount /path/to/DiskDescriptor.xml
 +
 
 +
A mount point can be used as well:
 +
 
 +
umount /mount/point
 +
 
 +
== Limitations ==
  
But if the following is true, usual <code>umount</code> can be used:
+
Note that umount can only work if:
 
# /etc/mtab is a separate file (not a symlink to /proc/mounts);
 
# /etc/mtab is a separate file (not a symlink to /proc/mounts);
# mounting should have been done using <code>mount</code> (not <code>ploop mount</code>).
+
# mounting was done using <code>mount</code> (not <code>ploop mount</code>).
 +
 
 +
Otherwise, umount binary will not be able to find <code>ploop</code> as the "filesystem"
 +
field in /etc/mtab, and will not call <code>umount.ploop</code> helper. As a result,
 +
file system will be unmounted, but ploop device itself will stay mounted.
 +
 
 +
== Alternative ==
 +
 
 +
<code>ploop mount</code> and <code>ploop umount</code> commands,
 +
as described in {{Man|ploop|8}} man page.
  
Any of the following can be used:
+
== See also ==
  
umount /path/to/DiskDescriptor.xml
+
* [[Ploop]]
umount /mount/point
+
* {{Bug|2817}}
  
[[Category: ploop]]
+
[[Category: Storage]]

Latest revision as of 15:25, 10 March 2021

Despite the fact that ploop is not a file system, a trick exist to make it look and feel like so — i.e. to use usual mount and umount commands rather than the ploop(8) tool. This article describes how it works and can be used.

Introduction[edit]

ploop is not a filesystem per se, but a kernel w:loop device driver, providing a way to represent a ploop image (or a set of stacked images) as a block device. On top of that block device provided by ploop, an ext4 file system is created and used, for example, for storing files of a specific container.

Therefore a complete ploop mount consists of two steps:

  1. "mount" ploop image(s) to create a ploop device (/dev/ploopNNNNN)
  2. mount a filesystem residing on this ploop device to a mount point

For simplicity, these two are usually wrapped to be done together in one step (say when you use ploop mount with -m option). In reality, step 1 is kernel assembling a device out of image(s), and step 2 is the real mount.

Mounting[edit]

You can use the following syntax to mount a ploop device and the filesystem inside it:

mount -t ploop [option ...] /path/to/DiskDescriptor.xml /mount/point

The following options are supported:

-r, -o ro

mount read-only

-v, --verbose

be more verbose

-f, --fake

do everything except for the actual mount

-n, --no-mtab, -s

these options are deliberately ignored

Unmounting[edit]

To unmount, DiskDescriptor can be specified:

umount /path/to/DiskDescriptor.xml

A mount point can be used as well:

umount /mount/point

Limitations[edit]

Note that umount can only work if:

  1. /etc/mtab is a separate file (not a symlink to /proc/mounts);
  2. mounting was done using mount (not ploop mount).

Otherwise, umount binary will not be able to find ploop as the "filesystem" field in /etc/mtab, and will not call umount.ploop helper. As a result, file system will be unmounted, but ploop device itself will stay mounted.

Alternative[edit]

ploop mount and ploop umount commands, as described in ploop(8) man page.

See also[edit]