Disks
Summary
Section titled “Summary”The RouterOS Disks menu (/disk) lists all attached storage devices that are supported and in working condition. This feature is particularly useful for RouterBOARD devices with SD/CF/USB/SATA/NVMe slots and x86 systems with additional dedicated storage drives. External storage enables advanced features like User Manager databases, proxy caching, SMB shares, container storage, and logging.
You can attach multiple external or secondary drives and select any number of them for various feature usages. For example, User Manager could use 3 disks—one active database and two backups. You can migrate data by copying to a fourth disk, unmounting it, and moving it to another server.
Always use /disk eject before physically removing any disks from your RouterOS device to prevent data loss!
The ROSE-storage package adds additional enterprise data center functionality to RouterOS.
Supported Storage Types
Section titled “Supported Storage Types”RouterOS supports various storage interfaces and types:
| Interface | Description | Use Cases |
|---|---|---|
| USB | USB flash drives and USB hard drives | General storage, backups |
| SD Card | SD and microSD cards | Low-cost storage, logs |
| SATA | Internal SATA drives (x86) | High-capacity storage |
| NVMe | NVMe SSDs via PCIe | High-performance storage |
| SAS | SAS drives via expanders | Enterprise storage |
Disk Properties
Section titled “Disk Properties”View Attached Disks
Section titled “View Attached Disks”[admin@MikroTik] > /disk printFlags: B - BLOCK-DEVICE; M - MOUNTED; F - FORMATTINGColumns: SLOT, MODEL, SERIAL, INTERFACE, SIZE, FREE, FS# SLOT MODEL SERIAL INTERFACE SIZE FREE FS0 BM usb1 USB Flash Disk FBA0911260071572 USB 2.00 480Mbps 2.0GB 1.9GB ext4Available Properties
Section titled “Available Properties”| Property | Description |
|---|---|
eject | Safely unmounts (ejects) the selected drive by slot name |
format | Formats the disk with specified file system |
trim | Discards unused data blocks (NVMe) |
reset-counters | Resets disk statistics |
monitor-traffic | Shows real-time disk performance and health |
test | Performs disk performance tests (RouterOS 7.16+) |
mount-read-only | Sets mounted disk to read-only mode |
mount-point-template | Sets the mounting point using variables |
Mount Point Templates
Section titled “Mount Point Templates”You can customize mount points using variables:
/disk set nvme1 mount-point-template="[model]"/disk set usb1 mount-point-template="[model]-[fs]"Available variables:
[slot]- slot name (default)[model]- device model name[serial]- device serial number[fw-version]- firmware version[fs-label]- file system label[fs-uuid]- file system UUID[fs]- file system type
Disk Flags
Section titled “Disk Flags”| Flag | Description |
|---|---|
B | BLOCK-DEVICE - can be formatted or used for storage |
M | Mounted partition |
F | Currently formatting |
p | Has partition |
r | RAID member |
f | RAID member failed |
c | Encrypted |
g | GUID partition table |
t | NVMe TCP export |
i | iSCSI export |
s | SMB export |
n | NFS export |
The B flag is particularly important as it indicates whether a device can be formatted or used for storage/RAID purposes.
Settings
Section titled “Settings”Global disk settings under /disk settings:
| Setting | Description | Default |
|---|---|---|
auto-smb-sharing | Enables dynamic SMB shares when disk is added | disabled |
auto-smb-user | Default SMB user for auto-shares | - |
auto-media-share | Enables DLNA when disk is added | disabled |
auto-media-interface | Interface for dynamic DLNA | - |
default-mount-point-template | Default mount point template | - |
Note: With auto-smb-sharing=yes and /ip smb share enabled=auto, SMB server automatically enables when storage is plugged in.
Formatting Storage
Section titled “Formatting Storage”Simple Format (ext4 or FAT32)
Section titled “Simple Format (ext4 or FAT32)”[admin@MikroTik] > /disk format usb1 file-system=ext4 formatted: 100%Format with Label and MBR Partition Table
Section titled “Format with Label and MBR Partition Table”[admin@MikroTik] > /disk format usb1 file-system=ext4 label=usb-flash mbr-partition-table=yes formatted: 100%Supported File Systems
Section titled “Supported File Systems”| File System | Description | Use Case |
|---|---|---|
ext4 | Linux ext4 | General use, best compatibility |
fat32 | FAT32 | Cross-platform compatibility |
exfat | exFAT | Large files, cross-platform |
xfs | XFS | High-performance Linux |
btrfs | Btrfs | Advanced features, snapshots |
discard | Discard blocks | Trim unused blocks |
wipe | Secure wipe | Securely erase all data |
Creating Multiple Partitions
Section titled “Creating Multiple Partitions”/disk format usb1 file-system=ext4 label=usb-flash mbr-partition-table=no/disk add type=partition parent=usb1 partition-size=200M/disk add type=partition parent=usb1 partition-size=500M/disk add type=partition parent=usb1 slot=usb1-last-partitionNotes:
- If partition size is not specified, all available space is used
- Use
partition-offsetto offset partition start
RAM Disk (tmpfs)
Section titled “RAM Disk (tmpfs)”Create RAM-backed folders for temporary storage:
[admin@MikroTik] > /disk add type=tmpfs tmpfs-max-size=100M[admin@MikroTik] > file printColumns: NAME, TYPE, SIZE, CREATION-TIME# NAME TYPE SIZE CREATION-TIME0 tmp1 disk 100 003 840 dec/12/2022 11:01:48Warning: RAM disks are emptied on reboot or power loss. Data is stored in RAM and is volatile.
Disk Performance Testing
Section titled “Disk Performance Testing”Available from RouterOS 7.16:
/disk disable usb1/disk test disk=usb2 pattern=sequential type=device thread-count=4 block-size=4K direction=writeWarnings:
- Disk performance tests may slowly degrade disk health
- On write tests, all files and file systems on disks will be destroyed
- Disks must be disabled or unformatted before testing
Example output:
Columns: SEQ, RATE, IOPS, DISK, TYPE, PATTERN, DIR, BSIZE, THREADSSEQ RATE IOPS DISK TYPE PATTERN DIR BSIZE THREADS0 1622.5Mbps 49 516 usb2 device sequential write 4096 4TOT 255.7Mbps 7 806 usb2 device sequential write 4096 4Swap Space
Section titled “Swap Space”Configure swap for containers requiring more RAM than available:
Swap Partition
Section titled “Swap Partition”/disk set disk1 swap=yesNote: The entire disk or partition will be used as swap and cannot be used for other purposes. Use a high-speed disk for better performance.
Swap File
Section titled “Swap File”/disk add type=file file-path=disk1/swapfile file-size=1G swap=yesNote: The disk must be formatted with a file system (e.g., Btrfs). Swap file has lower performance than swap partition.
Safe Disk Removal
Section titled “Safe Disk Removal”Always eject before physical removal:
/disk eject usb1This safely unmounts the drive to prevent data loss.
Common Use Cases
Section titled “Common Use Cases”Web Proxy Cache
Section titled “Web Proxy Cache”/ip proxy set cache-path=usb1/cache-n-db/proxy/The web proxy store is automatically created in the files menu.
Logging to Disk
Section titled “Logging to Disk”/system logging action set disk disk-file-name=/disk1/logCreate log directories manually—unlike proxy, they are not auto-created.
Mount ISO Images
Section titled “Mount ISO Images”/disk add type=file file-path=disk1/mycopy.isoRouterOS can mount .iso and .squashfs images directly.
Troubleshooting
Section titled “Troubleshooting”Disk Not Detected
Section titled “Disk Not Detected”- Check physical connection
- Verify the device is supported
- Try a different USB port or cable
- Check
/disk printoutput
Disk Won’t Format
Section titled “Disk Won’t Format”- Ensure disk is not mounted or disable it first
- Try different file system
- Check for hardware issues
Performance Issues
Section titled “Performance Issues”- Use
/disk monitor-trafficto check real-time stats - Run disk tests to verify health
- Consider faster storage (NVMe over USB 2.0)
- Check for filesystem corruption
Data Loss Prevention
Section titled “Data Loss Prevention”- Always run
/disk ejectbefore removing - Use UPS to prevent corruption from power loss
- Regular backups of important data
- Consider RAID for critical storage