[Solved] How to mount Ubifs in OpenWrt - kirkwood

@bobafetthotmail and others.
I have nsa310 and I'm using extroot. I would like to modify internal flash. Ho to mount it ? Is it possible to add it to /etc/config/fstab ?

root@NSA310:~# lsblk -f
NAME        FSTYPE   LABEL           UUID                                 FSAVAIL FSUSE% MOUNTPOINT
└─sda1      ext4                             3faeee04-eaac-4026-9072-433fb2ada345    1.3T    48% /mnt/sda1
└─sdb1      ext4     NSA310           1e052ffa-3782-4c04-98a7-ab61e6a9c5ae    3.3G     3% /mnt/sdb1
mtdblock2   ubi                      603085179                                           
zram0       swap                     bd13540c-5984-4ef5-9602-18880d5234c3                [SWAP]
ubiblock0_1 squashfs                                                            0   100% /rom

I never tried to do that, but the ubifs should be the mtdblock2 there.

so you can try mounting that to a folder.
mount /dev/mtdblock2 /some/folder

If you just want to access the ubifs temporarily, shut down, remove the device you are using for extroot and boot the OpenWrt device.

extroot will fail and the device will be using ubifs as the overlay, like normal.

It will be exactly like it was the moment before you set up extroot.

When you have done the changes, you can just insert the storage device you used for extroot, and reboot to return in your extroot OpenWrt

That was exactly what I tried. But it didn't work. I would like to mount the internal flash on device which I don't have physical access. E.g If I want to upgrade image and before doing this synchronize configuration.

root@NSA310:~# mount /dev/mtdblock2 /tmp/ubi/
NTFS signature is missing.
Failed to mount '/dev/mtdblock2': Invalid argument
The device '/dev/mtdblock2' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount: mounting /dev/mtdblock2 on /tmp/ubi/ failed: Invalid argument
root@NSA310:~# mount -t ubifs /dev/mtdblock2 /tmp/ubi/
mount: mounting /dev/mtdblock2 on /tmp/ubi/ failed: Invalid argument

It looks like mount doesn't support ubi filesystem

root@NSA310Grawerska:~# block info
/dev/mtdblock2: UUID="603085179" VERSION="1" TYPE="ubi"
/dev/ubiblock0_1: UUID="76d10f28-9a7f3429-8c3e42db-4f261db8" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/ubi0_2: UUID="4e2e4dc3-c2c0-40a5-8d58-333a81101065" VERSION="w4r0" TYPE="ubifs"

When I gather logs for you I found the solution:

 mount -t ubifs /dev/ubi0_2 /tmp/ubi/
root@NSA310:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/ubi0_2              85.8M     24.4M     57.0M  30% /tmp/ubi
1 Like

Yeah, "ubi" isn't a filesystem but a container thing for raw flash devices. "ubifs" is the filesystem you can use in an "ubi" container but it can hold others.

So mtdblock2 is the ubi container that actually contains 2 filesystems, the squashfs readonly /root and the ubifs partition.

Good to know that you found where the ubifs "partition" actually is. As I said I never had to mount that myself so I could not help you much.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.