Author Topic: Extract Or Mount A Nand Image?  (Read 10488 times)

xamindar

  • Hero Member
  • *****
  • Posts: 803
    • View Profile
    • http://www.radnimax.com
Extract Or Mount A Nand Image?
« on: July 18, 2008, 04:24:42 am »
I have a NAND backup of my zaurus that will not restore for some reason back to my zaurus. It is the same exact size as any other NAND image so I assume the data must still be in there. Hopefully there is a way to get it out.

Anyone know of a way to extract it on a linux machine or to even mount the NAND image so I can access it's contents?
SL-C3100 happily Dualbooting Japanese Rom 1.02 and Debian Eabi
Replaced internal CF with 8gb seagate cf hard drive
Ambicom CF GPS
CyberPower battery powered USB hub
D-link DCF-650W (MAN THIS THING IS HUGE!!)

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Extract Or Mount A Nand Image?
« Reply #1 on: July 18, 2008, 10:35:29 am »
There was a big thread on this a while back, but I can't seem to find it now...
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

xamindar

  • Hero Member
  • *****
  • Posts: 803
    • View Profile
    • http://www.radnimax.com
Extract Or Mount A Nand Image?
« Reply #2 on: July 26, 2008, 06:50:13 am »
The closest I can get so far is this post here:
http://lists.infradead.org/pipermail/linux...ber/008590.html

This forum wont let me post the code so you have to go to the link to see it.


I tried modifying it to use my 3100 nand image and it went through and spat out its results. But I don't think it worked properly, the 3100 nand image is probably quite different other than just the size.  Dang.
« Last Edit: July 26, 2008, 06:53:56 am by xamindar »
SL-C3100 happily Dualbooting Japanese Rom 1.02 and Debian Eabi
Replaced internal CF with 8gb seagate cf hard drive
Ambicom CF GPS
CyberPower battery powered USB hub
D-link DCF-650W (MAN THIS THING IS HUGE!!)

xamindar

  • Hero Member
  • *****
  • Posts: 803
    • View Profile
    • http://www.radnimax.com
Extract Or Mount A Nand Image?
« Reply #3 on: July 27, 2008, 08:08:06 pm »
Ok, I did it. A lot of googling finaly paid off. I'll post a little howto just so others can do it if they need and also so I can in the future if I forget.  

I found a link here to a script that will extract the individual jffs2 filesystems from the NAND image. I also attached the script exactly as I used it on my c3100 NAND backup to this post. Just take off the .txt extension and make it executable.

Here is what I did to get my usr partition from NAND mounted. (usr is the one that had all my stored files)
I stuck the nand-ripper.sh script, modified the parameters in the script to match what is hopefully the correct info, and my nand backup (SYSTC310.DBK) in the same folder and extracted the usr partition with this command:
Code: [Select]
./nand-ripper.sh nand_usr user SYSTC310.DBKI now have nand_usr which is the partition I wanted access to.

Then I had to do some digging around to find out how to even mount or extract this type of image. Most helpful was a post here and here.

if your kernel has them as modules, make sure to modprobe loop and block2mtd

Create the mtd device as I don't really have a NAND on my desktop machine:
Code: [Select]
mknod /dev/mtdblock0 b 31 0Set up a loop device straight to my extracted partition file:
Code: [Select]
losetup /dev/loop0 nand_usrTell the block2mtd driver what you want it to convert to a fake MTD device.
Code: [Select]
echo "/dev/loop0" > /sys/module/block2mtd/parameters/block2mtdThen, finally mount the device:
Code: [Select]
mkdir /mnt/zaurus_usr
mount -t jffs2 /dev/mtdblock0 /mnt/zaurus_usr
SL-C3100 happily Dualbooting Japanese Rom 1.02 and Debian Eabi
Replaced internal CF with 8gb seagate cf hard drive
Ambicom CF GPS
CyberPower battery powered USB hub
D-link DCF-650W (MAN THIS THING IS HUGE!!)

DaveL

  • Newbie
  • *
  • Posts: 15
    • View Profile
Extract Or Mount A Nand Image?
« Reply #4 on: December 06, 2010, 11:06:49 am »
Just in case it helps anyone else.

I had a NAND backup of my SL-C3100 which would not restore (and I tried just about everything before discovering this topic).

I restored an old NAND backup, and then used the nand_ripper script to get the root and user partitions from the one which would not restore.

However, instead of mounting them and recovering the data, I copied them to an SD card, booted into console mode ( D and B ), and copied them direct to the mtdblock partitions:
Code: [Select]
dd if=/mnt/card/nand_root of=/dev/mtdblock2
dd if=/mnt/card/nand_user of=/dev/mtdblock3

It worked a treat, and I was very relieved!

Dave