Home » File Systems » JFFS2 Filesystem » How to extract files from jffs2 root filesystem image ?

How to extract files from jffs2 root filesystem image ?

[ Note: following commands has been tried on ubuntu 16.04, but should work on other Linux distros as well ]

Lets create a temporary device node in /tmp as,

 $ sudo mknod /tmp/mtdblock0 b 31 0 
 $ ls -l /tmp/mtdblock0  

brw-r–r– 1 root root 31, 0 Aug 23 00:21 /tmp/mtdblock0

 $ sudo modprobe mtdblock 
 $ sudo modprobe mtdram total_size=65536 erase_size=256 
 $ sudo modprobe jffs2 

Now lets use dd command to write jffs2 binary rootfs to temporary device node we created at /tmp as,

 $ sudo dd if=/home/myuser/Downloads/rootfs.jffs2 of=/tmp/mtdblock0 

37888+0 records in
37888+0 records out
19398656 bytes (19 MB, 18 MiB) copied, 0.295502 s, 65.6 MB/s

 $ sudo mkdir /media/jffs2-extracted 

Now we will use a mount command for mounting jffs2 rootfs at /media/jffs2-extracted folder as,

 $ sudo mount -t jffs2 /tmp/mtdblock0 /media/jffs2-extracted 
$ ls /media/jffs2-extracted/
bin  boot  dev  etc  home  lib  linuxrc  media  mnt  proc  sbin  sys  tmp  usr  var

This is how you can mount an jffs2 rootfs binary and extract the files from it.


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment