Linux下分区详解之—Parted


通常我们用的比较多的一般都是fdisk工具来进行分区,但是现在由于磁盘越来越廉价,而且磁盘空间越来越大;而fdisk工具他对分区是有大小限制的,它只能划分小于2T的磁盘。但是现在的磁盘空间很多都已经是远远大于2T了,甚至达到2.5T3T,那要怎么办能,有两个方法,其一是通过卷管理来实现,其二就是通过我们今天谈到的Parted工具来实现对GPT磁盘进行分区操作。

GPT格式的磁盘相当于原来MBR磁盘中原来保留4partition table4*16个字节,只留第一个16个字节,类似于扩展分区,真正的partitiontable512字节之后,GPT磁盘没有四个主分区的限制。

 

1、            Parted工具详解:

1.1    进入Parted的方法(在命令行输入Parted命令即可)

[root@jetsen ~]# partet

Warning: Unable to open/dev/hdc read-write (Read-only file system). /dev/hdc has been

opened read-only.

GNU Parted 1.8.1

Using /dev/hdc

Welcome to GNU Parted! Type'help' to view a list of commands.

(parted)

 

1.2    获取parted工具帮助的方法:(只需输入help即可)

(parted) help                                                            

  check NUMBER                             do a simple checkon the file system

  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition

  help [COMMAND]                           prints general help,or help on COMMAND

  mklabel,mktable LABEL-TYPE               create a new disklabel(partition table)

  mkfs NUMBER FS-TYPE                      make a FS-TYPE filesystem on partititon

        NUMBER

  mkpart PART-TYPE [FS-TYPE] START END     make a partition

  mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system

  move NUMBER START END                    move partition NUMBER

  name NUMBER NAME                         name partition NUMBERas NAME

  print [free|NUMBER|all]                  display the partition table,a partition, or

        all devices

  quit                                     exit program

  rescue START END                         rescue a lostpartition near START and END

  resize NUMBER START END                  resize partition NUMBER andits file system

  rm NUMBER                                deletepartition NUMBER

  select DEVICE                            choose the deviceto edit

  set NUMBER FLAG STATE                    change the FLAG onpartition NUMBER

  toggle [NUMBER [FLAG]]                   toggle the state of FLAG onpartition NUMBER

  unit UNIT                                set the defaultunit to UNIT

  version                                  displays thecurrent version of GNU Parted

        and copyright information

(parted)

 

[root@jetsen ~]# parted--help

Usage: parted [OPTION]...[DEVICE [COMMAND [PARAMETERS]...]...]

Apply COMMANDs withPARAMETERS to DEVICE.  If no COMMAND(s)are given, run in

interactive 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 version

 

COMMANDs:

  check NUMBER                             do a simple checkon the file system

  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition

  help [COMMAND]                           prints general help,or help on COMMAND

  mklabel,mktable LABEL-TYPE               create a new disklabel(partition table)

  mkfs NUMBER FS-TYPE                      make a FS-TYPE filesystem on partititon NUMBER

  mkpart PART-TYPE [FS-TYPE] START END     make a partition

  mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system

  move NUMBER START END                    move partition NUMBER

  name NUMBER NAME                         name partition NUMBERas NAME

  print [free|NUMBER|all]                  display the partition table, apartition, or all devices

  quit                                     exitprogram

  rescue START END                         rescue a lostpartition near START and END

  resize NUMBER START END                  resize partition NUMBER andits file system

  rm NUMBER                                deletepartition NUMBER

  select DEVICE                            choose the deviceto edit

  set NUMBER FLAG STATE                    change the FLAG onpartition NUMBER

  toggle [NUMBER [FLAG]]                   toggle the state of FLAG onpartition NUMBER

  unit UNIT                                set the defaultunit to UNIT

  version                                  displays thecurrent version of GNU Parted and copyright information

[root@jetsen ~]#

1.3    退出parted工具(只需输入quit即可)

(parted) quit                                                            

Information: Don't forget toupdate /etc/fstab, if necessary.                           

并且同时会提示及时更新/etc/fstab文件

  • 1
  • 2
  • 3
  • 4
  • 下一页

相关内容