728x90
반응형
* 하드디스크 추가 : /dev/sdb (VDI-동적할당-5GB)
1. 디스크 확인
[root@OL7 ~]# fdisk -l
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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: 85.9 GB, 85899345920 bytes, 167772160 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: 0x000def44
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 167772159 82836480 8e Linux LVM
2. 파티션 생성
[root@OL7 ~]# 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 0x9340762e.
Command (m for help): n -------> #파티션 생성
Partition type: --------> #1~3번은 p 타입, 4번은 e타입, 5번이후부터는 logical 파티션생성
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): -------> #primary 파티션 생성
Using default response p
Partition number (1-4, default 1): -------> #첫번째/엔터입력
First sector (2048-10485759, default 2048): -------> #디폴트 2048섹터 시작/엔터 입력
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759): +1G ----->#1기가 추가
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): t -------> #파티션 타입 설정
Selected partition 1
Hex code (type L to list all codes): 8e -------> #파티션 타입 코드
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p -------> #파티션 확인
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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: 0x556b35f7
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 8e Linux LVM
Command (m for help): w -------> 설정 저장
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3. 생성된 파티션 확인
[root@OL7 ~]# fdisk -l
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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: 0x556b35f7
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 8e Linux LVM
Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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: 0x000def44
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 167772159 82836480 8e Linux LVM
4. PV, VG, LV 항목 설정 상태 확인
[root@OL7 ~]# pvscan
PV /dev/sda2 VG ol lvm2 [<79.00 GiB / 0 free]
Total: 1 [<79.00 GiB] / in use: 1 [<79.00 GiB] / in no VG: 0 [0 ]
[root@OL7 ~]# vgscan
Reading volume groups from cache.
Found volume group "ol" using metadata type lvm2
[root@OL7 ~]# lvscan
ACTIVE '/dev/ol/swap' [4.00 GiB] inherit
ACTIVE '/dev/ol/root' [<75.00 GiB] inherit
5. PV 생성
[root@OL7 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@OL7 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 ol lvm2 a-- <79.00g 0
/dev/sdb1 lvm2 --- 1.00g 1.00g
[root@OL7 ~]# pvscan
PV /dev/sda2 VG ol lvm2 [<79.00 GiB / 0 free]
PV /dev/sdb1 lvm2 [1.00 GiB]
Total: 2 [<80.00 GiB] / in use: 1 [<79.00 GiB] / in no VG: 1 [1.00 GiB]
6. VG 생성
[root@OL7 ~]# vgcreate data_vg01 /dev/sdb1
Volume group "data_vg01" successfully created
[root@OL7 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
data_vg01 1 0 0 wz--n- 1020.00m 1020.00m
ol 1 2 0 wz--n- <79.00g 0
[root@OL7 ~]# vgscan
Reading volume groups from cache.
Found volume group "data_vg01" using metadata type lvm2
Found volume group "ol" using metadata type lvm2
7. LV생성
[root@OL7 ~]# lvcreate -l 100%FREE -n data_lv01 data_vg01
Logical volume "data_lv01" created.
[root@OL7 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data_lv01 data_vg01 -wi-a----- 1020.00m
root ol -wi-ao---- <75.00g
swap ol -wi-ao---- 4.00g
[root@OL7 ~]# lvscan
ACTIVE '/dev/data_vg01/data_lv01' [1020.00 MiB] inherit
ACTIVE '/dev/ol/swap' [4.00 GiB] inherit
ACTIVE '/dev/ol/root' [<75.00 GiB] inherit
8. 파일시스템 생성
[root@OL7 ~]# mkfs -t xfs /dev/data_vg01/data_lv01
meta-data=/dev/data_vg01/data_lv01 isize=256 agcount=4, agsize=65280 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0, rmapbt=0
= reflink=0
data = bsize=4096 blocks=261120, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=853, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
9. 파일시스템 마운트
[root@OL7 ~]# mkdir /test_data
[root@OL7 ~]# mount /dev/data_vg01/data_lv01 /test_data/
[root@OL7 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 968M 0 968M 0% /dev
tmpfs tmpfs 987M 0 987M 0% /dev/shm
tmpfs tmpfs 987M 9.5M 978M 1% /run
tmpfs tmpfs 987M 0 987M 0% /sys/fs/cgroup
/dev/mapper/ol-root xfs 75G 24G 52G 32% /
/dev/sda1 xfs 1014M 274M 741M 27% /boot
tmpfs tmpfs 198M 32K 198M 1% /run/user/0
/dev/mapper/data_vg01-data_lv01 xfs 1017M 33M 985M 4% /test_data
10. OS재부팅 후에도 자동 마운트 작업 -> 마지막 줄 추가
[root@OL7 ~]# vi /etc/fstab
[root@OL7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Apr 15 12:35:47 2022
#
# 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/mapper/ol-root / xfs defaults 0 0
UUID=04ca2dd8-ac08-4e08-96c6-61d0100670da /boot xfs defaults 0 0
/dev/mapper/ol-swap swap swap defaults 0 0
/dev/data_vg01/data_lv01 /test_dir xfs defaults 0 0
728x90
반응형
'Operating System > Linux' 카테고리의 다른 글
Linux7에 Tomcat 8 설치 (0) | 2023.04.05 |
---|---|
Linux7에 JDK1.8 설치 (0) | 2023.04.05 |
Linux 7에 Oracle 11g 설치(4)-리스너 설정 (0) | 2023.03.28 |
Linux 7에 Oracle 11g 설치(3)- dbca (0) | 2023.03.28 |
Linux 7에 Oracle 11g 설치(2)- runlnstaller 스크립트 설치 (0) | 2023.03.15 |