moving MTD partitions

Thomas Gleixner tglx at linutronix.de
Wed Apr 30 09:57:04 EDT 2003


On Wednesday 30 April 2003 13:29, J B wrote:
> "The basic question is if it is feasible to resize (smaller or larger) a
> jffs2 filesystem / mtd block device over flash and maintain the existing
> contents. Copying the contents out and then back again is not an option
> (not enough space)."

First answer is no.
On second thought could be a possibility to do so. 

Assuming following situation:
block = eraseblock
part1:		100 blocks, none free
part2:		100 blocks, 20 blocks free

1. Force garbage collection in part2 (needs hacking jffs2) to free the blocks 
really
2. Write a block mover, which moves all used blocks of part2 to the end of 
part2
3. Erase the 20 blocks at the beginning of part2
4. rmmod mapping driver
5. change partition size of part1 (now 120 blocks) and part2 (now 80 blocks) 
in mapping driver (or give it to the mapping driver by module params)
6. reload mapping driver
7. remount filesystems

I don't know, what's that good for, but that's the only way to do it without 
data loss.

-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx at linutronix.de




More information about the linux-mtd mailing list