반응형
# fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 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: 0x0003c1b5
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 4196351 2097152 83 Linux
/dev/sda2 4196352 488396799 242100224 8e Linux LVM
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 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
# 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.
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-1953525167, default 2048): 엔터
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1953525167, default 1953525167): 엔터
Using default value 1953525167
Partition 1 of type Linux and of size 931.5 GiB is set
Command (m for help): p
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 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: 0x000167a6
Device Boot Start End Blocks Id System
/dev/sdb1 2048 1953525167 976761560 83 Linux
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: 1000.2 GB, 1000204886016 bytes, 1953525168 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: 0x000167a6
Device Boot Start End Blocks Id System
/dev/sdb1 2048 1953525167 976761560 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# pvcreate /dev/sdb1
WARNING: dos signature detected on /dev/sdb1 at offset 510. Wipe it? [y/n]: y
Wiping dos signature on /dev/sdb1.
Physical volume "/dev/sdb1" successfully created.
# pvdisplay
--- Physical volume ---
...
"/dev/sdb1" is a new physical volume of "931.51 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 931.51 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID TPAgt6-V2Ii-83Li-9Pq4-Q0Yh-FNmL-1ycugC
# vgcreate centosvg1 /dev/sdb1
Volume group "centosvg1" successfully created
# vgdisplay
--- Volume group ---
...
--- Volume group ---
VG Name centosvg1
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 <931.51 GiB
PE Size 4.00 MiB
Total PE 238466
Alloc PE / Size 0 / 0
Free PE / Size 238466 / <931.51 GiB
VG UUID fQLwXp-zAMV-KsOf-e0I3-LnXj-W0hn-5Treji
# lvcreate -n data001 -l100%FREE centosvg1
Logical volume "data001" created.
(용량 명시하여 할당시 -L 옵션 사용, # lvcreate -n data001 -L100GB centosvg1)
# lvdisplay
--- Logical volume ---
...
--- Logical volume ---
LV Path /dev/centosvg1/data001
LV Name data001
VG Name centosvg1
LV UUID LrNpVH-XirB-kGLg-7I3n-ZAdp-lvUW-2lP1a3
LV Write Access read/write
LV Creation host, time localhost, 2020-03-10 03:00:39 +0900
LV Status available
# open 0
LV Size <931.51 GiB
Current LE 238466
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:8
# mkfs.xfs /dev/centosvg1/data001
meta-data=/dev/centosvg1/data001 isize=512 agcount=4, agsize=61047296 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=244189184, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=119233, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
# cd /
# mkdir /data001
# mount -t xfs /dev/centosvg1/data001 /data001
# df -kP
Filesystem 1024-blocks Used Available Capacity Mounted on
...
/dev/mapper/centosvg1-data001 976279804 32992 976246812 1% /data001
# pvdisplay
--- Physical volume ---
...
--- Physical volume ---
PV Name /dev/sdb1
VG Name centosvg1
PV Size 931.51 GiB / not usable 4.71 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 238466
Free PE 0
Allocated PE 238466
PV UUID TPAgt6-V2Ii-83Li-9Pq4-Q0Yh-FNmL-1ycugC
# vi /etc/fstab
/dev/mapper/centosvg1-data001 /data001 xfs defaults 0 0
: 추가후 저장
요약정리: 파티션 생성(fdisk) -> PV 생성 -> VG 생성 -> LV 생성 -> 파일시스템 생성(mkfs) -> mount point 생성 -> mount -> 파일시스템 테이블 추가 (삭제 및 제거는 역순)
특이사항 참고: http://saintrv.egloos.com/v/2734571
코딩 공작소 : LVM 하드 추가하기 (새로 추가하는게 아니라 사용하던 하드 추가)
saintrv.egloos.com
반응형
'OS > Linux' 카테고리의 다른 글
[CentOS 7] PHP 설치(APM, Source Compile) (0) | 2020.04.06 |
---|---|
[CentOS 7] Apache HTTP Server/Tomcat 연동(mod_jk, Source Compile) (0) | 2020.04.04 |
[CentOS 7] SSH/SFTP 설정 (0) | 2020.03.07 |
[Linux/UNIX] 로그 확인시 특정라인 이후 내용 보는 팁(cat, grep, sed 활용) (0) | 2020.03.05 |
[GNU/Linux] LibreOffice Install&Uninstall (0) | 2020.03.04 |