강좌
클라우드/리눅스에 관한 강좌입니다.
자격증 분류

디스크 확장-시스템의 재부팅

작성자 정보

  • 관리자 작성
  • 작성일

컨텐츠 정보

본문

디스크 확장-시스템의 재부팅

 





hot-swap이 지원되는 시스템의 경우에는 재부팅할 필요가 없지만, 이 기능이 지원되지 않는다면 하드웨어 장착 후에 전원을 켜고 리눅스 시스템을 다시 부팅한다.

 

 

 

이렇게 시스템을 부팅하면 물리적으로 새로 추가한 하드 디스크를 리눅스 커널이 인식하게 된다.

 

 

 

 

관리자는 이와 같이 새로 장착한 하드 디스크를 리눅스 커널이 인식하였는가를 확인해야 한다.

 

 

 

리눅스 커널이 하드 디스크를 인식하였는지는 fdisk 명령을 이용하여 하드 디스크 현황을 출력해도 되고, dmesg로 메시지를 이용하여 부팅메시지를 확인해도 된다.

 

 

 

 

먼저 fdiskl 옵션을 사용하여 명령을 내리면 다음과 같이 출력한다.

 

 

 

아래의 결과를 보면 /dev/sdb라는 새로운 하드 디스크 장치가 추가되어 있음을 알 수 있다.

 

 

 

이것이 새로 장착한 하드 디스크의 장치명이다.

 

 

 

 

 

 

 

 

 

[root@localhost ~]# fdisk -l

 

Disk /dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 1044 8281507+ 83 Linux

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdb doesn't contain a valid partition table

[root@localhost ~]#

 

 

 

 

 

 

 

그리고 새로운 하드 디스크가 인식되었는가를 확인하려면 dmesg 라는 부팅 메시지 확인 명령어를 이용해도 된다.

 

 

 

아래의 dmesg 실행 결과에서도 /dev/sdb라는 새로운 장치가 추가되어 있다는 것을 알 수 있다.

 

 

 

 

 

 

 

 

 

[root@localhost ~]# dmesg | grep SCSI

SCSI subsystem initialized

Type: Direct-Access ANSI SCSI revision: 05

SCSI device sda: 16777216 512-byte hdwr sectors (8590 MB)

SCSI device sda: drive cache: write back

SCSI device sda: 16777216 512-byte hdwr sectors (8590 MB)

SCSI device sda: drive cache: write back

Type: Direct-Access ANSI SCSI revision: 05

SCSI device sdb: 4194304 512-byte hdwr sectors (2147 MB)

SCSI device sdb: drive cache: write back

SCSI device sdb: 4194304 512-byte hdwr sectors (2147 MB)

SCSI device sdb: drive cache: write back

[root@localhost ~]#

 

 

 

 

 

 

디스크 확장-파티션 작업

 

새로 추가한 하드 디스크에 대한 파티션 작업을 해야 한다.

 

 

 

앞에서도 배웠듯이 파티션 작업은 fdisk를 이용한다.

 

 

 

조금 쉽게 설명하기 위해 다음과 같이 전체 용량을 하나의 파티션으로 설정하였다.

 

 

 

 

 

 

 

 

 

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

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

Building a new DOS disklabel. 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)

 

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-261, default 1): 261

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]#

 

 

 

 

 

 

 

다음은 설정된 파티션을 확인한 것이다.

 

 

 

새로운 하드 디스크의 전체 용량이 /dev/sdb1이라는 하나의 파티션으로 설정되어 있음을 확인할 수 있다.

 

 

 

 

 

 

 

 

[root@localhost ~]# fdisk -l /dev/sdb

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot Start End Blocks Id System

/dev/sdb1 261 261 8032+ 83 Linux

[root@localhost ~]#

 

 

 

 

 

 

파일 시스템 포맷(생성)

 

 

새로운 하드 디스크의 장치명인 /dev/sdb1 이름으로 다음과 같이 파일 시스템 포맷 작업을 수행하였다.

 

 

 

 

 

 

 

 

 

# mkfs -t ext4 /dev/sdb1

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

2008 inodes, 8032 blocks

401 blocks (4.99%) reserved for the super user

First data block=1

Maximum filesystem blocks=8388608

1 block group

8192 blocks per group, 8192 fragments per group

2008 inodes per group

 

Writing inode tables: 0/1done

Creating journal (1024 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 37 mounts or

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

 

 

 

 

위와 같이 파일 시스템이 생성되고 나면 다음과 같은 정보들을 확인해 보기 바란다.

 

 

 

 

 

OS type : Linux

 

Block size : 1024

 

Fragment size : 1024

 

전체 inodes 개수 : 2008 inodes

 

전체 block 개수 : 8032 blocks

 

예비 블록 개수 : 401 blocks (4.99%)

 

첫 번째 데이터 블록 번호 : 1

 

블록그룹 개수 : 1 block groups

 

블록그룹당 블록 개수 : 8192 blocks per group

 

블록그룹당 Fragment 개수 : 8192 fragments per group

 

블록그룹당 inode 개수 : 2008 inodes per group

 

 

 

 

마운트포인트(디렉토리) 생성

 

다음과 같이 마운트포인트를 생성한다.

 

 

 

물론 아래 mkdir로 생성하는 /backup 이라는 디렉토리는 새로 생성한 /dev/sdb1과 마운트할 위치(디렉토리)이다.

 

 

 

 

 

 

 

 

 

[root@localhost ~]# mkdir /backup

[root@localhost ~]# ls l /backup

합 계 0

[root@localhost ~]#

 

 

 

 

 

 

마운트 작업

 

다음과 같이 마운트를 수행한다.

 

 

 

아래 마운트 작업은 /dev/sdb1 이라는 장치를 /backup 이라는 마운트포인트와 연결하는 작업이다.

 

 

 

 

 

 

 

 

 

[root@localhost ~]# mount /dev/sdb1 /backup

[root@localhost ~]#

 

 

 

 

 

정상적으로 마운트가 수행되었기 때문에 다음과 같이 mount 명령을 수행해 보면 마운트되었다는 정보를 확인할 수 있다.

 

 

 

이제부터는 /backup 디렉토리를 통해서 새로운 하드 디스크상에 파일의 저장, 디렉토리의 생성 등을 할 수 있다.

 

 

 

 

 

 

 

 

 

[root@localhost ~]# mount

/dev/sda2 on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda1 on /boot type ext4 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc(rw)

/dev/sdb1 on /backup type ext4 (rw)

[root@localhost ~]#

 

 

 

 

 

 

 

 

 

 

 

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,043 명
  • 현재 강좌수 :  35,853 개
  • 현재 접속자 :  92 명