728x90
리눅스에서 2TB 이상의 디스크를 사용하기(GPT 파티션 설정)
리눅스 시스템에서 2TB 이상의 디스크를 사용하려면 GPT(GUID Partition Table) 파티션 테이블을 사용해야 합니다. GPT는 MBR(Master Boot Record)보다 더 큰 디스크 용량을 지원하고 더 많은 파티션을 생성할 수 있는 표준입니다.
1. 운영 중인 커널 버전 확인
$ uname -a
Linux vm01 2.6.32-504.23.4.el6.x86_64 #1 SMP Tue Jun 9 20:57:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2. GPT Partition사용가능 여부 체크
- CONFIG_EFI=y
- CONFIG_FB_EFI=y
- CONFIG_EFI_VARS=y
- CONFIG_EFI_PARTITION=y
cat /boot/config-2.6.32-504.23.4.el6.x86_64 | grep EFI | grep -v ^#
$ cat /boot/config-2.6.32-504.23.4.el6.x86_64 | grep EFI | grep -v ^#
CONFIG_EFI=y
CONFIG_FB_EFI=y
CONFIG_UEFI_CPER=y
CONFIG_EFI_VARS=y
CONFIG_CACHEFILES=m
CONFIG_EFI_PARTITION=y
CONFIG_EARLY_PRINTK_EFI=y
3. GPT 파티션 생성
parted /dev/sdc
$ parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(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)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partiti
quit exit program
rescue START END rescue a lost partition near START and END
resize NUMBER START END resize partition NUMBER and its file system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version display the version number and copyright information of GNU Parted
(parted) print
Error: /dev/sdc: unrecognised disk label
(parted) mklabel gpt
(parted) print
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdc: 2700GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
(parted) mkpart primary 0 2700GB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) print
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdc: 2700GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 2700GB 2700GB primary
(parted) quit
Information: You may need to update /etc/fstab.
728x90
4. 파티션 포맷
mkfs.ext4 /dev/sdc1
$ mkfs.ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
/dev/sdc1 alignment is offset by 244736 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=192 blocks
164823040 inodes, 659290557 blocks
32964527 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
20120 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5. 파일시스템 마운트
blkid | grep /dev/sdc
$ blkid | grep /dev/sdc
/dev/sdc1: UUID="02a767df-e1ee-4e23-9d1e-9370d3a1b55b" TYPE="ext4"
- 마운트 포인트 생성
sudo mkdir /mnt/mydisk
- 마운트
sudo mount /dev/sdX1 /mnt/mydisk
6. 부팅 시 자동 마운트 (옵션)
파티션을 부팅 시 자동으로 마운트하려면 /etc/fstab 파일에 해당 마운트 정보를 추가해야 합니다.
vi /etc/fstab
#/dev/sdc1
UUID=02a767df-e1ee-4e23-9d1e-9370d3a1b55b /mnt/mydisk ext4 defaults 0 0
또는
echo '/dev/sdX1 /mnt/mydisk ext4 defaults 0 0' | sudo tee -a /etc/fstab
참고URL
- MBR과 GPT의 비교표 : http://blog.naver.com/PostView.nhn?blogId=leekh8412&logNo=100132406507
728x90
'리눅스' 카테고리의 다른 글
watch 명령어 (0) | 2023.01.05 |
---|---|
SSL 인증서 합치기(nginx 인증서 생성) (0) | 2023.01.04 |
[draft] 우분투에 Composer를 설치하고 사용하는 방법 (0) | 2023.01.03 |
growpart 명령어 (0) | 2023.01.03 |
MongoDB의 샤딩을 활성화(enable sharding)하고 샤딩된 클러스터에서 쿼리를 테스트하는 방법 (0) | 2023.01.02 |