溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何理解redhat 6.5 parted磁盤分區(qū)工具

發(fā)布時間:2021-11-04 17:29:16 來源:億速云 閱讀:190 作者:柒染 欄目:建站服務(wù)器

本篇文章給大家分享的是有關(guān)如何理解redhat 6.5 parted磁盤分區(qū)工具,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

1,操作系統(tǒng)版本
[root@mygirl ~]# more /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@mygirl ~]# 


2,查看新增的磁盤
[root@mygirl ~]# fdisk -l|grep -i --color "/dev/sd"
Disk /dev/sda: 21.5 GB, 21474836480 bytes
/dev/sda1   *           1        2168    17408000   83  Linux
/dev/sda2            2168        2611     3562496   82  Linux swap / Solaris
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
/dev/sdb1               1        2610    20964793+  83  Linux
Disk /dev/sdc: 2147 MB, 2147483648 bytes


3,查看parted命令
[root@mygirl ~]# parted --help
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.


OPTIONs:
  -h, --help                      displays this help message
  -l, --list                      lists partition layout on all block devices
  -m, --machine                   displays machine parseable output
  -s, --script                    never prompts for user intervention
  -v, --version                   displays the version
  -a, --align=[none|cyl|min|opt]  alignment for new partitions


COMMANDs:
  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
[root@mygirl ~]# 


4,顯示所有磁盤分區(qū)信息


[root@mygirl ~]# parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type     File system     Flags
 1      1049kB  17.8GB  17.8GB  primary  ext4            boot
 2      17.8GB  21.5GB  3648MB  primary  linux-swap(v1)




Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  21.5GB  21.5GB  primary  ext4




Error: /dev/sdc: unrecognised disk label


5,可見parted默認是定位第一個磁盤/dev/sda
[root@mygirl ~]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type     File system     Flags
 1      1049kB  17.8GB  17.8GB  primary  ext4            boot
 2      17.8GB  21.5GB  3648MB  primary  linux-swap(v1)


(parted) quit                                                             
[root@mygirl ~]# 


6,根據(jù)上述第3個命令可見parted命令的用法以及上述命令的結(jié)構(gòu)分類
查看parted命令
[root@mygirl ~]# parted --help
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.




7,parted /dev/sdc可以定位指定的磁盤,然后help會顯示對應(yīng)的具體命令


[root@mygirl ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help                                                             
  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)     




8,查看mkpart創(chuàng)建分區(qū)的用法
(parted) help mkpart                                                      
  mkpart PART-TYPE [FS-TYPE] START END     make a partition


        PART-TYPE is one of: primary, logical, extended
        FS-TYPE is one of: ext4, ext3, ext2, fat32, fat16, hfsx, hfs+, hfs, jfs, swsusp, linux-swap(v1), linux-swap(v0), ntfs, reiserfs, hp-ufs, sun-ufs, xfs, apfs2, apfs1, asfs,
        amufs5, amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6, affs5, affs4, affs3, affs2, affs1, affs0, linux-swap, linux-swap(new), linux-swap(old)
        START and END are disk locations, such as 4GB or 10%.  Negative values count from the end of the disk.  For example, -1s specifies exactly the last sector.
        
        'mkpart' makes a partition without creating a new file system on the partition.  FS-TYPE may be specified to set an appropriate partition ID.
(parted)     




9,創(chuàng)建磁盤分區(qū),但報錯如下
(parted) mkpart primary                                                   
Error: /dev/sdc: unrecognised disk label  




10,據(jù)以上分析,可能還要進行其它的配置,查看mklabel命令
(parted) help mklabel                                                     
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)


        LABEL-TYPE is one of: aix, amiga, bsd, dvh, gpt, mac, msdos, pc98, sun, loop  






11,使用mklabel創(chuàng)建磁盤標簽
(parted) mklabel msdos  




12,無法預(yù)先知道開始及結(jié)束的柱面編號 
(parted) mkpart primary                                                   
File system type?  [ext2]? ext4                                           
Start? 1                                                                  
End?                                                                      
End?                                                                      
End?                                                                      
End? ^C                                                                   
(parted)    




