LVM(Logical Volume Manger) 설정

in #lvm7 years ago (edited)

LVM(Logical Volume Manager)를 사용하여 저장공간을 늘려야 하는 부분이 있어서 설정한 내용을 정리해본다. 본 자료는 CentOS 7에서 진행된 내용을 기반으로 작성되었지만 다른 Linux에서도 활용할 수 있을 것으로 예상된다.

  1. partition 설정
  • 2TB 이상
    #parted /dev/sd[Device]
    #parted>print
    #parted>mklabel gpt
    #parted>mkpart primary 0 [최대용량]
    #parted>set 1 lvm on
    
  • 2TB 이하
    fdisk /dev/sd[Device]
    #fdisk>n (new partition)
    #fdisk>p (primary)
    #fdisk>1 (partition number)
    #fdisk>t (new type)
    #fdisk>8e (linux LVM)
    #fdisk>w (write)
    
  1. PV(Physical Volume) 생성
    pvcreate /dev/sd[Device][no]
    pvdisplay
    
    pvcreate /dev/sdb1
    Physical volume "/dev/sdb1" successfully created
    
  2. VG(Volume Group) 생성
    vgcreate [vg-name] /dev/sd[Device][no] /dev/sd[Device][no]
    vgdisplay
    
    vgcreate data-vg01 /dev/sdb1 /dev/sdc1
    Volume group "data-vg01" successfully created
    
  3. LV(Logical Volume) 생성
    lvcreate --extents 100%FREE -n [lv-name] [vg-name]
    lvdisplay
    
    lvcreate --extents 100%FREE --name data-lv01 data-vg01
    Logical volume "data-lv01" created.
    
  4. 포맷
    mkfs -t ext4 /dev/[vg-name]/[lv-name]
    
  5. fstab 추가
    mkdir [mount-point]
    vi /etc/fstab
    /dev/[vg-name]/[lv-name]  /[mount-point]  ext4  defaults  0  2
    mount -a
    mount
    

Azure에서 Linux VM에 LVM 구성
[스토리지] 리눅스 LVM 생성
[스토리지] 2TB 이상 스토리지의 파티션 생성 (리눅스 GPT, parted)

Sort:  

Congratulations @lawnseol! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - A better rich list comparator
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @lawnseol! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!