What's new

EXT4 disk formatting options on the router

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

JimbobJay

Regular Contributor
Hi. Does anyone know how one can format a USB as ext4 with journaling disabled, from within the router's shell interface? When I've used the disk formatting options it seems to automatically use EXT2. Without getting onto a debate between ext2 vs ext4, does anyone know how ext4 without journaling can be accomplished? I'm doing it remotely so using a linux install on a pc isn't an option unfortunately.
 
Edit 29 Dec 2018: Please see my other post on the next page for a more comprehensive guide.
---

Don't hold me responsible if these instructions don't work (I wrote them for myself as a guide ages ago and they might be funky).

TL;DR Ext4 with journalling disabled: mke2fs -t ext4 -O ^has_journal -L 'DESIREDLABELHERE' '/dev/sd**'
note: use the sd** of your target disk. Check for it with Display Disk Freespace command: man df

Full guide below:

# Formatting External Drives

Alternative methods to reparation and format: Linux/Ubuntu Disk Utility, Gnome Partition Editor (GParted), or just do directly on router...

## Directly on the router

### Check disk details
Discover the /dev/sd* number of the target usb drive using either of these commands.

1. Show partition table for each DISK, then exit: `fdisk -l`
2. Print filesystem usage statistics (only shows mounted disks): `df -h`

### Repartition the disk
You must unmount the disk before repartitioning: `umount /tmp/mnt/disknamehere**`

Begin partitioning the disk: `fdisk /dev/sd*`

Display menu: `m` or `help`

View the existing partition table: `p`

Complete wipe and replace with a new partition table of type mdos MBR: `o`
_Note: It's best to create a whole new empty partition table, because the existing partition table may be locked (such as when formatted on a Mac as GPT, you'd see displayed "Found valid GPT with protective MBR; using GPT" and it wouldn't give you any options in the menu)_

Create new partition: `n` and choose `p` for primary.

Make sure the partition is "Id 83 System Linux".

Write/save the partition table and quit fdisk utility: `w`

### Format the partition

View the saved partition table: `fdisk -l`

Specify the partition to format **:

Ext2 preset: `mkfs.ext2 /dev/sd**`
Ext3 preset: `mkfs.ext3 /dev/sd**`
Ext4 journalling disabled: `mke2fs -t ext4 -O ^has_journal -L 'LABELHERE' '/dev/sd**'`

Popular options for the mke2fs command:
-t : set file system type
-L : set a new volume label
-O : specify a feature to use (eg. '-O ^64bit' = disable 64 bit feature)

Important Tip: mkfs.[type] is actually an alias of the real binary called `mke2fs`.

### Remount / Reboot

_ASUS-WRT apparently doesn't truly understand how to remount disks, so it's best to reboot_

Reboot the router: `/sbin/reboot`

Or if you really can't be bothered rebooting during testing, this command should work, just don't rely on it.

Remount the disk: `mount /dev/sd** /tmp/mnt/disknamehere`

### Change the label

You can rename the partition anytime you like.

`tune2fs -L "NEWLABELHERE" /dev/sd**`
 
Last edited:
Great, that command worked! Thanks very much, both of you :)
 
Alternative methods to reparation and format: Linux/Ubuntu Disk Utility, Gnome Partition Editor (GParted), or just do directly on router...

Do it directly on the router - there's been changes on the upstream kernels and utilities that can and do present trouble down the road...
 
Do it directly on the router - there's been changes on the upstream kernels and utilities that can and do present trouble down the road...
Thanks I wasn't aware, do you have further info on this? What issues that might appear if using methods other than direct on router? For larger disks like my 2TB external HDD I opted to use GParted. So far so good though.
 
If you already made an ext4 partition and you want to remove the journaling without wiping the data, i believe the
Code:
tune2fs -O ^has_journal /dev/sda1
command should work ( adjusted for your particular device of course)
 
Thanks I wasn't aware, do you have further info on this? What issues that might appear if using methods other than direct on router? For larger disks like my 2TB external HDD I opted to use GParted. So far so good though.
Generally the problems would show up in that the drive wouldn't mount on the router due to unrecognized options. If everything is working fine, I'd say you are OK.
 
Don't hold me responsible if these instructions don't work (I wrote them for myself as a guide ages ago and they might be funky).

TL;DR Ext4 with journalling disabled: mke2fs -t ext4 -O ^has_journal -L 'DESIREDLABELHERE' '/dev/sd**'
note: use the sd** of your target disk. Check for it with Display Disk Freespace command: man df

Full guide below:

# Formatting External Drives

Alternative methods to reparation and format: Linux/Ubuntu Disk Utility, Gnome Partition Editor (GParted), or just do directly on router...

## Directly on the router

### Check disk details
Discover the /dev/sd** number of the target usb drive using either of these commands.

1. Show partition table for each DISK, then exit: `fdisk -l`
2. Print filesystem usage statistics (only shows mounted disks): `df -h`

### Repartition the disk
You must unmount the disk before repartitioning: `umount /tmp/mnt/disknamehere**`

