리눅스에서 하드디스크를 추가할 경우 시스템에서 사용할수 있도록 만드는 방법을 소개합니다.
새로운 하드디스크가 정상적으로 인식 되었는지 확인 합니다.
[root@ruo91 ~]# fdisk -l/dev/sdb 가 새로 추가한 하드디스크로 인식이 되었으므로 새로운 파티션을 추가 해줍니다.
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
fdisk 에서 n 명령어로 파티션을 추가 한뒤 p 명령어로 첫번째 파티션을 지정해줍니다.
그 다음엔 첫번째 실린더와 마지막 실린더를 지정 해주고 w 로 파티션 정보를 저장하고 나갑니다.
[root@ruo91 ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 65270.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270): 65270
Command (m for help): p
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Command 설명
a - 부트 가능한 플래그로 변경
b - bsd 디스크 레이블을 편집
c - 도스 호환 플래그로 변경
d - 파티션 삭제
l - 리눅스에서 지원하는 파티션 목록보기
m - 메뉴보기
n - 새로운 파티션 생성
o - 새로운 도스 파티션 테이블 생성
p - 현재 파티션 설정 상태 확인
q - 설정한 파티션 저장하지 않고 종료
s - 새로운 Sun 디스크 레이블 생성
t - 파티션 시스템 유형 변경
u - 표시/항목 단위를 변경
v - 파티션 레이블 점검
w - 설정한 파티션을 저장하고 종료
x - 고급 사용자를 위한 명령어
위에서 설정한 파티션 정보를 확인 합니다.
[root@ruo91 ~]# fdisk -l
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
추가한 파티션에 ext3 파일 시스템으로 포멧 해줍니다.
[root@ruo91 ~]# mkfs -t ext3 /dev/sdb
mke2fs 1.39 (29-May-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 block groups
32768 blocks per group, 32768 fragments per group
16384 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
확인을 위해 디렉토리를 하나 생성하고 마운트 해봅니다.
[root@ruo91 ~]# mkdir /home2
[root@ruo91 ~]# mount /dev/sdb /home2
마운트 확인
[root@ruo91 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb on /home2 type ext3 (rw)
파일 생성 확인
[root@ruo91 ~]# cat > /home2/hello.cpp
#include <iostream>
int main()
{
std::cout<< "Hello World!!" <<std::endl;
return 0;
}
[root@ruo91 ~]# g++ -o /home2/hello /home2/hello.cpp
[root@ruo91 ~]# /home2/hello
Hello World!!
마운트 파일 생성 모두 잘되네요.. 이제 부팅시 자동 마운트 하도록 /etc/fstab 파일을 아래 처럼 추가 해줍니다.
[root@ruo91 ~]# vim /etc/fstab
/dev/sdb /home2 ext3 defaults 0 0
재부팅 후 자동 마운트 되면 끝입니다.
[root@ruo91 ~]# reboot
[root@ruo91 ~]# mount자료출처 : http://www.cyworld.com/ruo91/3368109
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdb on /home2 type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
댓글 없음:
댓글 쓰기