On Tue, 15 Mar 2005 12:17:54 -0300, itamar <[EMAIL PROTECTED]> wrote:
> How to resize a ext3 root_fs ?

Well, let's see an example. Disclaimer : You're on your own.

~$ dd if=/dev/zero of=test.fs bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes transferred in 0.162605 seconds (644860977 bytes/sec)

~$ mkfs.ext3 -F test.fs
mke2fs 1.36 (05-Feb-2005)
Filesystem label=
OS type: Linux
Block size= (log=0)
Fragment size=1024 (log=0)
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

  Note:

   [Block size = 1024]

~$ resize2fs test.fs 50M
resize2fs 1.36 (05-Feb-2005)
Resizing the filesystem on test.fs to 51200 (1k) blocks.
The filesystem on test.fs is now 51200 blocks long.

  Note:
    [The filesystem on test.fs is now 51200 blocks long.]
    [Block size = 1024]
    [New filesystem size is 51200*1024 bytes = 52428800 bytes]
     
Now you can use dd to extract the new filesystem from the bigger file.

  dd if=test.fs of=new.fs bs=1 count=52428800 (this would be slow)

~$ dd if=test.fs of=new.fs bs=100 count=524288
524288+0 records in
524288+0 records out
52428800 bytes transferred in 1.705196 seconds (30746493 bytes/sec)

~$ fsck.ext3 new.fs
e2fsck 1.36 (05-Feb-2005)
new.fs: clean, 11/13832 files, 5879/51200 blocks

I wrote a simple wrapper to the "truncate" system call that you can
use if you don't have enough free space to use "dd" or if you're sure
of what you're doing. See:

http://arhuaco.blogspot.com/2005/02/how-do-i-truncate-file-in-linux.html

Regards,
Nelson.-

> 
> e2fsck -j ext3 filename
> 
> dd if=/dev/zero of=filename bs=1 count=1 seek=newsize conv=notrunc
> 
> resize2fs -p filename
> 
> e2fsck -j ext3 filename
> 
> this works ?
> 
> Itamar Reis Peixoto
> +55 (34) 3238 3845
> e-mail : [EMAIL PROTECTED]
> http://vps.ispbrasil.com.br

-- 
Homepage : http://geocities.com/arhuaco

The first principle is that you must not fool yourself
and you are the easiest person to fool.
     -- Richard Feynman.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to