(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start  End  Size  Type  File system  Flags




13,進行對比分析法獲取磁盤分區(qū)之開始及結(jié)束的含義
(parted) mkpart primary ext4 1 100




14,查看磁盤所有的磁盤分區(qū)信息,可見開始及結(jié)束是以M為單元的
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type     File system  Flags
 1      1049kB  99.6MB  98.6MB  primary




 15,使用rm 刪除某個磁盤分區(qū)
 (parted) rm 1 


 (parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start  End  Size  Type  File system  Flags


16,基于上述邏輯繼續(xù)創(chuàng)建多個磁盤分區(qū),可見主分區(qū)primary不能創(chuàng)建超過4個,如果創(chuàng)建第5個就會報錯
(parted) mkpart primary 1 300                                             
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size   Type     File system  Flags
 1      1049kB  300MB  299MB  primary




 (parted) mkpart primary 301 400
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type     File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary




(parted) mkpart primary 401 450                                           
(parted) mkpart primary 451 453                                           
(parted) mkpart primary 454 455                                           
Error: Can't create any more partitions.                                  
(parted)                




(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type     File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   453MB  2097kB  primary




17,不以基于第4個主分區(qū)primary創(chuàng)建邏輯分區(qū)或者擴展分區(qū)
(parted) help mkpart                                                      
  mkpart PART-TYPE [FS-TYPE] START END     make a partition


        PART-TYPE is one of: primary, logical, extended
        FS-TYPE is one of: ext4, ext3, ext2, fat32, fat16, hfsx, hfs+, hfs, jfs, swsusp, linux-swap(v1), linux-swap(v0), ntfs, reiserfs, hp-ufs, sun-ufs, xfs, apfs2, apfs1, asfs,
        amufs5, amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6, affs5, affs4, affs3, affs2, affs1, affs0, linux-swap, linux-swap(new), linux-swap(old)
        START and END are disk locations, such as 4GB or 10%.  Negative values count from the end of the disk.  For example, -1s specifies exactly the last sector.
        
        'mkpart' makes a partition without creating a new file system on the partition.  FS-TYPE may be specified to set an appropriate partition ID.
(parted)   




(parted) mkpart logical 455 480                                           
Error: Can't create any more partitions. 




(parted) mkpart extended 455 480                                          
Error: Can't create any more partitions.






18,可以基于第3個主分區(qū)然后馬上創(chuàng)建擴展分區(qū)extended
(parted) rm 4
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type     File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary




 (parted) mkpart extended 451 500
(parted)  


(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba




19,基于擴展分區(qū)創(chuàng)建的邏輯分區(qū)不能創(chuàng)建大小,否則會報錯如下影響性能,當(dāng)然你可以忽略這個提示
(parted) mkpart logical 452 480
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba
 5      452MB   480MB  28.3MB  logical




(parted) mkpart logical 481 483                                           
(parted) mkpart logical 484 486                                           
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore                                                     
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba
 5      452MB   480MB  28.3MB  logical
 6      481MB   483MB  2097kB  logical
 7      484MB   486MB  2000kB  logical


 (parted)                                                                  
(parted) mkpart logical 487 490                                           
(parted) mkpart logical 491 493                                           
(parted) mkpart logical 494 495
(parted) mkpart logical 496 497                                           
(parted) mkpart logical 498 499
(parted) print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba
 5      452MB   480MB  28.3MB  logical
 6      481MB   483MB  2097kB  logical
 7      484MB   486MB  2000kB  logical
 8      487MB   490MB  3146kB  logical
 9      491MB   493MB  2097kB  logical
10      494MB   495MB  1049kB  logical
11      496MB   497MB  1049kB  logical
12      498MB   499MB  1049kB  logical


20,可見擴展分區(qū)是父分區(qū),而邏輯分區(qū)是子分區(qū),即后者只能基于或依賴于前者,且后者邏輯分區(qū)的空間范圍只能位于所屬擴展分區(qū)的空間范圍
(parted) mkpart logical 500 501                                           
Warning: You requested a partition from 500MB to 501MB.                   
The closest location we can manage is 500MB to 500MB.
Is this still acceptable to you?
Yes/No? ys                                                                
parted: invalid token: ys
Yes/No? yes                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore                                                     
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba
 5      452MB   480MB  28.3MB  logical
 6      481MB   483MB  2097kB  logical
 7      484MB   486MB  2000kB  logical
 8      487MB   490MB  3146kB  logical
 9      491MB   493MB  2097kB  logical
10      494MB   495MB  1049kB  logical
11      496MB   497MB  1049kB  logical
12      498MB   499MB  1049kB  logical
13      500MB   500MB  512B    logical


(parted)         




21,好像不能創(chuàng)建多個擴展分區(qū)extended
(parted) mkpart extended 501 600
parted: invalid token: extended
Partition type?  [logical]? 


22,可見退出parted會自動保存上次parted操作的結(jié)果
(parted) quit                                                             
Information: You may need to update /etc/fstab.   




[root@mygirl ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type      File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary
 4      451MB   500MB  49.3MB  extended               lba
 5      452MB   480MB  28.3MB  logical
 6      481MB   483MB  2097kB  logical
 7      484MB   486MB  2000kB  logical
 8      487MB   490MB  3146kB  logical
 9      491MB   493MB  2097kB  logical
10      494MB   495MB  1049kB  logical
11      496MB   497MB  1049kB  logical
12      498MB   499MB  1049kB  logical
13      500MB   500MB  512B    logical


(parted)          




23,可見只要刪除擴展分區(qū),會一并把下屬的邏輯分區(qū)全部刪除
(parted) rm 4                                                             
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type     File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary




24,可見只能創(chuàng)建一個擴展分區(qū),不能創(chuàng)建多個擴展分區(qū)
(parted) mkpart extended 451 500                                          
(parted) mkpart extended 501 600                                          
parted: invalid token: extended
Partition type?  [logical]? logical                                       
File system type?  [ext2]? ext3                                           
Start? 451                                                                
End? 600                                                                  
Warning: You requested a partition from 451MB to 600MB.                   
The closest location we can manage is 451MB to 500MB.
Is this still acceptable to you?
Yes/No?     


25,由下可知,主分區(qū)為第1到第4,從第5之后為邏輯分區(qū)
(parted) rm 4
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End    Size    Type     File system  Flags
 1      1049kB  300MB  299MB   primary
 2      301MB   400MB  98.6MB  primary
 3      401MB   450MB  49.3MB  primary




(parted) mkpart extended 451 2147                                         
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type      File system  Flags
 1      1049kB  300MB   299MB   primary
 2      301MB   400MB   98.6MB  primary
 3      401MB   450MB   49.3MB  primary
 4      451MB   2147MB  1697MB  extended               lba




(parted) help mkfs                                                        
  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partition NUMBER


        NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the primary partitions number from 1 to 4, logical partitions from 5 onwards.
        FS-TYPE is one of: ext2, fat32, fat16, swsusp, linux-swap(v1), linux-swap(v0), linux-swap, linux-swap(new), linux-swap(old)
(parted)    




26,mkfs好像不能指定磁盤分區(qū)編號進行劃分文件系統(tǒng),而且可以指定的文件系統(tǒng)特別少,頂多到ext2,我分析可能是parted的版本太老了可能
(parted) mkfs 1  ext2                                                     
WARNING: you are attempting to use parted to operate on (mkfs) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Warning: The existing file system will be destroyed and all data on the partition will be lost. Do you want to continue?
parted: invalid token: 1
Yes/No? yes                                                               
Partition number? 1                                                       
File system type?  [ext2]? ext2                                           
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type      File system  Flags
 1      1049kB  300MB   299MB   primary   ext2
 2      301MB   400MB   98.6MB  primary
 3      401MB   450MB   49.3MB  primary
 4      451MB   2147MB  1697MB  extended               lba


(parted)                       




27,check 用于檢查磁盤分區(qū)的文件系統(tǒng),但parted不建議使用它,而應(yīng)使用e2fsck檢查文件系統(tǒng)
(parted) help check                                                       
  check NUMBER                             do a simple check on the file system


        NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the primary partitions number from 1 to 4, logical partitions from 5 onwards.
(parted)    


(parted) check 1                                                          
WARNING: you are attempting to use parted to operate on (check) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Information: The ext2 file system passed a basic check.  For a more comprehensive check, use the e2fsck program.
(parted)       


28,基于磁盤分區(qū)1的文件系統(tǒng)進行掛載目錄
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type      File system  Flags
 1      1049kB  300MB   299MB   primary   ext2
 2      301MB   400MB   98.6MB  primary
 3      401MB   450MB   49.3MB  primary
 4      451MB   2147MB  1697MB  extended               lba


(parted)   




[root@mygirl ~]# fdisk -l|grep "/dev/sdc"
Disk /dev/sdc: 2147 MB, 2147483648 bytes
/dev/sdc1               1          37      291840   83  Linux
/dev/sdc2              37          49       96256   83  Linux
/dev/sdc3              49          55       48128   83  Linux
/dev/sdc4              55         262     1656832    f  W95 Ext'd (LBA)
[root@mygirl ~]# 


[root@mygirl ~]# mkdir -p /test_dir
[root@mygirl ~]# mount /dev/sdc1 /test_dir
[root@mygirl ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        17G   16G   89M 100% /
tmpfs          1004M  112K 1004M   1% /dev/shm
/dev/sdc1       268M   13K  253M   1% /test_dir




29,基于msdos的分區(qū)類型,使用name對指定的磁盤分區(qū)重命名會報錯如下
[root@mygirl ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)  


(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos


Number  Start   End     Size    Type      File system  Flags
 1      1049kB  300MB   299MB   primary   ext2
 2      301MB   400MB   98.6MB  primary
 3      401MB   450MB   49.3MB  primary
 4      451MB   2147MB  1697MB  extended               lba


(parted)                    




(parted) help name                                                        
  name NUMBER NAME                         name partition NUMBER as NAME


        NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the primary partitions number from 1 to 4, logical partitions from 5 onwards.
        NAME is any word you want






(parted) name 2 part2                                                     
Error: msdos disk labels do not support partition names.                  
Error: msdos disk labels do not support partition names.                  
(parted)   






30,使用mklabel已經(jīng)配置了分區(qū)表后,然后再次執(zhí)行mklabel,之前的分區(qū)表以及磁盤分區(qū)信息全部會丟失,所以一定要小心仔細 


清除之前MSDOS的磁盤分區(qū)表,然后重新創(chuàng)建GPT磁盤分區(qū)表
(parted) help mklabel                                                     
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)


        LABEL-TYPE is one of: aix, amiga, bsd, dvh, gpt, mac, msdos, pc98, sun, loop
(parted) 




(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number  Start  End  Size  File system  Name  Flags


(parted)    




31,基于GPT磁盤分區(qū)表可以使用NAME命令,但好像我之前理解不對,這個名稱是對應(yīng)主分區(qū)PRIMARY之類的,而不是NUMBER對應(yīng)的信息
(parted) mkpart primary 1 100                                             
(parted) mkpart primary 101 200                                           
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number  Start   End     Size    File system  Name     Flags
 1      1049kB  99.6MB  98.6MB  ext2         primary
 2      101MB   200MB   99.6MB               primary


 (parted) name 2 part2                                                     
(parted) 


                                                    
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number  Start   End     Size    File system  Name     Flags
 1      1049kB  99.6MB  98.6MB  ext2         primary
 2      101MB   200MB   99.6MB               part2




32,mkfs還是不能使用ext3,只能使用ext2
(parted) help mkfs                                                        
  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partition NUMBER


        NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the primary partitions number from 1 to 4, logical partitions from 5 onwards.
        FS-TYPE is one of: ext2, fat32, fat16, swsusp, linux-swap(v1), linux-swap(v0), linux-swap, linux-swap(new), linux-swap(old)
(parted) 






(parted) mkfs 2 ext2                                                      
WARNING: you are attempting to use parted to operate on (mkfs) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Warning: The existing file system will be destroyed and all data on the partition will be lost. Do you want to continue?
parted: invalid token: 2
Yes/No? y                                                                 
Partition number? 2                                                       
File system type?  [ext2]? ext3                                           
No Implementation: Support for creating ext3 file systems is not implemented yet.
(parted) p                                                                
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number  Start   End     Size    File system  Name     Flags
 1      1049kB  99.6MB  98.6MB  ext2         primary
 2      101MB   200MB   99.6MB               part2




以上就是如何理解redhat 6.5 parted磁盤分區(qū)工具,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI