티스토리 뷰

Linux

[ Linux ] 볼륨(Volume) 마운트 하기

구티맨 2020. 9. 17. 13:54

새로운 볼륨 스토리지를 마운트 하는 방법에 대해 알아보겠습니다.

 

추가된 볼륨을 PC에서 인식하고, 사용하기 위해서는 볼륨을 파티셔닝하고, 마운트 작업을 해주어야 합니다.

 

1. 추가된 볼륨 조회

fdisk 명령어로 볼륨 조회를 해보면, 2개의 Disk가 있습니다.( /dev/vda 와 /dev/vdb )

/dev/vda 디스크는 /dev/vda1 에 마운트가 되어있는 상태이고,

/dev/vdb 디스크는 새롭게 추가된 볼륨으로, 파티셔닝 및 마운트 작업을 해보도록 하겠습니다.

$ sudo fdisk -l

Disk /dev/vda: 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: 0x0009bedf

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    41943006    20970479+  83  Linux

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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/vdb 디스크는 아직 마운트가 되지 않은 것을 확인할 수 있습니다.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   16G  3.6G  81% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  398M  3.6G  10% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1801
tmpfs           799M     0  799M   0% /run/user/1799

 

2. 파티셔닝

fdisk 명령어로 /dev/vdb 디스크를 파티셔닝을 해줍니다.

n > p > 1 > enter > enter > w 순으로 입력을 하면 됩니다.

$ sudo fdisk /dev/vdb
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 0xc332f07d.

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

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

 

3. 마운트

mount 명령어로 /dev/vdb 디스크를 /DATA 에 마운트를 시켜줍니다.

그리고 df 로 마운트가 잘 되었는지 확인 할 수 있습니다.

마지막으로 fstab에 마운트 정보를 기록해둡니다.( ex. /dev/vdb /DATA ext3 defaults 1 2 )

fstab에 작성을 하지 않으면, 재부팅시에 위의 마운트 설정들이 모두 초기화가 됩니다.

$ sudo mount /dev/vdb /DATA
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   16G  3.6G  82% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  358M  3.6G   9% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1801
tmpfs           799M     0  799M   0% /run/user/1799
/dev/vdb        9.8G   23M  9.2G   1% /DATA
$ sudo vi /etc/fstab

fstab 에 작성 형식은, device-spec, mount-point, fs-type, options, dump, pass 순 입니다.

자세한 내용은 링크를 참조하시면 됩니다.

 

참조

fstab : en.wikipedia.org/wiki/Fstab

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함