OS Disk Partition

Warehouse·2022년 10월 12일
0
post-thumbnail

Linux OS Partition


  • 디스크 용량 정보 확인

    [root@source ~]# fdisk -l

[root@source ~]# fdisk -l

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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
Disk label type: dos
Disk identifier: 0x000c627c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   167772159    82836480   8e  Linux LVM

Disk /dev/mapper/centos-root: 51.3 GB, 51308920832 bytes, 100212736 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

Disk /dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072 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

Disk /dev/mapper/centos-home: 25.1 GB, 25052577792 bytes, 48930816 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
접기/펼치기 [지우기]


  • Disk /dev/mapper/centos-root: 51.3 GB -> partition 하기

[root@source ~]# fdisk /dev/mapper/centos-root

Command Manual [ 클릭하여 보고가기 ]
  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)
[root@source ~]# fdisk /dev/mapper/centos-root
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xdfdde72b.

Command (m for help): n              [ 파티션 추가하기 ] 
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):                  [ 엔터 ]
Using default response p
Partition number (1-4, default 1): 3    [ 파티션숫자 이름 뒤에 붙을 숫자 ] 
First sector (2048-100212735, default 2048):   [ 데이터 구간 ]
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-100212735, default 100212735): +10G
                                                                          [ 10GB 사용 구간 표시 ]
Partition 3 of type Linux and of size 10 GiB is set

Command (m for help): w                   [ 저장 ]


----------------------- Partition이 추가 되었는지 디스크 확인 ------------------


[root@source ~]# fdisk -l

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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
Disk label type: dos
Disk identifier: 0x000c627c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   167772159    82836480   8e  Linux LVM

Disk /dev/mapper/centos-root: 51.3 GB, 51308920832 bytes, 100212736 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
Disk label type: dos
Disk identifier: 0xdfdde72b

-------- [ 없었던 Partition 생성되었다 뒤에 3이라는 partition number 확인] --------
                  Device Boot      Start         End      Blocks   Id  System
/dev/mapper/centos-root3            2048    20973567    10485760   83  Linux

Disk /dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072 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


Disk /dev/mapper/centos-home: 25.1 GB, 25052577792 bytes, 48930816 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

  • Oracle ASM 환경을 위해 총 3개 Partition을 만들었다.
[root@source ~]# fdisk -l
...
Disk /dev/mapper/centos-root: 51.3 GB, 51308920832 bytes, 100212736 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
Disk label type: dos
Disk identifier: 0xdfdde72b

                  Device Boot      Start         End      Blocks   Id  System
/dev/mapper/centos-root1        41945088    62916607    10485760   83  Linux
/dev/mapper/centos-root2        20973568    41945087    10485760   83  Linux
/dev/mapper/centos-root3            2048    20973567    10485760   83  Linux
...

  • 경로 = /dev
[root@test_server dev]# ls -lrt sd*
brw-rw----. 1 root disk 8, 0 10월 12 17:51 sda
brw-rw----. 1 root disk 8, 2 10월 12 17:51 sda2
brw-rw----. 1 root disk 8, 1 10월 12 17:51 sda1
sda2, sda1 의미
sd : SCSI(Small Computer System interface) or USB 방식
a  : 첫 번째 하드디스크    ( 두 번째 하드디스크일 경우 b가 된다 ex: sdb2)
2  : Partition Number 파티션 구별 ( 같은 하드디스크에 파티션을 나누어 2번과 1번으로 구별한다)
profile
python 하고 싶은 코린이

0개의 댓글