리눅스 디스크 추가

1 fdisk 확인[ | ]

[root@zetawiki ~]# fdisk -l /dev/xvdb

Disk /dev/xvdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
→ 디스크 1개를 추가하여 xvdb가 생겼다.

2 파티션 생성[ | ]

[root@zetawiki ~]# fdisk /dev/xvdb
... (생략)
Command (m for help): p

Disk /dev/xvdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7913580d

    Device Boot      Start         End      Blocks   Id  System
	
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527):
Using default value 6527

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

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

3 포맷[ | ]

[root@zetawiki ~]# mkfs.ext4 /dev/xvdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107200 blocks
655360 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

4 디스크 uuid 확인[ | ]

[root@zetawiki ~]# ls -l /dev/disk/by-uuid | grep xvdb
lrwxrwxrwx 1 root root 10 Sep  1 13:41 79135802-4691-35b7-0d2f-46cea81df3b5 -> ../../xvdb

5 마운트[ | ]

  • 마운트 폴더[1] 생성
[root@zetawiki ~]# mkdir /data
  • 마운트 설정파일(/etc/fstab)에 내용 추가
[root@zetawiki ~]# vi /etc/fstab
UUID=79135802-4691-35b7-0d2f-46cea81df3b5 /data      ext4    defaults        1 2
  • 마운트 설정파일 적용 및 확인
[root@zetawiki ~]# mount -a
[root@zetawiki ~]# mount | grep data
/dev/xvdb on /data type ext4 (rw)

6 같이 보기[ | ]

7 참고[ | ]

  1. 파일시스템 트리 상에서 디스크가 붙을 지점
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}