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 file systems. If the internal FLASH memory is accidentally formatted, the router will no longer be operational and a service intervention will be required.
The Ext4 Filesystem Utilities Router App allows the router to create and check ext2, ext3, and ext4 file systems. This Router App has no graphical user interface — all operations are performed through the command line interface (CLI).
The app provides two new commands: mke2fs and e2fsck. The mount and umount commands are pre-installed in the router.
Module Installation
The installation file can be downloaded from the Advantech website under the Support & Downloads section, or obtained from your local sales representative.
The easiest way to install the Router App is through the router's web configuration pages. 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 Creating
The mke2fs command is used to create a filesystem. It can create 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 file system. 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 will be 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 will be 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 | Causes mke2fs to not actually create a filesystem, but display what it 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 how the filesystem is going to be used, 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 perform filesystem operations on a mounted partition. Use the -F option to force creation on an in-use or mounted partition.
Device Mounting
The mount command is used to mount a filesystem (on an SD card, USB stick, etc.).
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 stick) to the directory /mnt/usb. Make sure the destination directory exists.
mount -t vfat /dev/sda1 /mnt/usbNote that the -t flag with the filesystem type is not mandatory. If the type is not specified, mount will try to determine it automatically.
Filesystem Checking
The e2fsck command is used to check ext2, ext3, or ext4 file systems. 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:
mke2fs -c /dev/sda1This performs a read-only test on the filesystem to verify there are no bad blocks.
Device Unmounting
The umount command is used to manually unmount 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 file systems. |
-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/sda1Note that the mount directory name can be used instead of the filesystem path.
Licenses
This section lists the Open-Source Software (OSS) licenses used by this Router App.