fdisk

fdisk를 사용한 하드디스크 재파티션

fdisk [ -l ] [ -v ] [ -s partition ] [ device ]
  1. l 파티션 테이블의 목록을 출력한다.
  2. v fdisk 버젼을 출력한다.
  3. s partition DOS 파티션이 아니라면 해당 파티션의 크기를 출력한다.

<device> 에는 몇번째 하드디스크를 파티션할 것인 알려주어야 한다. 아래는 리눅스에서 각각의 디바이스들에 대한 이름이다.

 Device Name
 --- ---
 First floppy (A:) /dev/fd0
 Second floppy (B:) /dev/fd1
 First hard drive (entire drive) /dev/hda
 First hard drive, primary partition 1 /dev/hda1
 First hard drive, primary partition 2 /dev/hda2
 First hard drive, primary partition 3 /dev/hda3
 First hard drive, primary partition 4 /dev/hda4
 First hard drive, logical partition 1 /dev/hda5
 First hard drive, logical partition 2 /dev/hda6
 .
 .
 Second hard drive (entire drive) /dev/hdb
 Second hard drive, primary partition 1 /dev/hdb1
 .
 .
 First SCSI hard drive (entire drive) /dev/sda
 First SCSI hard drive, primary partition 1 /dev/sda1
 .
 .
 .
 Second SCSI hard drive (entire drive) /dev/sdb
 Second SCSI hard drive, primary partition 1 /dev/sdb1
 (and so on...)
 fdisk /dev/sde 

실행되면, `m' 명령어로 도움말을 볼 수 있다. 출력은 아래와 같다.

 Command action
 a toggle a bootable flag
 d delete a partition
 l list known partition types
 m print this menu
 n add a new partition
 p print the partition table
 q quit without saving changes
 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)

그럼, 파티션을 설정하는 순서대로 위의 명령을 설명한다.

`p' 파티션 정보를 출력한다. 아래의 내용은 이미 파티션이 설정된 한 예이다.

Disk /dev/hdb: 16 heads, 63 sectors, 665 cylinders Units = cylinders of 1008 * 512 bytes

Device Boot Begin Start End Blocks Id System /dev/hdb1 2 2 665 334656 5 Extended /dev/hdb5 * 2 2 630 316984+ 83 Linux native /dev/hdb6 631 631 665 17608+ 82 Linux swap

`n' 새로운 파티션을 생성한다. 아래의 내용이 출력된다.

l logical (5 or over) p primary partition(1-4)

리눅스는 logical이나 primary 파티션 모두 설치할 수 있다. 원하는 형태를 입력한후, 시작 실린터(또는 섹터)와 마지막 실린더의 값을 입력하면 된다.

`a' 파티션의 부팅 여부를 전환한다. 예제 중 `Boot' 란에 `*'가 표시된다.

`d' 파티션을 제거한다. 현재 생성되어 있는 파티션의 번호가 출력되며, 원하는 번호를 입력하여 파티션을 제거할 수 있다.

`l' 파티션의 형태를 출력한다.

일반적으로 사용되는 것은 아래와 같다.

6 DOS 16-bit >=32M 82 Linux swap 83 Linux native

`t' 파티션 시스템 형태(ID) 를 변경한다.

`v' 파티션 테이블을 검사한다. 파티션 생성에 에러가 있으면 그 메세지를 출력해준다.

`u' 실린더와 섹터의 단위를 서로 변환한다.

`m' 도움말을 출력한다.

`q' 설정한 파티션을 저장하지 않고 종료한다.

`w' 작성한 파티션 테이블의 정보를 저장하고 종료한다.

`x' 기타 다른 명령어 메뉴를 호출한다.(전문가만 사용)

파티션을 설정하였으면,`shutdown -r now'를 입력하여 다시 부팅 시킨다.

역링크