Begin partitioning the disk: `fdisk /dev/sd**`

Display menu: `m` or `help`

View the existing partition table: `p`

Complete wipe and replace with a new partition table of type mdos MBR: `o`
_Note: It's best to create a whole new empty partition table, because the existing partition table may be locked (such as when formatted on a Mac as GPT, you'd see displayed "Found valid GPT with protective MBR; using GPT" and it wouldn't give you any options in the menu)_

Create new partition: `n` and choose `p` for primary.

Make sure the partition is "Id 83 System Linux".

Write/save the partition table and quit fdisk utility: `w`

### Format the partition

View the saved partition table: `fdisk -l`

Specify the partition to format **:

Ext2 preset: `mkfs.ext2 /dev/sd**`
Ext3 preset: `mkfs.ext3 /dev/sd**`
Ext4 journalling disabled: `mke2fs -t ext4 -O ^has_journal -L 'LABELHERE' '/dev/sd**'`

Popular options for the mke2fs command:
-t : set file system type
-L : set a new volume label
-O : specify a feature to use (eg. '-O ^64bit' = disable 64 bit feature)

Important Tip: mkfs.[type] is actually an alias of the real binary called `mke2fs`.

### Remount / Reboot

_ASUS-WRT apparently doesn't truly understand how to remount disks, so it's best to reboot_

Reboot the router: `/sbin/reboot`

Or if you really can't be bothered rebooting during testing, this command should work, just don't rely on it.

Remount the disk: `mount /dev/sd** /tmp/mnt/disknamehere`

### Change the label

You can rename the partition anytime you like.

`tune2fs -L "NEWLABELHERE" /dev/sd**`

This is nice but flawed. I can't figure it out. I follow the instructions to the letter and when I commit the fdisk changes I get this for some reason:
Code:
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument
I'm on the latest merlin f/w on a AC3100. I never see this:
Code:
Make sure the partition is "Id 83 System Linux".
If you accept defaults twice in fdisk and then "w" to write the changes and I get that error. The disk will not mount of course. The usb2 drive is 4gig. If I format on my Ubuntu rig no matter what I get "unsupported flags" and the disk will not mount. Tried this with several drives and I mean several and every time it fails. Can anyone please offer me some guidance? I know I'm missing something. Thanks in advance. :):)
 
On further examination; If I'm run"o" in fdisk, and "w" to write just that change, I get the same error.
 
On further examination; If I'm run"o" in fdisk, and "w" to write just that change, I get the same error.
I’ll check it out soon and make any corrections and rewrite so it’s all clearer. I was due to update my router to latest firmware anyway so I may as well repartition and format my USB drive while I’m at it, for science. :)
 
This is nice but flawed. I can't figure it out. I follow the instructions to the letter and when I commit the fdisk changes I get this for some reason:
Code:
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument
That's because you're trying to use a partition instead of a device. i.e.

fdisk /dev/sdb1 = wrong
fdisk /dev/sdb = right
 
That's because you're trying to use a partition instead of a device. i.e.

fdisk /dev/sdb1 = wrong
fdisk /dev/sdb = right
Are you kidding?.....Man I knew I missed something thanks for the help!!!:oops::oops:
 
I started with EXT4 on my SSD, no journal, using the same command shown above last year. Then I decided to switch to EXT2 and (at least in my setup) EXT2 seems to perform better. My guess would be less overhead?
 
I started with EXT4 on my SSD, no journal, using the same command shown above last year. Then I decided to switch to EXT2 and (at least in my setup) EXT2 seems to perform better. My guess would be less overhead?
Yes I would agree with that. I however only have a 4gig drive and it's usb2, used for Entware and Skynet and a swap file. I have never experienced a problem, however I don't transfer a lot of data.:):)
 
Yes I would agree with that. I however only have a 4gig drive and it's usb2, used for Entware and Skynet and a swap file. I have never experienced a problem, however I don't transfer a lot of data.:):)
I use the disk for Entware, MiniDLNA and some swap, in USB2 mode, because USB3 kills my 2.4 GHz. I also didn't see much improvement with USB3 because the CPU is already close to maxing out when I push large amounts of data to it (using Samba). I noticed that with EXT4 transfers were hovering around 20 MB/s and with EXT2 it's hovering around 28 MB/s. This is all on an older AC68U.
 
Last edited:
On a 1st gen Ac68U I’ve been using a 16Gb USB3.1 Sandisk Cruzer Ultra Fit drive with Ext4 and journaling disabled. I run DNSCrypt, Diversion with logging (I was careful to choose only a few optimised blocklists), and Skynet in debug mode with a 1GB swap. No VPN server is running.

So far performance has been brilliant so I can’t justify spending time to test Ext2 and compare. Checking the line sync stats on my bridges modem I can see the Ac68u is already delivering my max attainable speed.

I’m comfortable recommending this exact configuration to others. I’m not sure if ext2 would perform better than ext4 under different circumstances like different model router or with heavier cpu load ( like running packages for torrenting or media server or openvpn.)
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top