[Yaffs] YAFFS fs images not working the way I expect

David Wuertele dave-gnus@bfnet.com
Wed, 20 Oct 2004 15:23:23 -0700


I'm trying to dump an image of a YAFFS partition so that I can reload
it later.  Things are not working the way I expect.  Here is an
example of where I'm unable to copy an image onto a partition and
mount it.  Any clues for sale?

1. create a new YAFFS filesystem on mtd partition 2 using a
   pregenerated yaffs.dat file, mount it, and verify that the etc and
   home directories are listed as expected:

  # cd /path/to/mounted/CF/card
  # /sbin/mkyaffs /dev/mtd/2 /yaffs.dat
  # /bin/mount -n /dev/mtdblock/2 /mnt/flash0 -t yaffs
  # ls /mnt/flash0
  etc         home        lost+found
  #

2. unmount that and dump it to a file:

  # umount /mnt/flash0
  # /sbin/mkyaffs /dev/mtd/2 /yaffs.dat
  argc 3 sh 0 optcnt 1
  Erasing and programming NAND
  Erasing block at 0x080
  Erasing block at 0x0810000
  <snipping much Erasage...>
  Erasing block at 0x08354000
  OK
  # dd if=/dev/mtd/2 of=mtd2.img bs=16384
  214+0 records in
  214+0 records out
  # 

3. copy zeros onto the partition and verify that we can't mount it
   anymore

  # dd if=/dev/zero of=/dev/mtd/2 bs=16384 count=214
  214+0 records in
  214+0 records out
  # mount -n /dev/mtdblock/2 /tmp/yaffs -t yaffs
  yaffs: dev is 7938 name is "1f:02"
  mount: Mounting /dev/mtdblock/2 on /tmp/yaffs failed: Not a directory
  #  

4. copy the backup image onto the partition, try (and fail) to mount
   it, and wonder what I'm doing wrong:

  # dd if=mtd2.img of=/dev/mtd/2 bs=16384
  214+0 records in
  214+0 records out
  # /bin/mount -n /dev/mtdblock/2 /mnt/flash0 -t yaffs
  yaffs: dev is 7938 name is "1f:02"
  mount: Mounting /dev/mtdblock/2 on /tmp/yaffs failed: Not a directory
  #