1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
How to get started with this program:
1. Type './configure'. This will configure ext2resize.
2. Type 'make'. This will compile ext2resize.
3. Create a filesystem to play with (as a file). It is necessary for
you to make the filesystem smaller than the underlying device you
created, else you will not be able to grow it (that's why we give
a size of 8193 to mke2fs when we create the filesystem):
[root@yourbox ext2resize]# dd if=/dev/zero of=testfilesystem bs=1k count=16385
16385+0 records in
16385+0 records out
[root@yourbox ext2resize]# /sbin/mke2fs testfilesystem 8193
mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09
testfilesystem is not a block special device.
Proceed anyway? (y,n) y
Linux ext2 filesystem format
Filesystem label=
2048 inodes, 8193 blocks
409 blocks (4.99%) reserved for the super user
First data block=1
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1 block group
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Writing inode tables: done
Writing superblock and filesystem accounting information: done
[root@yourbox ext2resize]#
4. Now, resize it! Let's enlarge it to 10000 blocks:
[root@yourbox ext2resize]# src/ext2resize -v testfilesystem 10000
ext2resize v1.1.15 - 2000/08/08 for EXT2FS 0.5b
new filesystem size 10000
relocating blocks....
...flushing buffer 1/block 8195
cache direct hits: 2, indirect hits: 0, misses: 1
[root@yourbox ext2resize]#
Now you have a resized filesystem (check with dumpe2fs -h testfilesystem)!
5. You can simply use ext2resize without the size arguement, and it will
resize the filesystem to match the exact size of your partition:
[root@yourbox ext2resize]# src/ext2resize -v testfilesystem
ext2resize v1.1.15 - 2000/08/08 for EXT2FS 0.5b
new filesystem size 16385
relocating blocks....
...flushing buffer 1/block 8195
direct hits: 6385, indirect hits: 0, misses: 2
[root@yourbox ext2resize]#
6. You can also use ext2resize to shrink the filesystem:
[root@yourbox ext2resize]# src/ext2resize -v testfilesystem 4096
ext2resize v1.1.15 - 2000/08/08 for EXT2FS 0.5b
new filesystem size 4096
relocating blocks....
...flushing buffer 2/block 3
direct hits: 8194, indirect hits: 2, misses: 4
[root@yourbox ext2resize]#
7. Online (mounted filesystem) resizing is exactly the same as offline
resizing. Simply use ext2online instead of ext2resize - the options
are all the same:
[root@yourbox ext2resize]# mount -o loop testfilesystem /mnt
[root@yourbox ext2resize]# src/ext2online -v /mnt 10240
ext2online v1.1.15 - 2000/08/08 for EXT2FS 0.5b
new filesystem size 10240
creating group 1 with 2047 blocks (rsvd = 0, newgd = 1)
ext2online: resizing to 10240 blocks
...flushing buffer 3/block 8196
direct hits: 2, indirect hits: 0, misses: 4
[root@yourbox ext2resize]#
8. Installing the new ext2resize tools to their final location is simply:
[root@yourbox ext2resize]# make install
[root@yourbox ext2resize]#
Lennert Buytenhek Andreas Dilger
<buytenh@gnu.org> <adilger@turbolinux.com>
|