If you already made an ext4 partition and you want to remove the journaling without wiping the data, i believe thecommand should work ( adjusted for your particular device of course)Code:tune2fs -O ^has_journal /dev/sda1
tune2fs -O has_journal /dev/sda1Can journaling be added back (if so, what is command) to an EXT4 which journaling was removed on without wiping data?
The above is the turn journaling 'off' command, I wish to know if there is a turn journaling 'on' command. I apologize up front if I am miss understanding and the same command is just a toggle command for off & on which I need confirmed.tune2fs -O has_journal /dev/sda1
You should have tried searching.
Take a close look at the command: it doesn't have the ^, which is used to negate the option. So with a ^ it turns off the journaling, without it it turns it on.The above is the turn journaling 'off' command, I wish to know if there is a turn journaling 'on' command. I apologize up front if I am miss understanding and the same command is just a toggle command for off & on which I need confirmed.
fdisk -l
admin@RT-AC86U:/# fdisk -l
Disk /dev/sda: 15.3 GB, 15376318464 bytes
255 heads, 63 sectors/track, 1869 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 1870 15014912 b Win95 FAT32
df -h
admin@RT-AC86U:/# df -h
Filesystem Size Used Available Use% Mounted on
ubi:rootfs_ubifs 77.2M 63.9M 13.2M 83% /
mtd:bootfs 4.4M 3.3M 1.1M 75% /bootfs
mtd:data 8.0M 576.0K 7.4M 7% /data
/dev/mtdblock8 48.0M 1.6M 46.4M 3% /jffs
/dev/sda1 14.3G 2.3M 14.3G 0% /tmp/mnt/SANDISK
mount
admin@RT-AC86U:/# mount
ubi:rootfs_ubifs on / type ubifs (ro,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,mode=0755)
proc on /proc type proc (rw,relatime)
tmpfs on /var type tmpfs (rw,noexec,relatime,size=420k)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mtd:bootfs on /bootfs type jffs2 (ro,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
mtd:data on /data type jffs2 (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
/dev/mtdblock8 on /jffs type jffs2 (rw,noatime)
/dev/sda1 on /tmp/mnt/SANDISK type ext4 (rw,nodev,relatime)
umount -f /tmp/mnt/SANDISK
dd if=/dev/zero of=/dev/sda count=16065 bs=512 && sync
fdisk /dev/sda
m
p
o
p
n
p
1
p
w
mke2fs -t ext2 /dev/sda1
mkfs.ext2 /dev/sda1
mke2fs -t ext3 /dev/sda1
mkfs.ext3 /dev/sda1
mke2fs -t ext4 -O ^has_journal /dev/sda1
mke2fs -t ext4 -O has_journal /dev/sda1
tune2fs -L "yourDiskLabel" /dev/sda1
tune2fs -O ^has_journal /dev/sda1
tune2fs -O has_journal /dev/sda1
tune2fs -O ^64bit /dev/sda1
tune2fs -O 64bit /dev/sda1
/sbin/reboot
How-to: Managing USB disks on the router
Summary: Learn how to manage USB disks directly on the router. Follow a guide to erase the disk, create a new partition table, create a new partition, format as ext2/3/4, and adjust features like disk labels and journaling.
Prerequisites:
Contents:
- SSH client and basic command line interface skills
- Plugging USB disk into router requires physical access
- Readying USB disk
- Plug USB disk into router
- SSH into router (Enable SSH for LAN Only)
- View disk details, with fdisk and df
- Unmount disk, with umount
- Repartition disk, with fdisk
- Format and adjust disk filesystem, with mke2fs and tune2fs (eg. journaling on/off)
- Reboot to remount disk
1. Readying USB disk
All data will be erased from your USB disk in following steps. Backup any existing data, then use computer to format USB disk as FAT32 before plugging into router.
2. Plug USB disk into router
Plug into either USB2.0 or USB3.0 ports.
Note: insufficient shielding on USB port on some router models has been known to cause WiFi interference on 2.4ghz band. You may choose to enable the Reduce USB Interference option in router web ui.
- USB 3.0 : use this high speed port for large capacity disks requiring performance for file sharing and media streaming.
- USB 2.0 : use this low speed port for small capacity disks, adequate for router scripts and packages like Diversion and Skynet.
3. SSH into router (Enable SSH for LAN Only)
Goto Administration / System in router web UI typically at URL
http://router.asus.com/Advanced_System_Content.asp
Enable SSH for LAN ONLY (you will get hacked if you select WAN)
Login to router with your preferred SSH client.
4. View disk details
We have 2 commands available to view disks. Search online for their man pages.
fdisk -- DOS partition maintenance program
It shows partition tables for all disks:
Code:fdisk -l
Take note of the details for your target disk.
df -- display free disk space
Show human readable filesystem usage statistics for all mounted disks (unmounted disks will not be shown):
Code:df -h
My example below shows output from fdisk...
Code:admin@RT-AC86U:/# fdisk -l Disk /dev/sda: 15.3 GB, 15376318464 bytes 255 heads, 63 sectors/track, 1869 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 1870 15014912 b Win95 FAT32
From the output we take note my USB disk is /dev/sda and has 1 partition at /dev/sda1
Continuing my example, we can see output from df...
Code:admin@RT-AC86U:/# df -h Filesystem Size Used Available Use% Mounted on ubi:rootfs_ubifs 77.2M 63.9M 13.2M 83% / mtd:bootfs 4.4M 3.3M 1.1M 75% /bootfs mtd:data 8.0M 576.0K 7.4M 7% /data /dev/mtdblock8 48.0M 1.6M 46.4M 3% /jffs /dev/sda1 14.3G 2.3M 14.3G 0% /tmp/mnt/SANDISK
This output shows our target USB disk partition /dev/sda1 is mounted at /tmp/mnt with label SANDISK.
df will only show statistics for mounted disks. It will not show unmounted disks. fdisk will show both mounted and unmounted disks.
5. Unmount disk
We MUST unmount the disk before repartitioning and formatting.
Code:umount /tmp/mnt/mydisklabel
In my example my target disk has the label SANDISK, so my command would be:
Code:umount /tmp/mnt/SANDISK
You may use df to check if the disk was unmounted:
Code:df -h
6. Repartition disk
Use fdisk on your target disk to manage its partition table (replace the * with your own):
Code:fdisk /dev/sd*
In my example my target disk was /dev/sda, so my command would be:
Code:fdisk /dev/sda
From interactive menu, do these commands in order:
m (or help) to see options
Code:m
p to see all existing partitions on disk (take note)
Code:p
o to erase and create new disk partition table of type mdos MBR Master Boot Record.
This step is important to ensure compatibility with router. Existing partition table could cause problems. For example, GPT GUID Partition Tables will appear as locked and an error will display "Found valid GPT with protective MBR; using GPT" and no menu options would be available.
Code:o
p to see all partitions on disk (now we should see none)
Code:p
n to begin making new partition
Code:n
...then p to make it a primary partition
Code:p
...then one (1) for its partition number
Code:1
...then accept default values for first and last cylinder
p to see all partitions on disk (now we should see 1 created of type ID 83 Linux)
Code:p
w to write changes to disk
Code:w
7. Format and adjust disk filesystem
In my example the target disk was /dev/sda1, and the commands below reflect that. Your target disk may be different. Be sure to check with fdisk.
mke2fs command is to create an ext2/ext3/ext4 filesystem, usually in a disk partition, where device is the special file corresponding to the device (e.g /dev/sdXX ).
A few command options:
-t : set file system type
-L : set a new volume label
-O : specify a feature to use
To format as ext2 filesystem:
or use the alias asus built-inCode:mke2fs -t ext2 /dev/sda1
Code:mkfs.ext2 /dev/sda1
To format as ext3 filesystem:
or use the alias asus built-inCode:mke2fs -t ext3 /dev/sda1
Code:mkfs.ext3 /dev/sda1
To format as ext4 with journaling off (RECOMMENDED):
Code:mke2fs -t ext4 -O ^has_journal /dev/sda1
To format as ext4 with journaling on:
Code:mke2fs -t ext4 -O has_journal /dev/sda1
tune2fs command allows to adjust various filesystem parameters on ext2/ext3/ext4 filesystems.
To change disk label:
Code:tune2fs -L "MYUSB" /dev/sda1
To disable journaling on ext4:
Code:tune2fs -O ^has_journal /dev/sda1
To enable journaling on ext4 you must exclude the ^:
Code:tune2fs -O has_journal /dev/sda1
To disable 64bit filesystem compatibility:
Code:tune2fs -O ^64bit /dev/sda1
To enable 64bit filesystem compatibility exclude the ^:
Code:tune2fs -O 64bit /dev/sda1
8. Reboot to remount disk
Asus-wrt often has trouble remounting disks. It is best to reboot to remount.
DONT unplug the USB disk. Reboot the router.
Code:/sbin/reboot
If you're unable to reboot you can try the mount command.
To force remount the disk...
Code:mount /dev/sda /tmp/mnt/disklabelhere
In my example the disk label was SANDISK, so my command would be:
Code:mount /dev/sda /tmp/mnt/SANDISK
See a problem?
Let me know if you see a mistake in these instructions and I'll correct it.
Not reporting a problem.Let me know if you see a mistake in these instructions and I'll correct it.
Not reporting a problem.
Following this instruction created a proper Linux type filesystem out of a FAT disk. Thanks for the instructions.
Now, if it only were a semi or fully automated script.
This is potentially a problem. The MBR partition table limits the maximum size of the entire disk (not just a partition) to 2TB. If you have a disk larger than this you need to use a GUID partition table (GPT).6. Repartition disk
o to erase and create new disk partition table of type mdos MBR Master Boot Record.
This step is important to ensure compatibility with router. Existing partition table could cause problems. For example, GPT GUID Partition Tables will appear as locked and an error will display "Found valid GPT with protective MBR; using GPT" and no menu options would be available.
Typo - Should be /dev/sda1, not /dev/sda.8. Reboot to remount disk
If you cannot reboot you can try mount command. For my example the disk label is SANDISK so my command would be:
Code:mount /dev/sda /tmp/mnt/SANDISK
This is potentially a problem. The MBR partition table limits the maximum size of the entire disk (not just a partition) to 2TB. If you have a disk larger than this you need to use a GUID partition table (GPT).
Whilst personally I always use MBR if possible for compatibility reasons, we know that Asus officially supports disks of at least 4TB, ergo they must also support GPT.
But here's the rub, the router's version of fdisk doesn't support GTP partition tables let alone have the option to create them. So owners of such devices, when they get to Step 6, will have to partition them with GTP on another device and then skip the whole of that step, continuing from Step 7.
Typo - Should be /dev/sda1, not /dev/sda.
A recent discussion in this thread reminded me of this. Personally I would never make a blanket recommendation to use a non-journaling filesystem. You're trading data integrity for performance, and the performance gains are probably negligible.To format as ext4 with journaling off (RECOMMENDED):
Code:mke2fs -t ext4 -O ^has_journal /dev/sda1
A recent discussion in this thread reminded me of this. Personally I would never make a blanket recommendation to use a non-journaling filesystem. You're trading data integrity for performance, and the performance gains are probably negligible.
The argument goes that devices like USB flash drives are so slow that you need to squeeze every last bit of speed out of them. They also tend to contain relatively small amounts of data that can be recreated if the device becomes corrupted.
Larger HDD or SSD storage devices can be many terabytes in size and can contain thousands of files. Things like media collections or backups. These devices are fast and there is no excuse not to use a journaling filesystem (assuming the router supports it). These devices also tend to contain data that would be difficult to identify (let alone restore) due to the shear volume of it.
@Zonkd As per the discussion in the amtm beta thread, I suggest you amend your dd command as follows. This wipes out not only the MBR but the beginning of partition 1, which prevents all sorts of issues when there is a preexisting filesystem .
dd if=/dev/zero of=/dev/sda count=16065 bs=512 && sync
@Zonkd - assuming I did everything correctly when I set up my drive on my old (n66u) router, is it as simple as connecting it to my new one (ac86)? I'm also not sure it was correctly unmounted; will there be problems (ie data loss) when I reconnect it?
What device did you use to format it? What are you using the drive for? Multimedia network file sharing (movies/music)? Scripts?
What is the filesystem type? Read the top of this section 5 of the guide on using mount command to check.
What device did you use to format it? What are you using the drive for? Multimedia network file sharing (movies/music)? Scripts?
What is the filesystem type? Read the top of this section 5 of the guide on using mount command to check.
Thread starter | Title | Forum | Replies | Date |
---|---|---|---|---|
B | Asus - RT-AX88U - USB Application - Network Place (Samba) Share / Cloud Disk - Problem when enabling Allow guest login | Asuswrt-Merlin | 4 |
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!