CentOS 하드디스크 추가시 마운트하기



기존 하드디스크 이외에 하나더 추가할 경우 포맷하고 마운트를 하여야 합니다.


먼저 fdisk -l 로 Disk 정보를 확인합니다.


[root@vps ~]# fdisk -l


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

...


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00000000


/dev/sdb 로 확인되었습니다.


이제 파티션을 잡아야 합니다.


[root@vps ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0xbf2eadcc.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.


Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)


The device presents a logical sector size that is smaller than

the physical sector size. Aligning to a physical sector (or optimal

I/O) size boundary is recommended, or performance may be impacted.


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').


Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-121601, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-121601, default 121601):

Using default value 121601


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.


굵은파란색을 보시면 됩니다.


파티션을 잡은 뒤에는 포맷을 합니다.


[root@vps ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

/dev/sdb1 alignment is offset by 512 bytes.

This may result in very poor performance, (re)-partitioning suggested.

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=1 blocks, Stripe width=0 blocks

61054976 inodes, 244190000 blocks

12209500 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

7453 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, 20480000, 23887872, 71663616, 78675968,

        102400000, 214990848


Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.


시간이 조금 걸립니다.


이제 마운트를 하면 됩니다.


uuid 로 마운트를 해볼까요~


[root@vps ~]# blkid /dev/sdb1

/dev/sdb1: UUID="5a76eec0-4b80-d3c4-9de4-302bffcc898c" TYPE="ext4"


UUID 를 복사해서 /etc/fstab 에 아래 처럼 추가합니다.


UUID=5a76eec0-4b80-d3c4-9de4-302bffcc898c /hdd2 ext4 defaults 1 1


/hdd2 는 미리 만들어 주어야 합니다. (mkdir /hdd2)


# mount -a 로 마운트 하면 됩니다.


# df -h 로 제대로 마운트 되었는지 확인합니다.


블로그 이미지

iVPS 영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

댓글을 달아 주세요