1. 程式人生 > >Linux parted命令詳解

Linux parted命令詳解

log end partprobe available not ner ext app file

parted常見命令參數

Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.

選項:
  -h, --help                      顯示此求助信息
  -l, --list                      lists partition layout on all block devices
  -m, --machine                   displays machine parseable output
  -s, --script                    從不提示用戶
  -v, --version                   顯示版本
  -a, --align=[none|cyl|min|opt]  alignment for new partitions

命令:
  align-check TYPE N                        check partition N for TYPE(min|opt)
        alignment
  check NUMBER                             do a simple check on the file system
  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
  help [COMMAND]                           print general help, or help on
        COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition
        table)
  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on
        partition 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 NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table,
        available devices, free space, all found partitions, or a particular
        partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START
        and END
  resize NUMBER START END                  resize partition NUMBER and its file
        system
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition
        NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and
        copyright information of GNU Parted

parted常見命令展示

.parted分區(pgt分區)     -->即時生效,創建了以後就直接產生,可以非交互是的創建
        --> 大於2T,且使用gpt(全局唯一標示磁盤分區表格式)的分區表
        --> MBR 的最大可循地址為2T
    1.  交互式:
        1.parted /dev/sdb mklabel gpt  -->更改分區表
             -->help寫出幫助
            mkpart primary 0 10         -->0-10M 主分區
            rm 2                        -->刪除,
        2.將修改後的內容告訴內核,否則需要重啟
            partprobe /dev/sdb
        3.查看
            ll /dev/sd*
            ==>fdick -l 
 
    2.  非交互是的創建
        1.創建
              parted /dev/sdb mklabel gpt yes
            parted /dev/sdb mklabel primary ext4 0 100 ignore
            parted /dev/sdb mklabel logic ext4 0 100 ignore
        2.將修改後的內容告訴內核,否則需要重啟
                partprobe /dev/sdb
            3.查看
                ll /dev/sd*
                ==>fdick –l

* 磁盤劃分結束後需要制作文件系統,例如 ext4

【更多參考】https://www.cnblogs.com/ftl1012/p/9280862.html

Linux parted命令詳解