parted 디스크 파티션 및 GPT

11513 단어 partedGPT
parted 디스크 섹션 방식: 일반적으로 우리가 사용하는 비교적 많은 것은 fdisk 도구로 섹션을 나누지만 지금은 디스크가 갈수록
값이 싸고 디스크 공간이 점점 커진다.fdisk 도구는 구역에 대한 크기 제한이 있기 때문에 2T 이하의 디스크만 구분할 수 있습니다.그렇지만
현재 디스크 공간의 대부분은 이미 2T보다 훨씬 크고 심지어 2.5T와 3T에 이르기까지 Parted 도구를 통해 GPT에 대한 자성을 실현해야 한다
디스크가 파티션 작업을 수행합니다.
GUID 디스크 분할 테이블
실체 하드디스크의 구분표의 구조 구조의 표준확장 가능한 펌웨어 인터페이스 표준(Intel에서 개인용 컴퓨터를 대체하는
BIOS)의 일부로, 논리 블록 주소와 크기 정보를 저장하기 위해 BIOS 시스템의 32bits를 대체하는 주 전원 켜기 기록(MBR)
파티션 테이블.
GPT 형식의 디스크는 원래 MBR 디스크에 4개의partition table의 4*16 바이트를 보존하고 첫 번째 16 글자만 남긴 것과 같다
섹션, 확장 섹션과 유사합니다. 진정한partitiontable는 512바이트 이후 GPT 디스크에 4개의 주 섹션의 제한이 없습니다.
parted 명령 설명
 
