본문 바로가기
서버/리눅스 서버

8T 시게이트 바라쿠다 : badblocks / gpt 파티션 테이블 생성 및 마운트

by ㅋㅋ잠자 2024. 5. 9.
반응형

안녕하세요? 도정진입니다.

 

1. badblocks single pass

badbloocks 생각보다 시간이 오래 걸리네요. testpattern 이 한개가 아니라 4개정도 있는 것 같습니다.

1개를 쓰고 1개를 읽는데 시간이 30시간 정도 걸리네요.

root@debian:~# badblocks -b 4096 -s -w -v /dev/sdb
Checking for bad blocks in read-write mode
From block 0 to 1953506645
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: ^C1.62% done, 29:28:51 elapsed. (0/0/0 errors)

Interrupted at block 31684928

위 로그를 보면 0xaa 를 한번 쓰고, 한번 일고 또 다시 0x55에 대해서 테스트를 진행하는 것을 알 수 있습니다.

 

그래서 아래 옵션을 줘서 테스트 패턴을 좀 조정하여 single pass 에 판별을 끝낼 수도 있습니다.

root@debian:~# badblocks -b 4096 -c 8192 -s -w -v -t 0xab /dev/sdb


Checking for bad blocks in read-write mode
From block 0 to 1953506645
Testing with pattern 0xab: ^C0.01% done, 0:02 elapsed. (0/0/0 errors)

-t 옵션을 주고 테스트 패턴을 수동 기입하면 됩니다.

추가적으로 -c 옵션을 줘서 한번에 -b 4096 bytes 의 8192개 만큼 검사하도록 수정하면 조금 더 빠르게 검사가 가능합니다.

 

2. gpt 파티션 테이블 생성 / ext4 포맷

위 1번은 0xaa로 검사를 했을 때, 정상이라고 판단되어 일단 중간에 취소하고 파티션 생성을 해보도록 하겠습니다.

일단은 fdisk 를 통해 gpt 테이블을 생성하고 파티션을 하나 생성해보겠습니다.

 

fdisk -l 을 입력하면 장치 리스트가 나옵니다. 저는 /dev/sdb 를 작업할 예정입니다.

root@debian:~# fdisk -l
Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: KINGSTON SNV2S1000G
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: gpt
Disk identifier: 959E3F43-626C-41D0-B034-AE03E9912799

Device           Start        End    Sectors  Size Type
/dev/nvme0n1p1      34       2047       2014 1007K BIOS boot
/dev/nvme0n1p2    2048    1050623    1048576  512M EFI System
/dev/nvme0n1p3 1050624 1953525134 1952474511  931G Linux LVM


Disk /dev/mapper/pve-root: 931.01 GiB, 999662026752 bytes, 1952464896 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/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: EADS-00R6B0
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: 0xd359cc0e

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sda1             2048 3839920303 3839918256  1.8T 83 Linux
/dev/sda2       3839922176 3907029167   67106992   32G 83 Linux


Disk /dev/zram0: 15.52 GiB, 16660926464 bytes, 4067609 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: USB3.0 DISK00
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

아래 명령을 통하여 gpt 파티션 테이블을 생성합니다.

root@debian:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.36.1).
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.
The size of this disk is 7.3 TiB (8001563222016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0x25d619ca.

Command (m for help): g
Created a new GPT disklabel (GUID: BE03F5F6-1E50-0E47-AFE1-AF1277CCE285).

다음으로, 파티션을 하나 생성합니다.

First sector / Last sector 는 엔터치면 default 값으로 지정됩니다.

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-15628053134, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15628053134, default 15628053134):

Created a new partition 1 of type 'Linux filesystem' and of size 7.3 TiB.

w 를 입력하여 기록합니다.

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

제대로 되었는지 한번 다시 읽어봅니다.

root@debian:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: USB3.0 DISK00
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: BE03F5F6-1E50-0E47-AFE1-AF1277CCE285

Device     Start         End     Sectors  Size Type
/dev/sdb1   2048 15628053134 15628051087  7.3T Linux filesystem

생성된 /dev/sdb1 파티션을 ext4로 포맷합니다.

root@debian:~# mkfs.ext4 /dev/sdb1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 1953506385 4k blocks and 244191232 inodes
Filesystem UUID: 4cfc6a4b-68b6-4f43-9f61-8be89ab151ce
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, 1934917632

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

 

3. 테스트 마운트

먼저 마운트할 폴더를 생성합니다.

오리코 DAS의 5번째 디스크에 꽂은 하드라서 아래와 같이 이름을 지어보았습니다.

root@debian:~# mkdir -p /orico-media/volume5
root@debian:~# mount /dev/sdb1 /orico-media/volume5/
root@debian:~# df -h | grep orico
/dev/sdb1             7.3T   28K  6.9T   1% /orico-media/volume5  

정상적으로 마운트 되었습니다.

 

4. 예약 공간 삭제

3번섹션에서 보면 전체 용량이 7.3T 사용가능한 공간이 6.9T 입니다. 예약공간이 잡혀있는 것인데요.

아래 명령어로 0%로 조정이 가능합니다.

root@debian:~# tune2fs -m 0 /dev/sdb1
tune2fs 1.46.5 (30-Dec-2021)
Setting reserved blocks percentage to 0% (0 blocks)

다시 확인해보면 예약이 없어졌음을 확인할 수 있습니다.

root@debian:~# df -h | grep orico
/dev/sdb1             7.3T   28K  7.3T   1% /orico-media/volume5

 

5. fstab 마운트

fstab 마운트 시, /dev path 의 장치명으로 마운트하면 추후 부팅할 때 순서대로 a b c d 매겨지는 부분으로 순서가 뒤틀릴 가능성이 있습니다.

uuid 값을 통해 마운틀를 해야합니다.

 

아래 명령으로 UUID 값을 확인 가능합니다.

root@debian:~# blkid
/dev/nvme0n1p2: UUID="8457-3074" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="d39e87f4-bffe-4809-8292-8087bc0155ec"
/dev/nvme0n1p3: UUID="D8ERok-5r2f-8gbS-2GGm-k4Au-k2sE-fZy8FM" TYPE="LVM2_member" PARTUUID="d1c9c1a2-bd14-42ac-bd1b-83b16b47ea92"
/dev/mapper/pve-root: UUID="699f09a9-dff6-4214-af80-fe4701fc71f0" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda1: UUID="b215d5d5-a856-4617-8474-d86f1803007c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d359cc0e-01"
/dev/sda2: UUID="73fae49a-5b34-4a2f-b22d-9a31b6a88c33" TYPE="swap" PARTUUID="d359cc0e-02"
/dev/zram0: UUID="4732f7fb-3964-49fb-b4a8-baaedee61c31" TYPE="swap"
/dev/nvme0n1p1: PARTUUID="9f6b9cdc-e4ac-4615-9ec6-34b2cca0f9f6"
/dev/sdb1: UUID="4cfc6a4b-68b6-4f43-9f61-8be89ab151ce" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3969409c-6a73-5143-ac28-860cdb21de8e"

위 값을 이용하여 fstab 에 기록합니다.

root@debian:~# vi /etc/fstab

# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
UUID=8457-3074 /boot/efi vfat defaults 0 1
proc /proc proc defaults 0 0
UUID=b215d5d5-a856-4617-8474-d86f1803007c /media ext4 defaults
UUID=4cfc6a4b-68b6-4f43-9f61-8be89ab151ce /orico-media/volume5 ext4 defaults

 

반응형

댓글