@@ -10,10 +10,10 @@ NethServer 8 uses Podman__ to manage OCI containers.
1010
1111- Rootless applications require the most space. They put their data inside
1212 the user's home directory, for example
13- ``/home/loki1/.local/share/containers/storage ``.
13+ ``/home/loki1/.local/share/containers/storage ``, `` /home/loki1/.config ``
1414
15- - Rootful applications typically store images and volumes in the
16- ``/var/lib/containers/storage `` directory.
15+ - Rootful applications typically store data under
16+ ``/var/lib/containers/storage `` and `` /var/lib/nethserver `` directories
1717
1818Inspect the default directories used by Podman with commands like: ::
1919
@@ -29,17 +29,26 @@ To get a list of the applications running on the local node, run: ::
2929
3030 runagent -l
3131
32- There is another growing directory, ``/var/lib/nethserver ``, that contains
33- the actions and state data of rootful modules, and core components like
34- the user interface code. Space requirements for this directory should be
35- minimal.
32+ Application data includes:
3633
37- When NS8 runs multiple applications, disk usage increases rapidly, and you
38- may run out of space. If disk space runs low, consider expanding the
39- filesystem using the methods described in the following sections.
34+ - Container images, like binary code, scripts, static configuration, and
35+ everything the app needs to run.
36+ - API code, UI code, and the dynamic configuration they generate to
37+ integrate the application with the rest of the cluster.
38+ - User's data like files, messages, pictures, organized in Podman *named
39+ volumes *.
40+
41+ It is always advisable to **plan in advance where user data is stored **.
42+ To decide the disk where a named volume will reside before installing an
43+ application refer to :ref: `named-volume-disk `.
44+
45+ However, when NS8 runs multiple applications, disk usage increases
46+ rapidly, and you may **run out of space **. If disk space runs low,
47+ consider expanding the filesystem using the methods described in the
48+ following sections.
4049
4150Expand the filesystem with external tools
42- -----------------------------------------
51+ =========================================
4352
4453As a general approach, to expand a filesystem, you have to grow the device
4554where it is mounted first.
@@ -57,7 +66,7 @@ filesystem. If you created the VM with the pre-built image, read the next
5766section for detailed commands.
5867
5968Expand pre-built image filesystem
60- ---------------------------------
69+ =================================
6170
6271If NS8 was installed as a virtual machine starting from the
6372:ref: `pre-built image <install_image-section >` in QCOW2 format, follow
@@ -78,7 +87,7 @@ this procedure.
7887 xfs_growfs /
7988
8089Attach a disk for new applications
81- ----------------------------------
90+ ==================================
8291
8392At any time in the NS8 node's life, you can mount a new disk on an
8493alternative path, like ``/home1 ``, and start to install applications on
@@ -103,7 +112,7 @@ directory on the old disk, whilst new apps will be created under
103112 runagent -m node configure-home-basedir --set /home1
104113
105114Migrate /home data to a new disk
106- --------------------------------
115+ ================================
107116
108117If the previous section is not applicable, consider adding a new disk and
109118migrating existing data with a Bash script included in the core:
@@ -130,3 +139,134 @@ Then launch the Bash script by passing the mount location as a parameter,
130139like: ::
131140
132141 bash /var/lib/nethserver/node/migrate-home-disk.sh /mnt/temp_disk
142+
143+
144+ .. _named-volume-disk :
145+
146+ Assign named volume to an additional disk
147+ =========================================
148+
149+ Applications organize user data with Podman named volumes, which normally
150+ live under the default Podman paths (see above). This section explains how
151+ to preconfigure named volumes so they are created under alternative base
152+ paths and therefore on different disks. We will consider the Samba
153+ application, but the method works for any NS8 rootless application that
154+ relies on named volumes. This method does not work with rootful
155+ applications.
156+
157+ Redirecting named volumes helps achieve better storage organization,
158+ reduces pressure on the system disk, and aligns data placement with
159+ performance or capacity characteristics.
160+
161+ .. note ::
162+
163+ Configure the named volume assignment *before * installing, restoring, or
164+ cloning the rootless application.
165+
166+ For example, the Samba File Server application contains a large amount
167+ of user data, and you may want to offload it to a separate disk. This is a
168+ typical scenario where the root disk space is dedicated to the operating
169+ system, application images, and named volumes for fast random-access
170+ databases. The separate disk, slower but larger than the root one, will
171+ contain most of the user data.
172+
173+ Since NS8 does not manage disk mounting, the system administrator must
174+ ensure disk mount reliability.
175+
176+ Assumptions:
177+
178+ - Mount the disk under ``/mnt `` or ``/srv `` base paths. They are commonly
179+ used for this purpose.
180+
181+ - Format the disk with ``xfs `` or ``ext4 `` filesystems. Their features and
182+ defaults match NS8 expectations.
183+
184+ - Set a filesystem label (e.g. ``LABDISK0 ``) to easily recognize the disk.
185+ It may also simplify the ``/etc/fstab `` configuration.
186+
187+ - After a system reboot, an entry in ``/etc/fstab `` or a Systemd
188+ ``.mount `` unit correctly mounts the disk on ``/srv/disk0 ``.
189+
190+ - The disk is not mounted elsewhere. Multiple mount points for the same
191+ disk may lead to SELinux relabeling issues.
192+
193+ Let's assume the disk is already mounted under ``/srv/disk0 `` and
194+ formatted with an ``xfs `` filesystem. The mount configuration is
195+ persistent with an ``/etc/fstab `` entry and survives after a system
196+ reboot.
197+
198+ List available base paths
199+ ^^^^^^^^^^^^^^^^^^^^^^^^^
200+
201+ Disk mount points constitute the base directories where named volumes will
202+ be placed with the custom configuration.
203+
204+ Obtain a list of base paths with this command: ::
205+
206+ volumectl list-base-paths
207+ /srv/disk0 (LABDISK0) size=2.0G available=1.9G used=46.5M
208+
209+ In this output example:
210+
211+ - The first field, ``/srv/disk0 ``, refers to the disk mount point and will
212+ be used in the next commands.
213+
214+ - ``LABDISK0 `` is the label set during filesystem creation, if present. It
215+ is a mnemonic label that helps identify the disk. If no label is set,
216+ the mount point base directory is shown instead.
217+
218+ - The fields ``size ``, ``available ``, and ``used `` refer to disk space
219+ information.
220+
221+ Use the disk for selected volumes
222+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
223+
224+ Let's continue the Samba File Server example. The ns8-samba documentation
225+ describes two named volumes provided by the Samba File Server: ``shares ``
226+ and ``homes ``.
227+
228+ The following commands assign them to ``LABDISK0 `` and take effect the
229+ next time Samba is installed: ::
230+
231+ volumectl add-volume shares --for samba --target /srv/disk0
232+ volumectl add-volume homes --for samba --target /srv/disk0
233+
234+ Check the assignments by printing ``/etc/nethserver/volumes.conf ``. This
235+ file is in INI-compatible format: ::
236+
237+ cat /etc/nethserver/volumes.conf
238+
239+ The next time Samba is installed on the local node, its ``shares `` and
240+ ``homes `` volumes will be created under ``/srv/disk0 ``. The same
241+ configuration is applied if Samba is installed by the restore or clone
242+ procedures.
243+
244+ .. note ::
245+
246+ In future releases, disk selection will be available from the
247+ cluster-admin UI for applications that support it. When an application
248+ is installed, restored, or cloned, it will be possible to select the
249+ disk to use, or keep the root disk as the default unless a different
250+ target is configured in ``volumes.conf ``.
251+
252+
253+ Clear named volume assignments
254+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
255+
256+ To remove an assignment, delete the corresponding line from
257+ ``/etc/nethserver/volumes.conf `` with a text editor, or run the following
258+ commands: ::
259+
260+ volumectl remove-volume --for samba homes
261+ volumectl remove-volume --for samba shares
262+
263+ Removing the assignment does not remove any data; it only updates the
264+ ``volumes.conf `` file.
265+
266+ Move named volume data to a new disk
267+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
268+
269+ .. note ::
270+
271+ The ``volumectl `` command does yet support moving volume data to a
272+ different disk. This feature is planned for future releases.
0 commit comments