Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

클라우드 엔지니어 꿈나무

RHEL 9.3 Disk 장착 후 볼륨 설정 본문

Linux

RHEL 9.3 Disk 장착 후 볼륨 설정

새싹싹이 2024. 4. 7. 21:04

하기와 지시를 따라 wgroup 이라는 볼륨 그룹에 wshare라는 LVM 생성해라

- PE 사이즈는 8MB 

- LVM 사이즈는 50 extents로 설정

- 파일 시스템 포맷은 ext4고 /mnt/wshare 에 파일 마운트

- 재부팅 후에 자동으로 마운트가 되어야 한다.

(시험에서 파일 형식은 vfat나 xfs로 나올 수도 있다)

 

 

 

 

# lsblk

디스크 확인

 

 

# fdisk /dev/sdb

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 1
First sector (2048-10485759, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-10485759, default 10485759): +500M

Created a new partition 1 of type 'Linux' and of size 500 MiB.

Command (m for help): t

Hex code or alias (type L to list all): 8e
Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): p
Disk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Disk model: VMware Virtual S
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: 0x6e33d1cf

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1        2048 1026047 1024000  500M 8e Linux LVM

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

 

# partprobe /dev/sdb

파티션 정보 업데이트

 

# fdisk /dev/sdb -l

디스크 장착 확인 /dev/sdb1로 장착되었음을 볼 수 있다.

 

 

# pvcreate /dev/sdb1

lvm 사용 선언

 

 

# vgcreate -s 8M wgroup /dev/sdb1

8MB의 물리적 사이즈를 가진 wgroup 볼륨 그룹 생성

 

# lvcreate -l 50 -n wshare /dev/wgroup

logical extent 크기가 50인 wshare 을 볼륨그룹으로 삼는 논리적 볼륨 생성

 

 

# mkfs.ext4 /dev/wgroup/wshare

파일 시스템 ext4로 생성

 

# mkdir /mnt/wshare

 

# vi /etc/fstab

리부팅 이후에도 자동 마운트 되도록 설정

/dev/wgroup/whare       /mnt/wshare             ext4    defaults        0 0

 

 

# mount -a

마운트 (하기와 같이 추가 메세지가 설정되어서 systemctl daemon-reload 명령어 추가 입력)

 

# systemctl daemon-reload

 

# df -h

마운트 된 파일 시스템의 디스크 사용량 확인

 

 

 


400 MB 의 swap 파티션을 만들고 영구 사용으로 설정

 

# fdisk /dev/sdb

위에 장착된 디스크에 추가 설정

 

 

swp 파일로 지정을 위하여 t를 입력하여 코드 변경 (swp 82)

p 기입하여 확인

w로 저장

 

# partprobe /dev/sdb

 

# lsblk 

생성 확인

 

# mkswap /dev/sdb2

/deb/sdb2 swap 영역으로 지정 

 

# swapon /dev/sdb2

/deb/sdb2 swap 공간으로 활성화

 

# blkid

sdb의 uuid 확인

 

# vi /etc/fstab

UUID=bf6c54d3-df95-4b1a-aad6-431b147edccc       swap    swap    defaults        0 0
#파티션 유형 swap, 마운트할 파일 시스템 유형 swap

 

 

# mount -a

 

# swapon -s


wshare 논리 볼륨 크기 300MB로 축소 (사이즈는 270m에서 290m 사이)

 

#df -h

 

 

# lvs

논리 볼륨 정보 확인

 

 

# umount /mnt/wshare

마운트 해제

 

# e2fsck -f /dev/mapper/wgroup-wshare

e2fsck: 리눅스 파일 시스템 점검 및 복구 / -f: 강제 

 

 

# resize2fs /dev/mapper/wgroup-wshre 300M

파일시스템 리사이즈

 

 

# lvreduce -L -100M -n /dev/mapper/wgroup-wshare

/dev/mapper/wgroup-wshare 논리 볼롬에서 100MB 축소 (lvreduce -L 300M -n /dev/mapper/wgroup-wshare 도 가능)

 

#mount -a 

마운트

 

 

# df -h 

 

 

# lvs


wshare 논리 볼륨 크기 400MB로 증설 

 

# df -Th

# lvs

 

 

# lvextend -r -L +100M /dev/mapper/wgroup-wshare  (lvextend -r -L 400M /dev/mapper/wgroup-wshare)

(umount로 마운트 해제 및 mount로 마운트 안 해도 됨)

-r 옵션: 파일시스템도 한 번에 같이 증설 / 100MB로 증설 

-r 옵션 미기입했을 때는 # xfs_growfs /dev/mapper/wgroup-wshare (xfs 파일)

또는 # resize2fs /dev/mapper/wgroup-wshare (ext 파일) 파일 시스템 사이즈 증설

 

 

<참고>

https://hiheey.tistory.com/185

 

CentOS9 logical volume 용량 증설

/home 볼륨의 크기를 750MB 로 변경 합니다. 논리 볼륨의 크기는 740MB~760MB 사이의 범위는 허용합니다. /home 디렉토리 안에 기존 파일들이 정상적으로 유지되어야 합니다. 여기는 디스크 장착 부분,

hiheey.tistory.com

https://hiheey.tistory.com/13

 

Disk 관리 : Storage 및 LVM - CentOS 7

Storage 1.Storage 관리 1-1. 종류 ● DAS (Direct Attach Storage) ㆍ전용 케이블(IDE, SATA, SCSI)를 통해서 시스템과 연결된 저장 장치 ㆍ확장성이 떨어져 원거리 설치에 좋지 않다. ㆍ속도가 빠르고 안정적이며

hiheey.tistory.com