This guide fixes Synology root storage issues, migrates Docker storage, and sets up a MinIO node for clustering.
- Root Filesystem (
/dev/md0
):- Size: 2.3 GB
- Used: 1.7 GB
- Available: 483 MB (79% usage)
- Data Volume (
/volume1
):- Size: 11 TB
- Used: 4.8 TB
- Available: 5.8 TB (46% usage)
- Main Space Consumers on
/usr
:- Total
/usr
: 1.5 GB - Key Directories:
/usr/syno
: 721 MB/usr/syno/synoinstall
: 497 MB/usr/lib
: 246 MB/usr/local
: 238 MB- Others: Various smaller directories
- Total
Synology DSM manages packages through the Package Center. It's essential to remove any unused or unnecessary packages to free up space on the root filesystem. Here's how:
-
Access DSM:
- Open your web browser and navigate to your Synology NAS's IP address (e.g.,
http://192.168.0.19:5000
). - Log in with your administrator credentials.
- Open your web browser and navigate to your Synology NAS's IP address (e.g.,
-
Open Package Center:
- Click on the Package Center icon from the main menu.
-
Review Installed Packages:
- Navigate to the Installed tab.
- Identify Unused Packages:
- Look for packages that you no longer use or need. Common candidates might include older applications, testing tools, or previously used services.
-
Uninstall Unnecessary Packages:
- Click on the Action button (usually represented by three dots) next to the package you want to remove.
- Select Uninstall and confirm the action.
- Example Packages to Consider:
- Python2 Packages: If you had Python 2 packages installed for previous automation tasks, they might no longer be needed.
- SMBService: If you're not using SMB/CIFS services.
- SynoFinder: If not in use.
-
Reboot (If Necessary):
- Some uninstallations may require a system reboot. If prompted, proceed to reboot your NAS to apply changes.
Sometimes, uninstalling packages via DSM may leave residual files or directories. You can manually clean these up to reclaim additional space.
-
List Contents of
@appstore
Directory:The
@appstore
directory typically contains installed packages.sudo ls -lh /usr/local/packages/@appstore
-
Identify Unused or Residual Packages:
Look for directories related to packages you have uninstalled or no longer need.
- Example:
/usr/local/packages/@appstore/Python2
/usr/local/packages/@appstore/SMBService
- Example:
-
Remove Unnecessary Directories:
Caution: Ensure that the directories you are about to delete are indeed related to packages you no longer need. Deleting essential system directories can render your NAS unstable.
sudo rm -rf /usr/local/packages/@appstore/Python2 sudo rm -rf /usr/local/packages/@appstore/SMBService sudo rm -rf /usr/local/packages/@appstore/SynoFinder
-
Verify Removal:
After deletion, check the disk usage again to confirm the space has been freed.
df -h /
Synology maintains specific directories for its services. Cleaning these up can help, but proceed with caution.
-
Examine
/usr/syno/synoinstall
Directory:This directory may contain installation files or temporary data.
sudo du -h /usr/syno/synoinstall | sort -hr | head -n 20
-
Remove Unnecessary Files:
If you identify files that are no longer needed (e.g., leftover installation files), you can remove them.
sudo rm -rf /usr/syno/synoinstall/*
-
Check
/usr/syno/synoman
and Related Directories:Similar to
synoinstall
, ensure no unnecessary files are taking up space.sudo du -h /usr/syno/synoman | sort -hr | head -n 20 sudo rm -rf /usr/syno/synoman/webman/texts sudo rm -rf /usr/syno/synoman/webman/modules
Note: Only remove directories if you're certain they're not required by any active services.
If /usr
still occupies 1.5 GB after removing packages, identify specific large files or subdirectories.
-
Find Large Files in
/usr
:sudo find /usr -type f -size +100M -exec ls -lh {} \; | sort -k 5 -rh | head -n 20
This command lists the top 20 largest files within
/usr
that are larger than 100 MB. -
Review and Remove Unnecessary Large Files:
-
Python-Related Files: If you've already removed Python 3.8, ensure no residual Python files remain.
-
Imageio_ffmpeg Binaries:
These binaries might be large and unnecessary if not in use.
sudo rm -rf /usr/lib/python3.8/site-packages/imageio_ffmpeg
-
GeoIP Database:
If not needed, consider removing or relocating.
sudo rm -rf /usr/share/geoip
-
Other Unnecessary Large Files:
Carefully evaluate each large file before deletion.
-
Core dumps can take up significant space.
-
Find and Remove Core Dumps:
sudo find / -type f -name "core" -exec rm -f {} \; sudo find / -type f -name "core.*" -exec rm -f {} \;
-
Check for Crash Reports:
Synology may store crash reports in
/var/crash
. Remove them if they are no longer needed.sudo rm -rf /var/crash/*
After performing the cleanup steps, verify the available space on the root filesystem.
df -h /
You should see a reduction in used space, ideally bringing usage below 70% to provide some buffer.
Once you've successfully cleaned up the root filesystem and have freed additional space, the next step is to create a new volume dedicated to Docker storage. This will ensure Docker's data doesn't consume space on the root filesystem.
Ensure that your vg1000
volume group on /volume1
has sufficient free space.
sudo vgdisplay vg1000
Look for the Free PE / Size line to confirm available space.
Allocate 1-2 TB for Docker storage.
sudo lvcreate -L 2T -n docker_storage vg1000
Format the new logical volume with the ext4
filesystem.
sudo mkfs.ext4 /dev/vg1000/docker_storage
-
Create Mount Point:
sudo mkdir /mnt/docker_storage
-
Mount the Logical Volume:
sudo mount /dev/vg1000/docker_storage /mnt/docker_storage
-
Make the Mount Persistent:
Add the following line to
/etc/fstab
to ensure the volume mounts automatically on boot.echo "/dev/vg1000/docker_storage /mnt/docker_storage ext4 defaults 0 0" | sudo tee -a /etc/fstab
With the new volume ready, configure Docker to use it for its storage.
Since synoservice
isn't available, use alternative commands to stop Docker. On Synology NAS, Docker is typically managed via DSM, but you can try the following:
sudo systemctl stop docker
If systemctl
isn't available, attempt:
sudo service docker stop
If these commands don't work, use DSM's interface:
- Open DSM.
- Go to Package Center.
- Find Docker.
- Stop Docker from the Package Center.
-
Move Docker's Data Directory:
sudo mv /var/lib/docker /mnt/docker_storage
-
Create a Symbolic Link:
sudo ln -s /mnt/docker_storage/docker /var/lib/docker
This ensures Docker continues to operate as if its data directory is still at
/var/lib/docker
, while the actual data resides on the new volume.
Start Docker again using the appropriate method:
sudo systemctl start docker
Or via DSM's Package Center:
- Open DSM.
- Go to Package Center.
- Start Docker.
Confirm that Docker is now using the new storage location:
docker info | grep "Docker Root Dir"
The output should show /mnt/docker_storage/docker
as the Docker Root Dir.
Now that Docker is properly set up with its storage on a separate volume, you can proceed to set up your NAS as part of a distributed MinIO cluster.
docker pull minio/minio
Ensure MinIO has a dedicated directory on /volume1
for its data.
sudo mkdir -p /volume1/minio/data
sudo chown -R 1000:1000 /volume1/minio/data # Adjust ownership as needed
Assuming you have multiple NAS units for the distributed cluster, run MinIO containers on each, pointing to their respective data directories.
Example Command:
docker run -d --name minio \
-p 9000:9000 \
-p 9001:9001 \
-v /volume1/minio/data:/data \
-e "MINIO_ACCESS_KEY=your-access-key" \
-e "MINIO_SECRET_KEY=your-secret-key" \
minio/minio server http://<nas1-ip>/data http://<nas2-ip>/data http://<nas3-ip>/data http://<nas4-ip>/data
Parameters:
-p 9000:9000
: Exposes MinIO API on port 9000.-p 9001:9001
: Exposes MinIO Console on port 9001.-v /volume1/minio/data:/data
: Mounts the data directory.MINIO_ACCESS_KEY
andMINIO_SECRET_KEY
: Set your credentials.server
: Specifies the MinIO server mode with multiple endpoints for distributed storage.
Note:
- Replace
<nas1-ip>
,<nas2-ip>
, etc., with the actual IP addresses of your NAS units. - Ensure all NAS units have Docker configured to use their respective
/volume1/docker_storage
for Docker data.
-
Check Container Status:
docker ps -a
-
Check Logs:
docker logs minio
-
Access MinIO Console:
Navigate to
http://<your-nas-ip>:9001
in your web browser and log in with your access and secret keys.
For better performance and high availability, consider setting up a load balancer (like NGINX or HAProxy) in front of your MinIO cluster.
Example with NGINX:
-
Install NGINX on Docker:
docker pull nginx
-
Run NGINX Container:
docker run -d --name nginx-lb \ -p 80:80 \ -v /path/to/nginx.conf:/etc/nginx/nginx.conf \ nginx
-
Configure
nginx.conf
:Create a configuration file (
nginx.conf
) that balances traffic across your MinIO instances.upstream minio_cluster { server <nas1-ip>:9000; server <nas2-ip>:9000; server <nas3-ip>:9000; server <nas4-ip>:9000; } server { listen 80; location / { proxy_pass http://minio_cluster; } location /minio { proxy_pass http://minio_cluster; } }
-
Reload NGINX Configuration:
docker exec nginx-lb nginx -s reload
-
Check Root Filesystem Usage:
df -h /
Ensure usage is now below 80%, ideally around 70% or lower.
-
Monitor Docker and MinIO:
Regularly check Docker containers and MinIO health to ensure everything is functioning correctly.
-
Set Up Regular Maintenance:
- Log Rotation: Ensure logs are rotated to prevent future space issues.
- Automated Cleanup: Use scripts or Docker settings to clean up unused images and containers.
-
Backup Configuration:
Ensure you have backups of your MinIO data and Docker configurations to prevent data loss.
You've successfully:
- Cleaned up the root filesystem by removing unnecessary Python libraries and other temporary files.
- Created a new logical volume for Docker, ensuring Docker's data doesn't consume root filesystem space.
- Configured Docker to use the new volume, keeping the root filesystem clean.
- Prepared to set up a distributed MinIO cluster using Docker, leveraging the newly allocated storage.
By following these steps, your NAS should be well-prepared to function as a distributed part of your MinIO cluster, with Docker and MinIO operating efficiently without impacting the root filesystem's stability.
Caution: Always ensure that any deletions or modifications to system directories are performed carefully to avoid disrupting essential services. If unsure about any step, consider consulting Synology support or referring to official Synology documentation.
Feel free to reach out if you encounter any issues or need further assistance with any of the steps!