歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

Linux下分區詳解之—Parted

通常我們用的比較多的一般都是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命令即可)

[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文件

Copyright © Linux教程網 All Rights Reserved