728x90
안녕하세요!
오늘은 LVM 생성하기 대하여 알아보겠습니다.
LVM 생성하기
fdisk -l, lsblk 명령어를 사용하여 블록 스토리지를 확인합니다.
PV 생성 및 확인
[root@localhost ~]# pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created [root@localhost ~]# pvdisplay "/dev/sdc" is a new physical volume of "10.00 GiB" --- NEW Physical volume --- PV Name /dev/sdc VG Name PV Size 10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID zw9P22-THJn-Kvz7-mewA-zK8B-WFzE-nJFVss |
VG 생성 및 확인
[root@localhost ~]# vgcreate testvg /dev/sdc Volume group "testvg" successfully created [root@localhost ~]# vgdisplay --- Volume group --- VG Name testvg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <10.00 GiB PE Size 4.00 MiB Total PE 2559 Alloc PE / Size 0 / 0 Free PE / Size 2559 / <10.00 GiB VG UUID NNccj2-tz9M-YyuY-xz3U-dYo2-Kcwg-suoLbq |
LV 생성 및 확인
[root@localhost ~]# lvcreate -n testlv -l 100%FREE testvg Logical volume "testlv" created. [root@localhost ~]# lvdisplay --- Logical volume --- LV Path /dev/testvg/testlv LV Name testlv VG Name testvg LV UUID cSBcDM-T6q9-mQHr-Db5h-yrRy-tNvR-saR47P LV Write Access read/write LV Creation host, time localhost.localdomain, 2024-01-16 04:52:09 -0800 LV Status available # open 0 LV Size <10.00 GiB Current LE 2559 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 |
10G를 할당하기 위해 lvcreate -n mylv -L 10G myvg 명령어를 사용했지만 Volume group "testvg" has insufficient free space (2559 extents): 2560 required. 필요 공간이 부족하여 LV 생성이 불가합니다. 잔여 용량을 전부 사용하기 위해 -l 100%FREE를 사용하였습니다.
[root@localhost ~]# lvcreate -n testlv -L 10G testvg Volume group "testvg" has insufficient free space (2559 extents): 2560 required. [root@localhost ~]# lvcreate -n testlv -l 100%FREE testvg Logical volume "testlv" created. |
파일 시스템 생성 및 마운트
[root@localhost ~]# mkfs.ext4 /dev/testvg/testlv mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2620416 blocks 131020 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2151677952 80 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 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done |
마운트 및 fstab 등록
[root@localhost ~]# mkdir /test-lvm [root@localhost ~]# mount /dev/testvg/testlv /test-lvm [root@localhost ~]# lsblk |
[root@localhost ~]# vi /etc/fstab # /etc/fstab # Created by anaconda on Mon Jan 8 08:14:21 2024 # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info /dev/testvg/testlv /test-lvm ext4 defaults 0 0 |
확인
이상입니다.
감사합니다!
728x90
반응형
'Linux(리눅스) > VMware_RHEL' 카테고리의 다른 글
LVM 축소하기 (0) | 2024.02.27 |
---|---|
LVM 증설하기 (pv, vg, lv 확장 및 용량 증설) (1) | 2024.02.25 |
LVM(논리 볼륨 관리) 개념 (0) | 2024.02.20 |
Linux RHEL 7.9 Kernel(커널) 업데이트 (0) | 2024.02.19 |
스왑(swap) 활성화 (0) | 2024.02.11 |