Cloud

xfs 로 디스크 생성하기 본문

카테고리 없음

xfs 로 디스크 생성하기

Firewall 2021. 5. 4. 12:20

대세에 따라. xfs 를 사용하기로 함. 안녕 ext4 ㅠㅠ (xfs 를 제외한 나머지는 기존내용 복붙)

 

 

디스크 추가 

 

## insert disk

 

 

 

fdisk /dev/vdb

n

p

1

[enter]

[enter]

w

mkfs.xfs /dev/vdb1

mkdir /data

mount /dev/vdb1 /data

echo "/dev/vdb1               /data                   xfs    defaults,nofail        0    0">>/etc/fstab

 

## insert disk (AWS 에서 NVME disk 를 사용하는듯. 그에 맞게 변형.

 

 

 

fdisk /dev/nvme1n1

n

p

1

[enter]

[enter]

w

mkfs.xfs /dev/nvme1n1p1

mkdir /data

mount /dev/nvme1n1p1 /data

echo "/dev/nvme1n1p1            /data                   xfs    defaults,nofail        0    0">>/etc/fstab

 

 

 

##확인

 

lsblk

 

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

xvda    202:0    0    8G  0 disk

└─xvda1 202:1    0    8G  0 part /

xvdf    202:80   0  500G  0 disk

 

└─xvdf1 202:81   0  500G  0 part /data

 

 

확장 방법은 동일하다. 여기서 xfs_growfs -d 옵션을 쓰는 이유는 디스크 할당양 최대용량을 할당하라는 의미.

[user@server01 ~]# growpart /dev/nvme1n1 1 
CHANGED: partition=1 start=2048 old: size=2147481567 end=2147483615 new: size=4294965215 end=4294967263
[user@server01 ~]# xfs_growfs /dev/vdb1
meta-data=/dev/vdb1              isize=512    agcount=4, agsize=65535936 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=262143744, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=127999, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 262143744 to 524287739

[user@server01 ~]# xfs_growfs -d /home

[user@server01 ~]# df -h 
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G  4.0K   16G   1% /dev/shm
tmpfs            16G  394M   15G   3% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/nvme0n1p1   20G  7.6G   13G  38% /
/dev/nvme1n1p1  2.0T  861G  1.1T  45% /home
tmpfs           3.1G     0  3.1G   0% /run/user/500
tmpfs           3.1G     0  3.1G   0% /run/user/1000
tmpfs           3.1G     0  3.1G   0% /run/user/0
[user@server01 ~]#

복사용

growpart /dev/nvme1n1 1

xfs_growfs -d /home

##ROOT DISK

growpart /dev/nvme0n1 4

xfs_growfs -d /

 

 

이젠resize2fs 안씀

resize2fs /dev/nvme1n1p1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/nvme1n1p1 is mounted on /home; on-line resizing required
old_desc_blocks = 128, new_desc_blocks = 256
The filesystem on /dev/nvme1n1p1 is now 536870651 blocks long.

Comments