Choose the best disk location for your big data. This helps reduce snapshot size, eases management, and improves performance.
Database servers, container platforms, and similar software often store big data in the root filesystem, under the /var
directory. In Kubuntu 24.04, the root filesystem is BTRFS to facilitate System Rollback. To minimize snapshot size and improve performance, we recommend storing this big data in a separate filesystem or volume.
Besides other benefits, moving this data will prevent it from being reverted when you roll back to a prior snapshot. This is almost always the desired behavior for persistent data.
Please read the disclaimer before proceeding. We review and update guided solutions regularly. If you have suggestions or requests, please write support@kfocus.org.
MySQL is a popular database engine from Oracle. It uses AppArmor sandboxing for security, so moving it to a different location requires configuration adjustments.
1. Stop the MySQL server to prevent data corruption. Then move the data and logs.
Inspect the moved data and logs. The links should point to the destination dirs, and destination dirs should contain files.
2. Configure MySQL to use the updated data and log directories.
3. Adjust AppArmor configuration so the MySQL server can access the data.
4. Restart the MySQL server.
5. Delete large snapshots (such as those containing the old data directory) to free up space. See these steps for guidance.
MariaDB is a fork of MySQL. It uses systemd sandboxing for security, so moving it to a different location requires configuration adjustments. Because it is meant to be a drop-in replacement for MySQL, many of the steps and some of the directories are the same as MySQL.
1. Stop the MariaDB server to prevent data corruption, then move the data.
Inspect the moved data and logs. The links should point to the destination dirs, and the destination dirs should contain files.
2. Configure the MariaDB server to use the updated data and log directories.
3. You may skip this step if you are not using the /home/
directory; otherwise, adjust the systemd configuration so MariaDB server can access the data.
4. Restart the MariaDB server.
5. Delete large snapshots (such as those containing the old data directory) to free up space. See these steps for guidance.
PostgreSQL is a popular community-developed relational database application. In Ubuntu, PostgreSQL is not sandboxed.
1. Stop the PostgreSQL server to prevent data corruption, then move the data.
Inspect the moved data and logs. The links should point to the destination dirs, and the destination dirs should contain files.
2. Configure PostgreSQL to use the updated data directory.
3. Configure PostgreSQL to use the updated log directory.
4. Change the home directory of the postgres
user, then restart the PostgreSQL server.
5. Delete large snapshots (such as those containing the old data directory) to free up space. See these steps for guidance.
Docker is a container engine for running applications in isolated namespaces. In Ubuntu, Docker is not sandboxed, and it stores all its data in a single directory.
1. Stop the Docker daemon to prevent data corruption, then move the data.
Inspect the moved data. The link should point to the destination dir, and the destination dir should contain files.
2. Configure Docker to use a different data directory.
3. Restart the Docker daemon.
5. Delete large snapshots (such as those containing the old data directory) to free up space. See these steps for guidance.
Most applications that manage big data can have their data moved by relocating it to another directory, then changing a configuration file to point to it. If this is not possible, you can usually symlink the new data location to the old location.
1. Ensure the application's service is stopped. This is required to prevent data corruption.
2. Move the application's data directory (and log directory, if applicable) to the desired alternate location.
3. Symlink the new data and log directories back to the original locations.
4. Check for AppArmor sandboxing. You may need to tell AppArmor that the new data location is an alias to the old location to allow access.
5. Check for systemd sandboxing. Several systemd configuration options may limit the access an application has to the rest of the system. In particular, ProtectHome
may prevent an application from accessing files under the /home
directory.
6. Restart the application.
7. If the service fails to start, use systemctl and journalctl to see logs from the service. This data can oftentimes be used in web searches to find a fix.
8. Delete large snapshots (such as those containing the old data directory) to free up space. See these steps for guidance.
Q: Disk space on the root filesystem isn't freed up after moving big data directories. How do I reclaim the space?
A: If a snapshot was created while big data files were present on the root filesystem, it will contain a copy of those files. Deleting the snapshots using the System Rollback Dashboard will fix this. You can click [ Show Snapshot Sizes ]
in the Dashboard to identify and delete snapshots that are taking up space. After deleting snapshots, a reboot can open up more file space because it clears open file handles.
To open up more space, you can use [ Free Up Disk Space ] > [ Quick Clean ]
which will optimize disk usage. Finally, one may erase all snapshots and optimize the disk using [ Free Up Disk Space ] > [ Deep Clean ]
.
This is a partial revision history. See the git
repository for all entries.
2025-09-25 fa408f0a
Add checks for destination directories and symlinks.2025-07-30 6684c321
First publication.We try hard to provide a useful solution validated by professionals. However, we cannot anticipate every situation, and therefore cannot guarantee this procedure will work for your needs. Always backup your data and test the solution to determine the correct procedure for you.
THIS SOLUTION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOLUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
HAVE QUESTIONS?Call 844-536-2871 or write
TellMeMore@kfocus.org | GET FOCUS MERCH