별의 공부 블로그 🧑🏻‍💻
728x90
728x170

fdisk

  • 디스크 파티션을 확인하고 추가/삭제하는 명령
  • 설정 후에는 반드시 재부팅해야 함.

 

fdisk 실행 예

  • fdisk 명령을 실행하면 텍스트 기반의 특정 명령어를 입력해야 파티션을 설정할 수 있다.
  • 처음 실행하면 Command (m for help): 가 나타나는데, m 을 누르면 사용 가능한 명령의 목록을 출력해준다.
# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help):

 

fdisk 실행 시 주요 명령

명령 설명
p 현재 디스크의 정보 출력(Print)
d 파티션 삭제(Delete)
n 파티션을 새롭게(Newly) 생성(추가)
t - 파티션의 속성 변경
- 주요 코드
▶ 82 : Swap
▶ 83 : Linux
▶ 8e : Linux LVM
▶ fd : Raid
w 변경된 파티션의 정보를 저장하고 종료
q 변경된 파티션의 정보를 저장하지 않고 종료

 

사용법

# fdisk [option] [장치명]

 

주요 옵션

옵션 설명
-l [장치파일명] - 지정한 장치 파일의 파티션 테이블 정보 출력
- 장치 파일명을 명시하지 않으면 /proc/partitions의 정보를 기반으로 장착된 디스크의 파티션 테이블 정보를 출력함.
-s partition - 특정 파티션의 크기(Size) 출력
- 단위 : block
-v fdisk의 버전(Version) 출력

 

사용 예

예 1
  • 장착된 디스크들의 파티션 테이블 정보 출력
# fdisk -l

 

예 2
  • /dev/sdb 디스크의 파티션 설정
# fdisk /dev/sdb

 

예 3
  • /dev/hda9 파티션 크기 출력
# fdisk -s /dev/sda9

 

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