Skip to main content
  1. Posts/

How to Mount External Storage in CasaOS for Docker Applications (Complete & Easy Guide)

·488 words·3 mins
Noor Khafidzin
Author
Noor Khafidzin
Table of Contents
How to Mount External Storage in CasaOS for Docker Applications (Complete & Easy Guide)

CasaOS is a Docker-based operating system that makes it easy for users to manage self-hosted applications. However, internal storage capacity is often limited. The solution? Mount external storage (HDD, SSD, or USB flash drive) so it can be used by Docker applications in CasaOS. This article will explain how to mount external storage in CasaOS with FAT32, NTFS, and ext4 formats, as well as set permissions so Docker applications can access it.

Preparation Before Mounting
#

  1. Connect external storage (USB/HDD) to your CasaOS device.
  2. Check the storage device with this command:
sudo fdisk -l

Example output:

/dev/sda1  (usually internal storage)  
/dev/sdb1  (usually external storage)
  1. Format the storage (optional) if not already formatted:

    • FAT32 (for high compatibility):
    sudo mkfs.vfat /dev/sdb1 -n USB32GB
    • NTFS (for large files >4GB):
    sudo mkfs.ntfs /dev/sdb1 -f
    • ext4 (recommended for Linux):
    sudo mkfs.ext4 /dev/sdb1

How to Mount Storage in CasaOS
#

1. Create a Mount Point
#

sudo mkdir -p /mnt/external

2. Manual Mount (Testing)
#

For FAT32
#

sudo mount -t vfat /dev/sdb1 /mnt/external -o uid=1000,gid=1000,umask=000

For NTFS
#

sudo mount -t ntfs-3g /dev/sdb1 /mnt/external -o uid=1000,gid=1000

For ext4
#

sudo mount /dev/sdb1 /mnt/external
sudo chown -R 1000:1000 /mnt/external  # Give access to CasaOS user

3. Permanent Mount (Add to /etc/fstab)
#

Edit the /etc/fstab file:

sudo nano /etc/fstab

Add the following line based on your format:

FAT32
#

/dev/sdb1 /mnt/external vfat uid=1000,gid=1000,umask=000 0 0

NTFS
#

/dev/sdb1 /mnt/external ntfs-3g uid=1000,gid=1000 0 0

ext4
#

/dev/sdb1 /mnt/external ext4 defaults 0 0

Then remount:

sudo mount -a

4. Set Permissions for CasaOS & Docker
#

Make sure CasaOS (which usually runs as root or user 1000) can access:

sudo chmod -R 777 /mnt/external  # Full access (use caution in production!)

How to Use Storage in Docker Applications
#

1. Add Storage to CasaOS GUI
#

  1. Open CasaOS Dashboard → Settings → Storage.
  2. Click “Add Storage” and select /mnt/external.

2. Configure Volume in Docker
#

When installing applications via CasaOS:

  • In the “Storage” section, add:
    • Host Path: /mnt/external
    • Container Path: /data (adjust as needed)

Or edit docker-compose.yml manually:

volumes:
  - /mnt/external:/data

Troubleshooting
#

1. Getting “Permission Denied” Error in Docker?
#

Make sure the storage is mounted with uid=1000 option (CasaOS user).

If it still fails, try:

sudo chmod -R 777 /mnt/external

2. Storage Not Appearing in CasaOS?
#

Check if it’s properly mounted:

df -h

Restart CasaOS:

sudo systemctl restart casaos

3. Want to Reformat to ext4?
#

If FAT32/NTFS is causing issues, reformat to ext4:

sudo umount /dev/sdb1
sudo mkfs.ext4 /dev/sdb1
sudo mount /dev/sdb1 /mnt/external

Conclusion
#

By mounting external storage in CasaOS, you can:

  • ✅ Increase storage capacity for Docker applications.
  • ✅ Use HDD/USB as additional storage media.
  • ✅ Set permissions according to your security needs.

Tips:
#

  • For best performance, use ext4 (Linux-specific).
  • If you need Windows compatibility, use NTFS.
  • Avoid chmod 777 on production systems (security risk).

Good luck! 🚀

References:
Mount Drive Linux: Manual & Auto Mount via fstab (Ext4/NTFS)

Related


Load Comments