프린트 하기

OS 환경 : Oracle Linux 8.7 (64bit)

 

방법 : Oracle Linux 8 디스크 파티션 나누기

본문에서는 오라클 리눅스 8에서 디스크 삽입 후 fdisk 명령으로 파티션을 나누는 방법을 설명함
현재 os에 110gb의 디스크를 마운트해둔 상태임
참고로 기본(MBR) 파티션 방식에서는 메인(Primary) 파티션은 최대 4개까지만 생성 가능함
그래서 10GB씩 4개만 만들면 40GB까지만 사용 가능함
만약 더 나누고 싶은 경우 4번째는 Extended 파티션으로 만들어서
이 Extended 영역 안에 Logical 파티션을 여러 개 생성하는 방식으로 파티션을 더 나눌 수 있음
본문에서는 메인 파티션은 10GB로 3개를 만들고 네번째 파티션은 Extended로 생성후 5gb씩 logical 파티션을 더 생성할 예정임

 

 

fdisk -l로 디스크 확인

1
2
3
4
5
6
7
# fdisk -l /dev/sdc
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06

현재 110Gib 용량의 디스크인 /dev/sdc가 존재함

 

 

파티션 나누기

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# fdisk /dev/sdc
 
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-230686719, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-230686719, default 230686719): +10G
 
Created a new partition 1 of type 'Linux' and of size 10 GiB.

순서대로 n, p, 1, 엔터, +10G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성
p : primary 파티션을 생성
1 : 파티션의 번호를 1로 지정(4까지 지정가능)
엔터 : 1번 파티션에서 사용할 초기 섹터를 지정
+10G : 초기섹터부터 10G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot Start      End  Sectors Size Id Type
/dev/sdc1        2048 20973567 20971520  10G 83 Linux

현재 /dev/sdc1이 10G 크기로 생성됨

 

 

이어서 다시한번 2번 파티션 10G로 생성 후 확인

1
2
3
4
5
6
7
8
9
10
Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (20973568-230686719, default 20973568):
Last sector, +sectors or +size{K,M,G,T,P} (20973568-230686719, default 230686719): +10G
 
Created a new partition 2 of type 'Linux' and of size 10 GiB.

순서대로 n, p, 2, 엔터, +10G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성
p : primary 파티션을 생성
2 : 파티션의 번호를 2로 지정(4까지 지정가능)
엔터 : 2번 파티션에서 사용할 초기 섹터를 지정
+10G : 초기섹터부터 10G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start      End  Sectors Size Id Type
/dev/sdc1           2048 20973567 20971520  10G 83 Linux
/dev/sdc2       20973568 41945087 20971520  10G 83 Linux

정상적으로 생성됨

 

 

이어서 다시한번 3번 파티션 10G로 생성 후 확인

1
2
3
4
5
6
7
8
9
10
Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (41945088-230686719, default 41945088):
Last sector, +sectors or +size{K,M,G,T,P} (41945088-230686719, default 230686719): +10G
 
Created a new partition 3 of type 'Linux' and of size 10 GiB.

순서대로 n, p, 3, 엔터, +10G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성
p : primary 파티션을 생성
3 : 파티션의 번호를 3으로 지정(4까지 지정가능)
엔터 : 3번 파티션에서 사용할 초기 섹터를 지정
+10G : 초기섹터부터 10G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
12
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start      End  Sectors Size Id Type
/dev/sdc1           2048 20973567 20971520  10G 83 Linux
/dev/sdc2       20973568 41945087 20971520  10G 83 Linux
/dev/sdc3       41945088 62916607 20971520  10G 83 Linux

정상적으로 생성됨

 

 

이어서 다시한번 4번 파티션 10G로 생성 후 확인

1
2
3
4
5
6
7
8
9
10
11
Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): p
 
Selected partition 4
First sector (62916608-230686719, default 62916608):
Last sector, +sectors or +size{K,M,G,T,P} (62916608-230686719, default 230686719): +10G
 
Created a new partition 4 of type 'Linux' and of size 10 GiB.

순서대로 n, p, 4, 엔터, +10G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성
p : primary 파티션을 생성
4 : 파티션의 번호를 4로 지정(4까지 지정가능)
엔터 : 4번 파티션에서 사용할 초기 섹터를 지정
+10G : 초기섹터부터 10G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start      End  Sectors Size Id Type
/dev/sdc1           2048 20973567 20971520  10G 83 Linux
/dev/sdc2       20973568 41945087 20971520  10G 83 Linux
/dev/sdc3       41945088 62916607 20971520  10G 83 Linux
/dev/sdc4       62916608 83888127 20971520  10G 83 Linux

정상적으로 생성됨

 

 

이어서 추가 파티션 생성 시도

1
2
3
Command (m for help): n
To create more partitions, first replace a primary with an extended partition.
"To create more partitions, first replace a primary with an extended partition." 메세지가 발생하면서 더이상 파티션이 만들어지지 않음

 

 

4번 primary 파티션 제거(d 입력 후 파티션 번호 4 입력)

1
2
3
4
Command (m for help): d
Partition number (1-4, default 4): 4
 
Partition 4 has been deleted.

4번 파티션이 정상적으로 제거됨
명령어 설명 :
d : 파티션 제거 선택페이지로 이동
4 : 4번 파티션 제거

 

 

이번에는 extended 파티션 생성

1
2
3
4
5
6
7
8
9
10
11
Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): e
 
