본문으로 바로가기

[RHEL7] Disk 추가 및 mount 설정

category Linux/RHEL7 & 8 2021. 7. 5. 11:47
반응형

1. 디스크 추가 

[root@rhosp-tb0-kvm /]#fdisk -l | grep sdc
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdc: 959.7 GB, 959656755200 bytes, 1874329600 sectors
/dev/sdc1   *           1  4294967295  2147483647+  ee  GPT

 

2. 파티션 작업

[root@rhosp-tb0-kvm /]#fdisk /dev/sdc
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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

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): 1
First sector (2048-1874329599, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1874329599, default 1874329599):
Using default value 1874329599
Partition 1 of type Linux and of size 893.8 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@rhosp-tb0-kvm /]#fdisk -l | grep sdc
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdc: 959.7 GB, 959656755200 bytes, 1874329600 sectors
/dev/sdc1            2048  1874329599   937163776   83  Linux

 

 

3. 파일시스템 생성

[root@rhosp-tb0-kvm /]#mkfs.xfs -f /dev/sdc1
meta-data=/dev/sdc1              isize=512    agcount=32, agsize=7321600 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=234290944, imaxpct=25
         =                       sunit=64     swidth=64 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=114432, version=2
         =                       sectsz=512   sunit=64 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

 

4. 마운트 디렉토리 생성 및 자동 마운트 설정

# 마운트 디렉토리 생성
[root@rhosp-tb0-kvm /]#mkdir /sdc-data



# 자동 마운트 설정
[root@rhosp-tb0-kvm /]#vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Nov  5 17:39:25 2020
#
# 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/rhel-root   /                       xfs     defaults        0 0
UUID=1da4ce19-f543-4bae-9af7-d4c308f87064 /boot                   xfs     defaults        0 0
/dev/mapper/rhel-swap   swap                    swap    defaults        0 0
/dev/sdb1 /sdb-data xfs defaults,_netdev 0 0
/dev/sdc1 /sdc-data xfs defaults,_netdev 0 0               <<- 추가

 

5. 마운트

[root@rhosp-tb0-kvm /]#mount -a

[root@rhosp-tb0-kvm /]#df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               189G     0  189G   0% /dev
tmpfs                  189G     0  189G   0% /dev/shm
tmpfs                  189G   13M  189G   1% /run
tmpfs                  189G     0  189G   0% /sys/fs/cgroup
/dev/mapper/rhel-root  1.8T  1.6T  164G  91% /
/dev/sda1             1016M  184M  832M  19% /boot
/dev/sdb1              892G  186G  707G  21% /sdb-data
tmpfs                   38G   12K   38G   1% /run/user/42
tmpfs                   38G     0   38G   0% /run/user/0
/dev/sdc1              894G   34M  894G   1% /sdc-data
728x90