어제와 똑같이 살면서 다른 미래를 기대하지 말자

[CentOS] 리눅스 명령어 parted (2TB 이상 파티션 설정) 본문

IT관심분야/Linux

[CentOS] 리눅스 명령어 parted (2TB 이상 파티션 설정)

플랜액터 2018. 10. 25. 10:12

1. GPT 파티션 사용가능여부 체크

# uname -r

2.6.32-696.20.1.el6.x86_64

# cat /boot/config-2.6.32-696.20.1.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


2. GPT 파티션 생성

# parted /dev/sda

GNU Parted 2.1
Using /dev/sda
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 partition
  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) mklabel gpt

파티션 확인

(parted) print

Model: LSI 9750-16i4e DISK (scsi)
Disk /dev/sda: 30.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

파티션 설정 단위

(parted) unit TB

파티션 설정 (0-15TB, 15TB-30TB)

(parted) mkpart data1 0 15

(parted) mkpart data2 15 30

※ "%" 설정도 가능함

(parted) mkpart data1 0 50%

(parted) mkpart data2 50% 100%

파티션 확인

(parted) print

Model: LSI 9750-16i4e DISK (scsi)
Disk /dev/sda: 30.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  15.0TB  15.0TB  ext4         data1
 2      15.0TB  30.0TB  15.0TB  ext4         data2

(parted) quit




3. 파티션 포멧

# mkfs.ext4 /dev/sda1

# mkfs.ext4 /dev/sda2


4. 수동마운트

# mount -t ext4 /dev/sda1 /data1

# mount -t ext4 /dev/sda2 /data2


5. 자동마운트 (fstab)

# blkid

/dev/sda1: UUID="cf848582-c5f0-481a-b0c3-30b25c16d38d" TYPE="ext4"

/dev/sda2: UUID="b4f9b0e8-3eb7-4efd-8354-54906f18b24c" TYPE="ext4"

...

# vi /etc/fstab

UUID=cf848582-c5f0-481a-b0c3-30b25c16d38d /data1                  ext4    defaults        0 0

UUID=b4f9b0e8-3eb7-4efd-8354-54906f18b24c /data2                  ext4    defaults        0 0


테스트 (fstab에 등록된 디스크 마운트)
# mount -a 


6. 마운트 확인

# df -Th

# df -Th

Filesystem           Type   Size  Used Avail Use% Mounted on
...
/dev/sda1            ext4    14T   15M   13T   1% /data1
/dev/sda2            ext4    14T   15M   13T   1% /data2





7. 성능 테스트

READ 테스트

# hdparm -tT /dev/sda1

/dev/sda1:

 Timing cached reads:   24456 MB in  1.99 seconds = 12280.68 MB/sec
 Timing buffered disk reads: 3712 MB in  3.00 seconds = 1237.21 MB/sec

# hdparm -tT /dev/sda2

/dev/sda2:

 Timing cached reads:   24666 MB in  1.99 seconds = 12387.11 MB/sec
 Timing buffered disk reads: 3158 MB in  3.00 seconds = 1052.08 MB/sec

WRITE 테스트

* /data1 1메가 1024회 연속쓰기 테스트
# dd if=/dev/zero of=/data1/file bs=1M count=1024
1024+0 records in
1024+0 records out
1024000000 bytes (1.0 GB) copied, 0.541215 s, 1.9 GB/s

* /data1 1GB 5회 연속쓰기 테스트
# dd if=/dev/zero of=/data1/file bs=1G count=5
5+0 records in
5+0 records out
5368709120 bytes (5.4 GB) copied, 5.17552 s, 1.0 GB/s

/data2 1MB 1024회 연속쓰기 테스트
# dd if=/dev/zero of=/data2/file bs=1M count=1024
1024+0 records in
1024+0 records out
1024000000 bytes (1.0 GB) copied, 0.537927 s, 1.9 GB/s

/data2 1GB 5회 연속쓰기 테스트
# dd if=/dev/zero of=/data2/file bs=1G count=5
5+0 records in
5+0 records out
5368709120 bytes (5.4 GB) copied, 5.83014 s, 921 MB/s


Comments