本文共 9248 字,大约阅读时间需要 30 分钟。
resize2fs - ext2 file system resizer resize2fs 是 ext2 文件系统大小调整工具 可以扩大 可以缩小原ext2分区(当然 ext3只是多了 Journal的ext2 也可以) 需要注意的是 增大的话 起始柱面不能变 步骤就是: 先fdisk 调整分区 所谓调整 也就是删了相关的分区 再重建分区 最后在分区上再用 resize2fs 调整文件系统大小 所以一个概念 或者说对照就是 文件系统(file system)是在分区(Partition)基础上的# rpm -qf /sbin/resize2fse2fsprogs-1.32-15.1# rpm -qil e2fsprogsName : e2fsprogs Relocations: (not relocatable)Version : 1.32 Vendor: Red Hat, Inc.Release : 15.1 Build Date: Mon 04 Oct 2004 10:23:16 PM CSTInstall Date: Mon 17 Jan 2005 03:36:34 PM CST Build Host: tweety.build.redhat.comGroup : System Environment/Base Source RPM: e2fsprogs-1.32-15.1.src.rpmSize : 1069923 License: GPLSignature : DSA/SHA1, Thu 18 Nov 2004 05:35:43 AM CST, Key ID 219180cddb42a60ePackager : Red Hat, Inc. URL : http://e2fsprogs.sourceforge.net/Summary : Utilities for managing the second extended (ext2) filesystem.Description :The e2fsprogs package contains a number of utilities for creating,checking, modifying, and correcting any inconsistencies in secondextended (ext2) filesystems. E2fsprogs contains e2fsck (used torepair filesystem inconsistencies after an unclean shutdown), mke2fs(used to initialize a partition to contain an empty ext2 filesystem),debugfs (used to examine the internal structure of a filesystem, tomanually repair a corrupted filesystem, or to create test cases fore2fsck), tune2fs (used to modify filesystem parameters), and most ofthe other core ext2fs filesystem utilities.You should install the e2fsprogs package if you need to manage theperformance of an ext2 filesystem./lib/evms/libe2fsim.1.2.1.so/lib/libcom_err.so.2/lib/libcom_err.so.2.0/lib/libe2p.so.2/lib/libe2p.so.2.3/lib/libext2fs.so.2/lib/libext2fs.so.2.4/lib/libss.so.2/lib/libss.so.2.0/lib/libuuid.so.1/lib/libuuid.so.1.2/sbin/badblocks/sbin/debugfs/sbin/dumpe2fs/sbin/e2fsck/sbin/e2image/sbin/e2label/sbin/findfs/sbin/fsck/sbin/fsck.ext2/sbin/fsck.ext3/sbin/mke2fs/sbin/mkfs.ext2/sbin/mkfs.ext3/sbin/resize2fs/sbin/tune2fs/usr/bin/chattr/usr/bin/lsattr/usr/bin/uuidgen/usr/sbin/mklost+found/usr/share/doc/e2fsprogs-1.32/usr/share/doc/e2fsprogs-1.32/README/usr/share/doc/e2fsprogs-1.32/RELEASE-NOTES/usr/share/man/man1/chattr.1.gz/usr/share/man/man1/lsattr.1.gz/usr/share/man/man1/uuidgen.1.gz/usr/share/man/man3/libuuid.3.gz/usr/share/man/man3/uuid_clear.3.gz/usr/share/man/man3/uuid_compare.3.gz/usr/share/man/man3/uuid_copy.3.gz/usr/share/man/man3/uuid_generate.3.gz/usr/share/man/man3/uuid_generate_random.3.gz/usr/share/man/man3/uuid_generate_time.3.gz/usr/share/man/man3/uuid_is_null.3.gz/usr/share/man/man3/uuid_parse.3.gz/usr/share/man/man3/uuid_time.3.gz/usr/share/man/man3/uuid_unparse.3.gz/usr/share/man/man8/badblocks.8.gz/usr/share/man/man8/debugfs.8.gz/usr/share/man/man8/dumpe2fs.8.gz/usr/share/man/man8/e2fsck.8.gz/usr/share/man/man8/e2image.8.gz/usr/share/man/man8/e2label.8.gz/usr/share/man/man8/findfs.8.gz/usr/share/man/man8/fsck.8.gz/usr/share/man/man8/fsck.ext2.8.gz/usr/share/man/man8/fsck.ext3.8.gz/usr/share/man/man8/mke2fs.8.gz/usr/share/man/man8/mkfs.ext2.8.gz/usr/share/man/man8/mkfs.ext3.8.gz/usr/share/man/man8/mklost+found.8.gz/usr/share/man/man8/resize2fs.8.gz/usr/share/man/man8/tune2fs.8.gz# fdisk /dev/sdbThe number of cylinders for this disk is set to 8924.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)Command (m for help): pDisk /dev/sdb: 73.4 GB, 73407868928 bytes255 heads, 63 sectors/track, 8924 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 * 1 522 4192933+ 82 Linux swap/dev/sdb2 523 783 2096482+ 83 Linux/dev/sdb3 784 1436 5245222+ 83 Linux/dev/sdb4 1437 8924 60147360 f Win95 Ext'd (LBA)/dev/sdb5 1437 8924 60147328+ 83 LinuxCommand (m for help): dPartition number (1-5): 3Command (m for help): pDisk /dev/sdb: 73.4 GB, 73407868928 bytes255 heads, 63 sectors/track, 8924 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 * 1 522 4192933+ 82 Linux swap/dev/sdb2 523 783 2096482+ 83 Linux/dev/sdb4 1437 8924 60147360 f Win95 Ext'd (LBA)/dev/sdb5 1437 8924 60147328+ 83 LinuxCommand (m for help): dPartition number (1-5): 2Command (m for help): nCommand action l logical (5 or over) p primary partition (1-4)pPartition number (1-4): 2First cylinder (523-8924, default 523):Using default value 523Last cylinder or +size or +sizeM or +sizeK (523-1436, default 1436):Using default value 1436Command (m for help): pDisk /dev/sdb: 73.4 GB, 73407868928 bytes255 heads, 63 sectors/track, 8924 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 * 1 522 4192933+ 82 Linux swap/dev/sdb2 523 1436 7341705 83 Linux/dev/sdb4 1437 8924 60147360 f Win95 Ext'd (LBA)/dev/sdb5 1437 8924 60147328+ 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.# resize2fs -p /dev/sdb2 7341705resize2fs 1.32 (09-Nov-2002)The containing partition (or device) is only 1835426 blocks.You requested a new size of 7341705 blocks.Syncing disks.# resize2fs 1.32 (09-Nov-2002)The containing partition (or device) is only 1835426 blocks.You requested a new size of 7341705 blocks.Syncing disks.# e2fsck -f /dev/sdb2e2fsck 1.32 (09-Nov-2002)Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/var: 599/262144 files (4.5% non-contiguous), 74698/524120 blocks# resize2fs -p /dev/sdb2resize2fs 1.32 (09-Nov-2002)Begin pass 1 (max = 40)Extending the inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXThe filesystem on /dev/sdb2 is now 1835008 blocks long.然后 mount 上 ls 一下 就发现 原来 sdb2 的区大了 还有 sdb3 的东西也在RESIZE2FS(8) RESIZE2FS(8)NAME resize2fs - ext2 file system resizerSYNOPSIS resize2fs [ -d debug-flags ] [ -f ] [ -F ] [ -p ] device [ size ]DESCRIPTION The resize2fs program will resize ext2 file systems. It can be used to enlarge or shrink an ext2 file system located on device so that it will have size blocks. If the size parameter is not specified, it will default to the size of the partition. The size parameter may never be larger than the size of the partition. The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a filesystem, you must first make sure you can expand the size of the underlying partition first. This can be done using fdisk(8) by deleting the partition and recreating it with a larger size. When recreating the partition, make sure you create it with the same starting disk cylinder as before! Otherwise, the resize operation will certainly not work, and you may lose your entire filesystem. If you wish to shrink an ext2 partition, first use resize2fs to shrink the size of filesystem. Then you may use fdisk(8) to shrink the size of the partition. When shrinking the size of the partition, make sure you do not make it smaller than the new size of the ext2 filesystem!OPTIONS -d debug-flags Turns on various resize2fs debugging features, if they have been compiled into the binary. debug-flags should be computed by adding the numbers of the desired features from the following list: 1 - Print out all disk I/O 2 - Debug block relocations 8 - Debug inode relocations 16 - Debug moving the inode table -p Prints out a percentage completion bars for each resize2fs oper- ation, so that the user can keep track of what the program is doing. -f Forces resize2fs to proceed with the filesystem resize opera- tion, overriding some safety checks which resize2fs normally enforces. -F Flush the filesystem device's buffer caches before beginning. Only really useful for doing resize2fs time trials.AUTHOR resize2fs was written by Theodore Ts'o .COPYRIGHT Resize2fs is Copyright 1998 by Theodore Ts'o and PowerQuest, Inc. All rights reserved. As of April, 2000 Resize2fs may be redistributed under the terms of the GPL.SEE ALSO fdisk(8), e2fsck(8), mke2fs(8)E2fsprogs version 1.32 November 2002 RESIZE2FS(8)转载自:http://windtear.net/archives/2005/09/14/000771.html