或者有其它什么方法可以在不破坏现有文件系统的前提下增减/修改分区.
wwwzc 回复于:2003-07-04 16:52:26 |
我找到一个好用的工具parted, 可以在不破坏数据的情况下修改分区大小, 很好用的. [root@linuxdxp root]# parted GNU Parted 1.6.3 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Using /dev/hda Information: The operating system thinks the geometry on /dev/hda is 4865/255/63. Therefore, cylinder 1024 ends at 8032.499M. (parted) help check MINOR do a simple check on the filesystem cp [FROM-DEVICE] FROM-MINOR TO-MINOR copy filesystem to another partition help [COMMAND] prints general help, or help on COMMAND mklabel LABEL-TYPE create a new disklabel (partition table) mkfs MINOR FS-TYPE make a filesystem FS-TYPE on partititon MINOR mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a filesystem move MINOR START END move partition MINOR name MINOR NAME name partition MINOR NAME print [MINOR] display the partition table, or a partition quit exit program rescue START END rescue a lost partition near START and END resize MINOR START END resize filesystem on partition MINOR rm MINOR delete partition MINOR select DEVICE choose the device to edit set MINOR FLAG STATE change a flag on partition MINOR (parted) check MINOR Error: Expecting a partition number. (parted) pr Disk geometry for /dev/hda: 0.000-38162.250 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 18998.745 primary ext3 boot 2 18998.745 19994.963 primary linux-swap 3 20002.808 37142.468 extended lba 5 20002.838 37142.468 logical ntfs 4 37142.468 38162.219 primary fat32 hidden, lba (parted) qu Information: Don't forget to update /etc/fstab, if necessary. |
老波 回复于:2003-07-04 17:05:27 |
wwwzc 回复于:2003-07-22 09:11:19 |
有人想要相关东东, 我顶一下。 |
衍水狂客 回复于:2003-07-22 09:20:17 |
用Linux的安装光盘,那里不是有个叫Druid的东西吗??? |
wwwzc 回复于:2003-07-22 17:02:45 |
一个使用实例: f2cdln04:/ # swapoff -a (我要对swap分区动手) f2cdln04:/ # rpm -hiv /tmp/parted-1.6.3-40.i586.rpm parted ################################################## f2cdln04:/ # parted GNU Parted 1.6.3 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Using /dev/sda Information: The operating system thinks the geometry on /dev/sda is 4425/255/63. Therefore, cylinder 1024 ends at 8032.499M. (parted) print (查看当前分区情况) Disk geometry for /dev/sda: 0.000-34715.156 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 23.532 primary ext2 boot, type=83 2 23.533 666.760 primary linux-swap type=82 3 666.760 34710.754 primary ext2 type=83 (parted) resize 2 23 500 (修改swap分区大小) (parted) print (确定新分区情况) Disk geometry for /dev/sda: 0.000-34715.156 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 23.532 primary ext2 boot, type=83 2 23.533 502.031 primary linux-swap type=82 3 666.760 34710.754 primary ext2 type=83 (parted) mkpartfs primary ext2 502 666 (建立新分区) (parted) print (确定新分区情况) Disk geometry for /dev/sda: 0.000-34715.156 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 23.532 primary ext2 boot, type=83 2 23.533 502.031 primary linux-swap type=82 4 502.031 666.760 primary ext2 type=83 3 666.760 34710.754 primary ext2 type=83 (parted) quit Information: Don't forget to update /etc/fstab, if necessary. f2cdln04:/ # fdisk -l Disk /dev/sda: 255 heads, 63 sectors, 4425 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 3 24066 83 Linux /dev/sda2 4 64 489982+ 82 Linux swap /dev/sda3 86 4425 34861050 83 Linux /dev/sda4 65 85 168682+ 83 Linux Partition table entries are not in disk order f2cdln04:/ # mkfs.ext2 --help mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09 mkfs.ext2: invalid option -- - Usage: mkfs.ext2 [-c|-t|-l filename] [-b block-size] [-f fragment-size] [-i bytes-per-inode] [-N number-of-inodes] [-m reserved-blocks-percentage] [-o creator-os] [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] [-O feature[,...]] [-r fs-revision] [-R raid_opts] [-s sparse-super-flag] [-qvSV] device [blocks-count] f2cdln04:/ # mkfs.ext2 /dev/sda4 (格式化分区) mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09 Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 42336 inodes, 168682 blocks 8434 blocks (5.00%) reserved for the super user First data block=1 21 block groups 8192 blocks per group, 8192 fragments per group 2016 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Writing superblocks and filesystem accounting information: done f2cdln04:/ # mkdir /csmserver f2cdln04:/ # mount /dev/sda4 /csmserver f2cdln04:/ # df Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda3 34313960 935664 31635244 3% / /dev/sda4 163335 13 154888 1% /csmserver f2cdln04:/ # |
wwwzc 回复于:2003-07-23 13:18:59 |
parted 在各版Linux光盘下分别在如下目录: (SLES 7.2 下没有, 不过装上SLES 8 下的包也能用) ./SLES8/UnitedLinux-1.0-i386-RC5-CD1/UnitedLinux/i586/parted-1.6.3-40.i586.rpm ./SLES8/UnitedLinux-1.0-i386-RC5-CD3/UnitedLinux/src/parted-1.6.3-40.src.rpm ./SuSE8.0/suse-8.0prof-en-i386-cd4/suse/ap4/parted-1.4.18-0.i386.rpm ./SuSE8.0/suse-8.0prof-en-i386-cd6/suse/zq2/parted-1.4.18-0.src.rpm ./Redhat8.0/rh-8.0-i386-en-cd1/RedHat/RPMS/parted-1.4.24-6.i386.rpm ./Redhat8.0/rh-8.0-i386-en-cd4/SRPMS/parted-1.4.24-6.src.rpm ./SuSE8.1/suse-8.1prof-en-i386-cd1/suse/i586/parted-1.6.3-22.i586.rpm ./SuSE8.1/suse-8.1prof-en-i386-cd7/suse/src/parted-1.6.3-22.src.rpm ./SuSE7.3/suse-7.3prof-en-i386-cd2/full-names/i386/parted-1.4.18-0.i386.rpm ./SuSE7.3/suse-7.3prof-en-i386-cd2/suse/ap2/parted.rpm ./SuSE7.3/suse-7.3prof-en-i386-cd2/suse/ap2/parted-devel.rpm ./SuSE7.3/suse-7.3prof-en-i386-cd7/full-names/src/parted-1.4.18-0.src.rpm ./Redhat7.3/rh-7.3-en-i386-cd1/RedHat/RPMS/parted-1.4.24-3.i386.rpm ./SuSE8.2/SuSE-8.2-Prof-i386-RC2-CD1/suse/i586/parted-1.6.5-9.i586.rpm ./RedHat9.0/shrike-i386-disc1/RedHat/RPMS/parted-1.6.3-11.i386.rpm ./RedHat9.0/shrike-i386-disc6/SRPMS/parted-1.6.3-11.src.rpm |
jerrycelia 回复于:2003-07-23 16:46:04 |
linux 自身的fdisk很好用啊 |
wgj 回复于:2003-07-27 17:54:59 |
动态分区哟!! |
leafboy 回复于:2003-09-06 03:38:52 |
Parted使用者一定要注意,不要对已经mount的分区使用。否则会出现问题!!! |
文章来源于领测软件测试网 https://www.ltesting.net/