Selected partition 4
First sector (62916608-230686719, default 62916608):
Last sector, +sectors or +size{K,M,G,T,P} (62916608-230686719, default 230686719): +70G
 
Created a new partition 4 of type 'Extended' and of size 70 GiB.

순서대로 n, e, 4, 엔터, +70G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성
e : extended 파티션을 생성
4 : 파티션의 번호를 4로 지정(4까지 지정가능)
엔터 : 4번 파티션에서 사용할 초기 섹터를 지정
+70G : 초기섹터부터 70G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start       End   Sectors Size Id Type
/dev/sdc1           2048  20973567  20971520  10G 83 Linux
/dev/sdc2       20973568  41945087  20971520  10G 83 Linux
/dev/sdc3       41945088  62916607  20971520  10G 83 Linux
/dev/sdc4       62916608 209717247 146800640  70G  5 Extended

정상적으로 생성됨

 

 

이어서 다시한번 logical 파티션 생성

1
2
3
4
5
6
7
Command (m for help): n
All primary partitions are in use.
Adding logical partition 5
First sector (62918656-209717247, default 62918656):
Last sector, +sectors or +size{K,M,G,T,P} (62918656-209717247, default 209717247): +5G
 
Created a new partition 5 of type 'Linux' and of size 5 GiB.

순서대로 n, 엔터, +5G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성(여기서부턴 자동으로 logical 파티션을 생성함)
엔터 : 파티션에서 사용할 초기 섹터를 지정
+5G : 초기섹터부터 5G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start       End   Sectors Size Id Type
/dev/sdc1           2048  20973567  20971520  10G 83 Linux
/dev/sdc2       20973568  41945087  20971520  10G 83 Linux
/dev/sdc3       41945088  62916607  20971520  10G 83 Linux
/dev/sdc4       62916608 209717247 146800640  70G  5 Extended
/dev/sdc5       62918656  73404415  10485760   5G 83 Linux

정상적으로 생성됨

 

 

이어서 다시한번 logical 파티션 생성

1
2
3
4
5
6
7
Command (m for help): n
All primary partitions are in use.
Adding logical partition 6
First sector (73406464-209717247, default 73406464):
Last sector, +sectors or +size{K,M,G,T,P} (73406464-209717247, default 209717247): +5G
 
Created a new partition 6 of type 'Linux' and of size 5 GiB.

순서대로 n, 엔터, +5G를 입력해줌
명령어 설명 :
n : 새로운 파티션을 생성(여기서부턴 자동으로 logical 파티션을 생성함)
엔터 : 파티션에서 사용할 초기 섹터를 지정
+5G : 초기섹터부터 5G 있는 섹터까지를 지정

 

 

이어서 fdisk에서 나가지 말고 p 입력하여 파티션 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Command (m for help): p
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start       End   Sectors Size Id Type
/dev/sdc1           2048  20973567  20971520  10G 83 Linux
/dev/sdc2       20973568  41945087  20971520  10G 83 Linux
/dev/sdc3       41945088  62916607  20971520  10G 83 Linux
/dev/sdc4       62916608 209717247 146800640  70G  5 Extended
/dev/sdc5       62918656  73404415  10485760   5G 83 Linux
/dev/sdc6       73406464  83892223  10485760   5G 83 Linux

정상적으로 생성됨

 

 

w 를 입력해 저장 후 나오기

1
2
3
4
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

 

 

fdisk -l 명령으로 파티션 재확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# fdisk -l /dev/sdc
Disk /dev/sdc: 110 GiB, 118111600640 bytes, 230686720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ba74a06
 
Device     Boot    Start       End   Sectors Size Id Type
/dev/sdc1           2048  20973567  20971520  10G 83 Linux
/dev/sdc2       20973568  41945087  20971520  10G 83 Linux
/dev/sdc3       41945088  62916607  20971520  10G 83 Linux
/dev/sdc4       62916608 209717247 146800640  70G  5 Extended
/dev/sdc5       62918656  73404415  10485760   5G 83 Linux
/dev/sdc6       73406464  83892223  10485760   5G 83 Linux

정상적으로 1,2,3 primary 파티션과, 4번 extended 파티션, 그리고 logical 파티션 5, 6번이 생성됨

 

 

이후 파일시스템에 mount 시키고 싶은 경우 아래 게시글을 참고해 mount 하면됨
참고 : Oracle Linux 7 새로넣은 디스크 mount 시키기 ( https://positivemh.tistory.com/664 )

 

 

만약 asm용으로 사용할거라면 이 상태에서 진행하면됨
oracleasm library 3버전대부터는 /dev/oracleasm/disks가 없어져서
pv, vg, lv로 나눈 디스크는 asm용으로 사용하지 못함
그래서 본문처럼 물리적으로 디스크를 나눠줘야 asm 디스크로 사용가능함

 

 

결론 :
fdisk 명령을 이용해 파티션을 효과적으로 나눌수 있음
기본적으로 primary는 총 4개까지만 나눌수 있기때문에 Extended로 파티션을 만들어 추가로 더 나눠서 사용하면됨

 

 

참조 : 

https://it-serial.tistory.com/entry/Linux-%EB%A7%88%EC%9A%B4%ED%8A%B8-%EA%B3%BC%EC%A0%95-%ED%8C%8C%ED%8B%B0%EC%85%98-%EB%82%98%EB%88%84%EA%B8%B0-fdisk%EB%AA%85%EB%A0%B9%EC%96%B4-%E2%91%A2