개발 블로그
[교육] 하드디스크 만들고 디렉토리에 마운트 하기 본문
나머지는 비슷한데 일단 하드디스크는 SCSI로 두개를 더 추가 해줬다
서버용으로는 주로 SCSI 하드디스크를 사용한다
SCSI 0:0
SCSI 0:1
SCSI 0:2
그럼 이제 위에 네모난 하드디스크 초록색으로 빛나는거 보이지
하드디스크가 세개라는 뜻..
이제 요구사항대로 파티션을 나눠야 겠다.
/ 파티션에 해당하는 하드디스크만 여기서 설정을 하고
남은 것은 터미널로 설정해보기
표준 파티션 지정해주고
이렇게 설정해주고
/boot 와 /swap 파티션을 각각 다음과 같은 크기로 설정 해줌
소프트웨어 선택, 네트워크 및 호스트명도 설정 해주고 설치시작 눌러
root 계정 비밀번호 password
사용자 centos 비밀번호 centos 로 해줬음
이제 남은 하드디스크도 마운트 시켜야 함
이것이 리눅스다 Cent OS 8을 참고해서 했다
추가한 하드디스크의 물리 이름은 앞서 파티션 설정할 때 봤던 것 처럼
/dev/sdb dev/sdc 가 된다
/dev/sdb dev/sdc 를 사용하려면 최소 1개 이상의 파티션으로 나눠야 한다
특별히 파티션을 여러 개 나눌 필요는 없으므로 1개의 파티션으로만 나눌 것임
그래서 논리 파티션의 이름은 /dev/sdb1, /dev/sdc1 이 된다.
리눅스에서는 이 파티션을 그냥 사용할 수 없으며 반드시 특정한 디렉터리(=폴더)에 마운트 시켜야 사용할 수 있다
요구 조건대로 /engine /data 디렉터리를 만들고 그 디렉터리에 마운트 할 것이다
[root@localhost ~]# fdisk /dev/sdb
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 0x462bed37.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x462bed37
Device Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#
# fdisk /dev/sdb
SCSI 0:1 하드디스크 선택
Command : n
새로운 파티션 분할
Select : p
Primary 파티션 선택
Partition number : 1
파티션 번호 1번 선택 (프라이머리 파티션은 최대 4개까지 생성 가능)
First sector : 엔터
시작 섹터 번호 입력(1개의 파티션만 계획 중이므로 첫 섹터로 설정)
Last sector : 엔터
마지막 섹터 번호 입력( 1개의 파티션만 계획 중이므로 마지막 섹터로 설정)
Command : p
설정된 내용 확인
Command : w
설정 저장
[root@localhost ~]# fdisk /dev/sdc
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 0xe54d2549.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): p
Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 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: 0xe54d2549
Device Boot Start End Blocks Id System
/dev/sdc1 2048 41943039 20970496 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
이렇게 두 개 다 fdisk로 파티션을 설정해주었다
할당된 파티션 장치의 이름은 /dev/sdb1 /dev/sdc1
mkfs.xfs /dev/sdb1
mkfs.xfs /dev/sdc1
명령을 입력해서
파일 시스템을 xfs 형식으로 생성함 이 과정이 포맷이라고 생각하면 된다
그럼 이 파일 시스템을 사용하기 위해 디렉터리에 마운트 하자
mkdir /engine
mkdir /data
디렉토리를 만들고
mount /dev/sdb1 /engine
mount /dev/sdc1 /data
포맷이 완료된 장치를 디렉터리에 마운트하자
이번에는 컴퓨터를 켤 때
/dev/sdb1 장치가 항상 /engine
/dev/sdc1 장치가 항상 /data
에 마운트 되어 있도록 설정하기
vi /etc/fstab로 아래와 같은 내용을 추가해 설정해주자
reboot 해주고
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 476M 0 part /boot
├─sda2 8:2 0 4G 0 part [SWAP]
└─sda3 8:3 0 15.5G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /engine
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 20G 0 part /data
sr0 11:0 1 1024M 0 rom
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 471M 0 471M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 8.5M 478M 2% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/sda3 16G 5.0G 11G 33% /
/dev/sdc1 20G 33M 20G 1% /data
/dev/sdb1 20G 33M 20G 1% /engine
/dev/sda1 473M 161M 312M 35% /boot
tmpfs 98M 32K 98M 1% /run/user/0
[root@localhost ~]# mount | grep "^/dev"
/dev/sda3 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sdc1 on /data type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sdb1 on /engine type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
확인 해보니 잘 마운트가 되었다
'리눅스 | 서버' 카테고리의 다른 글
[교육] 서버 기본 학습 시험 2차 (0) | 2024.06.04 |
---|---|
[교육] 서버 기본 학습 시험 1차 (0) | 2024.05.31 |
[교육] Tomcat9 설치 (0) | 2024.05.29 |
[교육] Apache 2.4 설치하기 (0) | 2024.05.27 |
[교육] 오라클 jdk 1.8 설치하기 (0) | 2024.05.24 |