Ext4 Filesystem Utilities
Caution
- This Router App has been tested on a router with firmware version 6.3.10. After updating the router firmware to a higher version, check whether a newer version of the Router App has also been released and update it accordingly for compatibility.
- This Router App is compatible with SmartFlex and SmartMotion Advantech routers only, and requires firmware version 5.3.4 or newer.
- Be careful when working with the router's filesystems. If the internal flash memory is accidentally formatted, the router stops working and requires service intervention.
The Ext4 Filesystem Utilities Router App lets the router create and check ext2, ext3, and ext4 filesystems. This Router App has no graphical user interface — all operations are performed through the command-line interface (CLI).
The Router App provides two new commands: mke2fs and e2fsck. The mount and umount commands are pre-installed on the router.
Module Installation
Download the installation file from the Support & Downloads section of the Advantech website, or obtain it from your local sales representative.
The easiest way to install the Router App is through the router's web interface. Navigate to Customization → Router Apps, click Browse..., and select the installation file named ext4_tools.v3.tgz.

Click Add or Update to proceed with the installation. The Router App appears in the list as Ext2/3/4 Filesystems Utilities.

Commands
Filesystem Creation
The mke2fs command creates an ext2, ext3, or ext4 filesystem.
Synopsis:
mke2fs [-c|-l filename] [-b block-size] [-C cluster-size] [-i bytes-per-inode]
[-I inode-size] [-J journal-options] [-G flex-group-size]
[-N number-of-inodes] [-m reserved-blocks-percentage] [-o creator-os]
[-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
[-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
[-t fs-type] [-T usage-type] [-U UUID] [-jnqvDFKSV] device [blocks-count]Options:
| Option | Description |
|---|---|
-b block-size | Specify the size of blocks in bytes. Valid values are 1024, 2048, and 4096 bytes per block. |
-c | Check the device for bad blocks before creating the filesystem. If specified twice, a slower read-write test is used instead of a fast read-only test. |
-E extended-options | Set extended options for the filesystem. Options are comma-separated and may take an argument using the equals sign. Supported options: stride=stride-size stripe-width=stripe-width resize=max-online-resize lazy_itable_init= (0 to disable, 1 to enable) test_fs — using experimental kernel code discard — discard blocks at mkfs time nodiscard — do not discard blocks at mkfs time |
-F | Force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. |
-g blocks-per-group | Specify the number of blocks in a block group. There is generally no reason to change this — the default is optimal for the filesystem. |
-G flex-group-size | Specify the number of block groups that are packed together to create a larger virtual block group (flex_bg group) in an ext4 filesystem. |
-i bytes-per-inode | Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the ratio, the fewer inodes are created. |
-I inode-size | Specify the size of each inode in bytes. mke2fs creates 256-byte inodes by default. |
-j | Create the filesystem with an ext3 journal. If -J is not specified, default journal parameters are used. |
-J journal-options | Create the ext3 journal using options specified on the command line. Options are comma-separated and may take an argument using the equals sign. Supported options: size=journal-size device=external-journal mke2fs -O journal_dev — external journal |
-K | Keep — do not attempt to discard blocks at mkfs time. |
-l filename | Read the bad blocks list from the specified file. Block numbers must be generated using the same block size as used by mke2fs. |
-L volume-label | Set the volume label for the filesystem. Maximum length is 16 bytes. |
-m reserved-blocks-percentage | Specify the percentage of filesystem blocks reserved for the superuser. This avoids fragmentation and allows root-owned daemons to continue functioning after non-privileged processes are prevented from writing. Default is 5%. |
-M last-mounted-directory | Set the last mounted directory for the filesystem. |
-n | Do not create a filesystem; only display what mke2fs would do. |
-N number-of-inodes | Override the default calculation of the number of inodes to reserve for the filesystem. |
-o creator-os | Override the default value of the "creator operating system" field of the filesystem. |
-O feature[,...] | Create a filesystem with the given features, overriding the default filesystem options. |
-q | Quiet execution. |
-r fs-revision | Set the filesystem revision for the new filesystem. |
-S | Write superblock and group descriptors only. |
-t fs-type | Specify the filesystem type to create (e.g., ext2, ext3, ext4). |
-T usage-type | Specify the intended use of the filesystem so that mke2fs can choose optimal parameters. |
-U UUID | Create the filesystem with the specified UUID. |
-v | Verbose execution. |
-V | Print the version number of mke2fs and exit. |
mke2fs options
Tips
For a detailed description of this command, visit the Linux manual pages.
Example:
Force creation of an ext4 filesystem on /dev/sda1 (e.g., a USB stick connected to the router):
mke2fs -F /dev/sda1 -t ext4Do not create a filesystem on a mounted partition. To force creation even on an in-use or mounted partition (a dangerous operation), specify the -F option twice.
Device Mounting
The mount command mounts a filesystem (for example, on an SD card or USB stick).
Synopsis:
mount [-afirw] [-t FSTYPE] [-O OPT] <DEVICE> <NODE> [-o <option>, ...]Options:
| Flag | Description |
|---|---|
-a | Mount all filesystems in fstab. |
-f | Dry run. |
-i | Do not run mount helper. |
-r | Read-only mount. |
-w | Read-write mount (default). |
-t FSTYPE | Filesystem type. |
-O OPT | Mount only filesystems with option OPT (used with -a only). |
mount flags
| Option | Description |
|---|---|
loop | Ignored (loop devices are autodetected). |
[a]sync | Writes are [a]synchronous. |
[no]atime | Disable/enable updates to inode access times. |
[no]diratime | Disable/enable atime updates to directories. |
[no]relatime | Disable/enable atime updates relative to modification time. |
[no]dev | (Dis)allow use of special device files. |
[no]exec | (Dis)allow use of executable files. |
[no]suid | (Dis)allow set-user-id-root programs. |
[r]shared | Convert [recursively] to a shared subtree. |
[r]slave | Convert [recursively] to a slave subtree. |
[r]private | Convert [recursively] to a private subtree. |
[un]bindable | Make mount point [un]able to be bind mounted. |
bind | Bind a directory to an additional location. |
move | Relocate an existing mount point. |
remount | Remount a mounted filesystem, changing its flags. |
ro/rw | Read-only/read-write mount. |
mount options
Tips
For a detailed description of this command, visit the Linux manual pages.
Example:
Mount /dev/sda1 (e.g., a USB flash drive) to the directory /mnt/usb. Make sure the destination directory exists.
mount -t vfat /dev/sda1 /mnt/usbThe -t flag with the filesystem type is optional. If the type is not specified, mount tries to determine it automatically.
Info
Routers running firmware version 6.6.2 or later can also mount the exFAT filesystem (mount -t exfat /dev/sda1 /mnt/usb), so you can directly use USB flash drives formatted in Microsoft Windows. The mke2fs and e2fsck commands provided by this Router App work only with the ext2, ext3, and ext4 filesystems.
Filesystem Checking
The e2fsck command checks ext2, ext3, or ext4 filesystems. It is generally not safe to run e2fsck on mounted filesystems. The only exception is if the -n option is specified without -c, -l, or -L. Even then, results may not be valid if the filesystem is mounted.
Synopsis:
e2fsck [-pnycfv] [-C fd] [-b superblock] [-B blocksize]
[-j external_journal] [-l|-L bad_blocks_file]Options:
| Option | Description |
|---|---|
-p | Automatic repair (no questions). |
-n | Make no changes to the filesystem. |
-y | Assume "yes" to all questions. |
-c | Check for bad blocks and add them to the badblock list. |
-f | Force checking even if the filesystem is marked clean. |
-v | Be verbose. |
-C fd | Write completion information to the specified file descriptor so that progress can be monitored. |
-b superblock | Use an alternative superblock. |
-B blocksize | Force blocksize when looking for the superblock. |
-j external_journal | Set the location of the external journal. |
-l bad_blocks_file | Add entries to the badblocks list. |
-L bad_blocks_file | Set the badblocks list. |
e2fsck options
Tips
For a detailed description of this command, visit the Linux manual pages.
Example:
Check for bad blocks on /dev/sda1:
e2fsck -c /dev/sda1This performs a read-only test on the filesystem to verify there are no bad blocks.
Device Unmounting
The umount command manually unmounts a mounted filesystem, completing any pending read or write operations and safely detaching it.
Synopsis:
umount [-arlfD] <FILESYSTEM>|<DIRECTORY>Options:
| Flag | Description |
|---|---|
-a | Unmount all filesystems. |
-r | Try to remount devices as read-only if the mount is busy. |
-l | Lazy umount (detach filesystem). |
-f | Force umount (e.g., for an unreachable NFS server). |
-D | Do not free loop device even if it has been used. |
umount flags
Tips
For a detailed description of this command, visit the Linux manual pages.
Example:
Unmount the filesystem on /dev/sda1:
umount /dev/sda1You can also use the mount directory name instead of the filesystem path.
Licenses
This section lists the Open-Source Software (OSS) licenses used by this Router App.