public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* moving MTD partitions
@ 2003-04-30 11:29 J B
  2003-04-30 13:57 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: J B @ 2003-04-30 11:29 UTC (permalink / raw)
  To: linux-mtd

Someone asked me the following question the other day, and my initial 
response was no.  But I wanted to ask the MTD community and see if there 
were any ideas.

"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)."

This particular user doesn't have any non-partitioned flash space, so making 
one partition larger implies that another gets smaller.  They are assuming 
that the partition that needs to be smaller has some empty space in it.  
Otherwise, the whole maintaining the contents part of their question is 
invalid since you cant shrink a partition that is full without losing data.

So, any ideas?

Thanks,
J





_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: moving MTD partitions
  2003-04-30 13:57 ` Thomas Gleixner
@ 2003-04-30 13:04   ` David Woodhouse
  0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2003-04-30 13:04 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd, J B

On Wed, 2003-04-30 at 14:57, Thomas Gleixner wrote:
> 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. 

Well, making it _larger_ is trivial. Just extend the partition with
empty erase blocks, and they'll get used.

Making it smaller is of course more of a problem -- you need to force
garbage collection until there's at least one block which is completely
free, then unmount, move the last block of the fs into the newly-freed
block, reduce the size by one block and remount it. Repeat.

You used to be able to force GC by repeatedly sending SIGHUP to the
kernel's GC daemon process, but I think Thomas is right that you can't
do that any more and you have to hack it. You'd probably do better to do
it offline with a special tool. 

-- 
dwmw2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: moving MTD partitions
  2003-04-30 11:29 J B
@ 2003-04-30 13:57 ` Thomas Gleixner
  2003-04-30 13:04   ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2003-04-30 13:57 UTC (permalink / raw)
  To: J B, linux-mtd

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@linutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: moving MTD partitions
       [not found] <Law11-F117Oc7wo95EF00013168@hotmail.com>
@ 2003-04-30 16:28 ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2003-04-30 16:28 UTC (permalink / raw)
  To: J B, dwmw2; +Cc: linux-mtd

On Wednesday 30 April 2003 17:00, J B wrote:
>
> i'll have to check in our version of jffs2 to see if SIGHUP still works.
> using 2.4.18, so maybe...

SIGHUP still works, but it is hard to figure out, if gc has cleaned up 
everything. They only way for now is repeat -SIGHUP for a certain amount of 
time. Note that there is no real switch off for gc. So it will recycle clean 
blocks until you decide to stop it, so some hacking will be neccecary though.
The block shuffle stuff (partition magic) itself is no big deal. Find the 
empty ones and rotate the blocks until the empty ones are on top or bottom of 
the partition. This could be done from userspace.

> as for the special tool, i wonder if PowerQuest makes a version of
> PartitionMagic that can deal with MTD devices... ;)

I suggested a mtd-partition-magic project some minutes ago on IRC :)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-30 15:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Law11-F117Oc7wo95EF00013168@hotmail.com>
2003-04-30 16:28 ` moving MTD partitions Thomas Gleixner
2003-04-30 11:29 J B
2003-04-30 13:57 ` Thomas Gleixner
2003-04-30 13:04   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox