본문 바로가기
OS-OE Knowledge/Linux-Unix KB

RHEL7/Add new volume disk

by 스쳐가는인연 2019. 8. 30.

Summary

fdisk:

# fdisk /dev/sdb     #추가된 Disk
n                         #파티션 생성
w                        #변경사항 기록

e.g.) /dev/sdb의 partition 1 > /dev/sdb1

# pvcreate /dev/sdb1                              #물리볼륨 생성
# vgcreate vgdata1 /dev/sdb1                   #볼륨그룹 생성
# lvcreate -n lvdata1 -l 100%FREE vgdata1   #논리볼륨 생성

# mkfs.ext4 /dev/vgdata1/lvdata1                  #파일시스템 생성

# mkdir /Depot                                         #마운트포인트 생성
# mount -t ext4 /dev/vgdata1/lvdata1 /Depot  #마운트

# df -l                    #상태 확인


gdisk:
------------------------
# gdisk /dev/sdc
p       << print partition table
n
W
------------------------


parted:
# parted /dev/sdc
------------------------
# parted
# select /dev/sdc
------------------------

------------------------
# mktable gpt  << gpt
------------------------
# mktable msdos << mbr
------------------------

------------------------
# mkpart primary ext4 0% 400GB
# mkpart primary ext4 0% 100%
------------------------

# align-check optimal 1

# quit

# partprobe /dev/sdc

# mkfs.ext4 -L <%PartitionName-Label%> /dev/sdc1
# mkfs.ext4 -L 900GB /dev/sdc1
# e2label /dev/sda1 <%newlabel%>

# mkdir -p /900GB
# mount -o defaults /dev/sdc1 /900GB

#cat /etc/fstab
--------------------------
## select one method
/dev/sdc1 /900GB ext4 defaults 0 2
# UUID=4b313333-a7b5-48c1-a957-d77d637e4fda /mnt/data ext4 defaults 0 2
# LABEL=900GB /900GB ext4 defaults 0 2
--------------------------


참조:
https://www.certdepot.net/rhel7-create-delete-partitions/
https://www.digitalocean.com/community/tutorials/how-to-partition-and-format-storage-devices-in-linux

반응형