사용예: parted[옵션]...[장치 [명령 [매개 변수]...]  
매개변수가 있는 명령을 장치에 적용합니다."명령"을 주지 않으면 상호작용 모드로 실행됩니다. 
도움말 옵션:
-h, --help 도움말 정보 표시
-l, --list 모든 디바이스에 대한 파티션 정보 표시
-i, --interactive가 필요할 때 알림
-s, --script는 사용자에게 알리지 않음
-v, -version 디스플레이 버전
                      
help # 일반 도움말 정보 또는 COMMAND 정보 인쇄
mklabel 태그 유형 # 새 디스크 태그 만들기 (파티션 테이블)
mkfs 파일 시스템 유형 만들기 # 파일 시스템 유형 만들기
mkpart 파티션 유형 [파일 시스템 유형] #파티션 만들기
mkpartfs 파티션 유형 파일 시스템 유형 # 파일 시스템이 있는 파티션 만들기
move 시작점 끝점 # 번호가 인 파티션 이동
이름 # 번호가 인 파티션의 이름을 "이름"으로 지정합니다.
print # 인쇄 파티션 테이블 또는 파티션
quit # 프로그램 종료
rescue 시작점 끝점 #'시작점','끝점'에 가까운 잃어버린 구역 구하기
resize 시작점 끝점 #번호가 인 파티션의 파일 시스템 크기 변경
rm# MINOR 번호 파티션 삭제
select 장치 #편집할 장치 선택
set 플래그 상태 # 번호가 인 파티션의 플래그 변경
작업:
1. 사용 방법
1.1 Parted 시작 방법(명령줄에 Parted 명령을 입력하면 됨)
[root@localhost /]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

1.2 parted 도구 도움말을 얻는 방법: (help만 입력하면 됨)
(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)

…………
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

…………
-h, --help 도움말 정보 표시
-l, --list 모든 디바이스에 대한 파티션 정보 표시
-i, --interactive가 필요할 때 알림
-s, --script는 사용자에게 알리지 않음
-v, -version 디스플레이 버전
이것은 fdisk와 기본적으로 일치합니다. 명령 메뉴 내부에 명령을 입력하십시오.
1.3 parted 도구 종료(quit만 입력하면 됨)
(parted) quit                                                             
[root@localhost /]#

2. parted 도구를 통해 디스크를 조작한다
  
2.1 단일 디스크 상태 보기 parted/dev/sdc (추가 하드디스크 c를 사용합니다)
[root@localhost ~]# ll /dev
......
brw-rw---- 1 root disk      8,   0 Mar 13 21:13 sda
brw-rw---- 1 root disk      8,   1 Mar 13 21:13 sda1
brw-rw---- 1 root disk      8,   2 Mar 13 21:13 sda2
brw-rw---- 1 root disk      8,  16 Mar 13 21:15 sdb
brw-rw---- 1 root disk      8,  17 Mar 13 21:13 sdb1
brw-rw---- 1 root disk      8,  18 Mar 13 21:13 sdb2
brw-rw---- 1 root disk      8,  19 Mar 13 21:13 sdb3
brw-rw---- 1 root disk      8,  20 Mar 13 21:13 sdb4
brw-rw---- 1 root disk      8,  21 Mar 13 21:13 sdb5
brw-rw---- 1 root disk      8,  22 Mar 13 21:13 sdb6
brw-rw---- 1 root disk      8,  32 Mar 13 21:13 sdc
......
[root@localhost ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

 
2.2 종료 후 실행: parted -l, 모든 디스크의 상태 표시
[root@localhost ~]# parted -l
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 129GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  211MB   210MB   primary  ext4         boot
 2      211MB   64.6GB  64.4GB  primary               lvm


Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

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

2.3 parted 도구를 사용하여 2T 이상의 파티션 만들기
[root@localhost ~]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

디스크 탭 생성
(parted) mklabel
New disk label type? gpt      #                                             
(parted) p                                                                
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1095GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted)

mkpart 명령을 사용하여 파티션 구성 및 파일 시스템 유형 설정
(parted) mkpart
Partition name?  []? gpt2     #                                              
File system type?  [ext2]? ext3 #      
Start? 1                         #                                             
End? 300G                      ,                                               
(parted) p                 #                                                   
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1095GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  300GB  300GB               gpt2
(parted) Q                                       #                           
Information: You may need to update /etc/fstab.  #      /etc/fstab

mkpart 명령을 통해 여러 개의 구역을 만들 수 있습니다. 파트 1, 파트 2, 파트 3...
(parted) mkpart                                                           
Partition name?  []? gpt2                                                 
File system type?  [ext2]? ext4                                           
Start? 300G                                                               
End? 600G                                                                 
(parted) mkpart
Partition name?  []? gpt3                                                 
File system type?  [ext2]? ext4                                           
Start? ^C                                                                 
(parted) mkpart                                                           
Partition name?  []? gpt3                                                 
File system type?  [ext2]? xfs                                            
Start? 600                                                                
End? -1                                                                   
Warning: You requested a partition from 600MB to 1095GB.  #                  
The closest location we can manage is 600GB to 1095GB.
Is this still acceptable to you?
Yes/No? n                                                                 
(parted) mkpart
Partition name?  []? gpt3                                                 
File system type?  [ext2]? xfs         #     XFS                                   
Start? 600G                                                               
End? -1                                                                   
(parted) p                                                                
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1095GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size   File system  Name  Flags
 1      1049kB  300GB   300GB               gpt2
 2      300GB   600GB   300GB               gpt2
 3      600GB   1095GB  495GB               gpt3

(parted)                #     

파티션을 제거하려면 parted를 사용하십시오.

Number  Start   End     Size   File system  Name  Flags
 1      1049kB  300GB   300GB               gpt2
 2      300GB   600GB   300GB               gpt2
 3      600GB   1095GB  495GB               gpt3

(parted) rm 3                                                            
(parted) p                                                                
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1095GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  300GB  300GB               gpt2
 2      300GB   600GB  300GB               gpt2

(parted)

parted 도구를 사용하여 파일 시스템을 만들려면 다음과 같이 하십시오.
(parted) mkfs 2ext3                                                       
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: 2ext3
Yes/No? y                                                                 
Partition number? 2                                                       
File system type?  [ext2]? ext3                                           
No Implementation: Support for creating ext3 file systems is not implemented yet.
(parted) mkfs 2ext2                                                       
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: 2ext2
Yes/No? y                                                                 
Partition number? 2                                                       
File system type?  [ext2]?

위에 범한 몇 가지 잘못이 있는데, 나도 안에 열거하여 고치다
fdisk 마운트에 관해서는 정말 쓰기 싫습니다. mount umount 명령으로 주의해야 할 것: 첫째, 미리 존재하는 항목이 필요합니다.
녹화, 둘째, 이 디렉터리는 나중에 사용하지 않는 것이 가장 좋다. 셋째, 디렉터리에 파일이 있으면 숨겨질 수 있다
주의: fdisk보다 여러 가지 기능이 있습니다. 삭제된 구역을 복구할 수 있습니다
rm 2
rescue   #                ,             

check 명령 사용:
check 1 # 파티션 검사
(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.
Error: Could not detect file system.                                      
(parted)

좋은 웹페이지 즐겨찾기