디스크 할당 상태 확인

[root@unply ~]# fdisk -l
 
Disk /dev/xvda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x00099475

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *        2048     2050047     1024000   83  Linux
/dev/xvda2         2050048     6244351     2097152   82  Linux swap / Solaris
/dev/xvda3         6244352    41943039    17849344   83  Linux

Disk /dev/xvdb: 85.9 GB, 85899345920 bytes, 167772160 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

/dev/xvdb 디바이스에 파티션이 존재하지 않는다.

파티션 생성

[root@unply ~]# fdisk /dev/xvdb
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x5ae4a272.

Command (m for help): 

n(add a new partition), p(primary partition (1-4)), 엔터(partition number), 엔터(first sector), 엔터(last sector)를 입력해 파티션을 생성한다.

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

Command (m for help):

w(write table to disk and exit)를 입력해 적용한다.

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@unply ~]# 

파일 시스템 생성

[root@unply ~]# mkfs.xfs /dev/xvdb1
meta-data=/dev/xvdb1             isize=256    agcount=4, agsize=5242816 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=20971264, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=10239, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

디렉토리 생성 후 마운트

[root@unply ~]# mkdir /data
[root@unply ~]# mount /dev/xvdb1 /data

df 명령으로 연결된 디스크 확인

[root@unply ~]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda3      17438068 1499780  15029440  10% /
devtmpfs          929128       0    929128   0% /dev
tmpfs             937540       0    937540   0% /dev/shm
tmpfs             937540    8532    929008   1% /run
tmpfs             937540       0    937540   0% /sys/fs/cgroup
/dev/xvda1        991512  112216    811712  13% /boot
/dev/xvdb1      83844100   32928  83811172   1% /data

/etc/fstab 파일에 다음 내용을 추가해 부팅될 때 자동으로 마운트 되도록 한다.

dev/xvdb1 /data xfs defaults 1 2