制作网站问题和解决方法,太原做网站排名,中卫网站推广营销,官网申请通常我们用的比较多的一般都是fdisk工具来进行分区#xff0c;但是现在由于磁盘越来越廉价#xff0c;而且磁盘空间越来越大#xff1b;而fdisk工具他对分区是有大小限制的#xff0c;它只能划分小于2T的磁盘。但是现在的磁盘空间很多都已经是远远大于2T了#xff0c;甚至…通常我们用的比较多的一般都是fdisk工具来进行分区但是现在由于磁盘越来越廉价而且磁盘空间越来越大而fdisk工具他对分区是有大小限制的它只能划分小于2T的磁盘。但是现在的磁盘空间很多都已经是远远大于2T了甚至达到2.5T和3T那要怎么办能有两个方法其一是通过卷管理来实现其二就是通过我们今天谈到的Parted工具来实现对GPT磁盘进行分区操作。GPT格式的磁盘相当于原来MBR磁盘中原来保留4个partition table的4*16个字节,只留第一个16个字节类似于扩展分区真正的partitiontable在512字节之后GPT磁盘没有四个主分区的限制。1、 Parted工具详解1.1 进入Parted的方法在命令行输入Parted命令即可[rootjetsen ~]# partetWarning: Unable to open/dev/hdc read-write (Read-only file system). /dev/hdc has beenopened read-only.GNU Parted 1.8.1Using /dev/hdcWelcome to GNU Parted! Typehelp to view a list of commands.(parted)1.2 获取parted工具帮助的方法只需输入help即可(parted) help check NUMBER do a simple checkon the file systemcp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partitionhelp [COMMAND] prints general help,or help on COMMANDmklabel,mktable LABEL-TYPE create a new disklabel(partition table)mkfs NUMBER FS-TYPE make a FS-TYPE filesystem on partititonNUMBERmkpart PART-TYPE [FS-TYPE] START END make a partitionmkpartfs PART-TYPE FS-TYPE START END make a partition with a file systemmove NUMBER START END move partition NUMBERname NUMBER NAME name partition NUMBERas NAMEprint [free|NUMBER|all] display the partition table,a partition, orall devicesquit exit programrescue START END rescue a lostpartition near START and ENDresize NUMBER START END resize partition NUMBER andits file systemrm NUMBER deletepartition NUMBERselect DEVICE choose the deviceto editset NUMBER FLAG STATE change the FLAG onpartition NUMBERtoggle [NUMBER [FLAG]] toggle the state of FLAG onpartition NUMBERunit UNIT set the defaultunit to UNITversion displays thecurrent version of GNU Partedand copyright information(parted)或[rootjetsen ~]# parted--helpUsage: parted [OPTION]...[DEVICE [COMMAND [PARAMETERS]...]...]Apply COMMANDs withPARAMETERS to DEVICE. If no COMMAND(s)are given, run ininteractive mode.OPTIONs:-h, --help displays this help message-i, --interactive where necessary, prompts for userintervention-l, --list lists partition tables ofall detected devices-s, --script never prompts for userintervention-v, --version displays the versionCOMMANDs:check NUMBER do a simple checkon the file systemcp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partitionhelp [COMMAND] prints general help,or help on COMMANDmklabel,mktable LABEL-TYPE create a new disklabel(partition table)mkfs NUMBER FS-TYPE make a FS-TYPE filesystem on partititon NUMBERmkpart PART-TYPE [FS-TYPE] START END make a partitionmkpartfs PART-TYPE FS-TYPE START END make a partition with a file systemmove NUMBER START END move partition NUMBERname NUMBER NAME name partition NUMBERas NAMEprint [free|NUMBER|all] display the partition table, apartition, or all devicesquit exitprogramrescue START END rescue a lostpartition near START and ENDresize NUMBER START END resize partition NUMBER andits file systemrm NUMBER deletepartition NUMBERselect DEVICE choose the deviceto editset NUMBER FLAG STATE change the FLAG onpartition NUMBERtoggle [NUMBER [FLAG]] toggle the state of FLAG onpartition NUMBERunit UNIT set the defaultunit to UNITversion displays thecurrent version of GNU Parted and copyright information[rootjetsen ~]#1.3 退出parted工具只需输入quit即可(parted) quit Information: Dont forget to update /etc/fstab, if necessary. 并且同时会提示及时更新/etc/fstab文件2、 开始通过parted工具来对磁盘进行操作2.1 查看单个磁盘状态[rootjetsen ~]#parted /dev/sdbGNU Parted 1.8.1Using /dev/sdbWelcome to GNUParted! Type help to view a list of commands.(parted) p Model: VMware,VMware Virtual S (scsi)Disk /dev/sdb:16.1GBSector size(logical/physical): 512B/512BPartition Table:msdosNumber Start End Size Type File system Flags1 32.3kB 16.1GB 16.1GB primary ext3 (parted) 2.2 查看所有磁盘状态[rootjetsen ~]#parted -lWarning: Unable toopen /dev/hdc read-write (Read-only file system). /dev/hdc has beenopened read-only.Error: Unable toopen /dev/hdc - unrecognised disk label. Model: VMware,VMware Virtual S (scsi)Disk /dev/sda:21.5GBSector size(logical/physical): 512B/512BPartition Table:msdosNumber Start End Size Type File system Flags1 32.3kB 107MB 107MB primary ext3 boot2 107MB 21.5GB 21.4GB primary lvm Model: VMware,VMware Virtual S (scsi)Disk /dev/sdb:16.1GBSector size(logical/physical): 512B/512BPartition Table:msdosNumber Start End Size Type File system Flags1 32.3kB 16.1GB 16.1GB primary ext3 Model: VMware,VMware Virtual S (scsi)Disk /dev/sdc:16.1GBSector size(logical/physical): 512B/512BPartition Table:loopNumber Start End Size File system Flags1 0.00kB 16.1GB 16.1GB ext3 Error: Unable toopen /dev/sdd - unrecognised disk label. Error: Unable toopen /dev/sde - unrecognised disk label. Error: Unable toopen /dev/md0 - unrecognised disk label. 2.2 通过parted工具来创建大于2T的分区[rootjetsen ~]#parted /dev/sdeGNU Parted 1.8.1 ---Parted的软件版本号Using /dev/sde ---将执行下面操作盘Welcome to GNUParted! Type help to view a list of commands. –欢迎信息(parted) mklabel ----创建创建磁盘标签New disk labeltype? gpt(parted) p ----查看分区状态Model: VMware,VMware Virtual S (scsi)Disk /dev/sde:2190GBSector size(logical/physical): 512B/512BPartition Table:gptNumber Start End Size File system Name Flags(parted) mkpartPartition name? []? gpt2t ---指定分区名称File system type? [ext2]ext3 ----指定分区类型Start? 1 ---指定开始位置End? 2190GB ---指定结束位置(parted) P ----显示分区信息 Model: VMware, VMware Virtual S (scsi)Disk /dev/sde: 2190GBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 17.4kB 2190GB 2190GB gpt2t (parted) Q ---退出 Information: Dont forget to update /etc/fstab, if necessary. -----提示不要忘记更新/etc/fstab文件2.3 通过parted工具来实现单磁盘多分区[rootjetsen ~]#parted /dev/sddGNU Parted 1.8.1Using /dev/sddWelcome to GNUParted! Type help to view a list of commands.(parted) p ---列出分区信息Error:Unable to open /dev/sdd - unrecognised disk label. ----由于没有打上磁盘标签所以表现信息无法列出(parted)mklabel ----创建磁盘标签New disk labeltype? gpt ---输入磁盘表情名(parted) p ----再次列出磁盘分区Model: VMware,VMware Virtual S (scsi) ---显示磁盘类型为SCSI磁盘Disk /dev/sdd:1100GB ---磁盘大小为1100GBSector size(logical/physical): 512B/512B ---扇区大小为512BPartition Table:gpt ----显示标签名为我刚才输入的标签名称Number Start End Size File system Name Flags ----现在是一新硬盘还没有创建分区(parted)mkpart ---创建分区Partitionname? []? part1 ---指定分区名称File systemtype? [ext2]? ext2 ---定义分区类型Start? 1G ---指定起始位置End? 10G ----指定终止位置(parted)mkpart ---创建分区Partitionname? []? part2 ---指定分区名称File systemtype? [ext2]? ext2 ---定义分区类型Start? 11G ---指定起始位置End? 100G ---指定终止位置(parted)mkpart Partitionname? []? part3 File systemtype? [ext2]? Start? 101G ----指定分区其实位置End? -1 ----指定到分区最后 (parted) p ----显示分区信息Model: VMware,VMware Virtual S (scsi) Disk /dev/sdd:1100GBSector size (logical/physical):512B/512BPartition Table:gptNumber Start End Size File system Name Flags ---查看到下面共有三个分区1 17.4kB 10.0GB 10000MB part1 2 10.0GB 100GB 90.0GB part2 3 100GB 1100GB 1000GB part3 (parted) rm 3 ------删除分区3(parted) p ------再次查看分区状态 Model: VMware,VMware Virtual S (scsi)Disk /dev/sdd:1100GBSector size(logical/physical): 512B/512BPartition Table:gptNumber Start End Size File system Name Flags ----显示分区删除成功只剩下两个分区1 17.4kB 10.0GB 10000MB part1 2 10.0GB 100GB 90.0GB part2 (parted) quit Information: Dontforget to update /etc/fstab, if necessary. [rootjetsen ~]#ls -l /dev/sdd*brw-r----- 1 rootdisk 8, 48 May 10 16:48 /dev/sddbrw-r----- 1 rootdisk 8, 49 May 10 16:48 /dev/sdd1brw-r----- 1 rootdisk 8, 50 May 10 16:48 /dev/sdd2[rootjetsen ~]#2.3 通过parted工具来删除分区[rootjetsen ~]# parted /dev/sdeGNU Parted 1.8.1Using /dev/sdeWelcome to GNU Parted! Type help to view a list of commands.(parted) p Model: VMware, VMware Virtual S (scsi)Disk /dev/sde: 2190GBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 17.4kB 2190GB 2190GB gpt2t (parted) rm 1 ----删除分1号分区 (parted) p ----显示分区信息看如下是没有分区的 Model: VMware, VMware Virtual S (scsi)Disk /dev/sde: 2190GBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags(parted) q Information: Dont forget to update /etc/fstab, if necessary. [rootjetsen ~]#2.4 通过parted工具来创建文件系统[rootjetsen ~]#parted /dev/sdd -----选择要格式化的磁盘GNU Parted 1.8.1Using /dev/sddWelcome to GNUParted! Type help to view a list of commands.(parted) mkfs 2ext3 ----格式化的类型为ext3分区号为2-Warning: Theexisting file system will be destroyed and all data on the partition willbe lost. Do youwant to continue?parted: invalidtoken: 2Yes/No? yes ----再次确认是否格式化Partition number?2 -----再次输入磁盘分区号 File system? [ext2]? ----格式化的类型(parted) 查看格式化是否成功(parted) p -----查看文件系统是否被格式化Model: VMware,VMware Virtual S (scsi)Disk /dev/sdd:1100GBSector size(logical/physical): 512B/512BPartition Table:gptNumber Start End Size File system Name Flags1 17.4kB 10.0GB 10000MB part1 2 10.0GB 100GB 90.0GB ext2 part2 -------可以看到文件系统类型为ext2可确定文件系统已经被格式化了。(parted) 挂载刚才格式化后的文件系统[rootjetsen ~]#cd / -----退到根目录[rootjetsen /]#mkdir part2 -----创建part目录[rootjetsen /]#mount /dev/sdd2 /part2 -----将/dev/sdd2挂载到/part2[rootjetsen /]#df –h -----查看分区信息Filesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol0018G 5.8G 11G 35% //dev/sda1 99M 12M 82M 13% /boottmpfs 506M 4.0K 506M 1% /dev/shm/dev/sdd2 83G 52K 79G 1% /part2 ------可以看到已经被挂载上来 [rootjetsen /]#cd /part2[rootjetsenpart2]# mkdir 1111 ------并且可以访问[rootjetsenpart2]# ls1111 lostfound[rootjetsen part2]#删除和恢复分区[rootjetsen /]#umount /dev/sdd2 ----卸载分区[rootjetsen /]#parted /dev/sdd ---通过parted选择/dev/sdd磁盘进入操作GNU Parted 1.8.1Using /dev/sddWelcome to GNUParted! Type help to view a list of commands.(parted) rm 2 ------删除磁盘分区(parted) rescue -------对磁盘分区进行恢复Start? 10G End? 100G Information: A ext2 primary partitionwas found at 10.0GB - 100GB. Do youwant to addit to the partition table?Yes/No/Cancel? Yes ----告诉(parted) print Model: VMware, VMware Virtual S (scsi)Disk /dev/sdd: 1100GBSector size (logical/physical):512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 17.4kB 10.0GB 10000MB part1 2 10.0GB 100GB 90.0GB ext2 (parted)[rootjetsen/]# cd /part2 ----神奇吧数据也被恢复回来了[rootjetsenpart2]# ls1111 lostfound 2.6 通过parted工具来验证和维护文件系统及分区。验证文件系统的完整性(parted)check 1 Error:File system was not cleanly unmounted! You should run e2fsck. Modifyinganuncleanfile system could cause severe corruption.Ignore/Cancel?ignore Information:The ext2 file system passed a basic check. For a more comprehensive check,use thee2fsck program.(parted)