macsplex.com 로그인

검색

조회 수 132 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
Extra Form

하드디스크 용량이 부족하거나, 백업이 필요할 때 새로운 하드디스크를 장착한다.
하드디스크만 장착한다고 해서 절대로 자동으로 올라오지 않는다.

먼저 시스템 전원을 내리고 하드디스크를 장착한다. 하드디스크를 장착한 후 /var/log/dmesg 내용을 확인하여 새롭게 장착한 하드디스크가 제대로 인식되었느지 확인한다.
IDE 방식의 하드디스크는 hda, hdb, hdc 등으로 잡히고, SCSI나 SATA의 경우에는 sda, sdb, sdc 등올 잡힌다.

[root@adminviva ~]# cat /var/log/dmesg | grep sdb
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: cache data unavailable
sdb: assuming drive cache: write through
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: cache data unavailable
sdb: assuming drive cache: write through
 sdb: unknown partition table
Attached scsi disk sdb at scsi0, channel 0, id 1, lun 0

하드디스크가 시스템에 제대로 인식되었다면, fdisk로 파티션을 나눠야 한다.
새로운 파티션을 만들기 위해 n 명력으로 파티션을 디스크 통째로 잡는다. 물론 사용 용도에 따라서 파티션을 여러 개로 나눌 수도 있다.

[root@adminviva ~]# 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.


The number of cylinders for this disk is set to 1044.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

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
   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
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044

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

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

파티션을 나눴으면, 파일시스템을 만들어야 한다. 파티션을 잡은 /dev/sdb1을 ext3로 파일시스템을 만든다.
여기서도 사용하고자 하는 파일시스템을 사용하면 된다.

[root@adminviva ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 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

Writing inode tables: done                           
Creating journal (8192 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.

파일시스템을 만들었으면, 마운트할 디렉토리를 하나 생성한 후 마운트를 시켜본다.

[root@adminviva ~]# mkdir /home2
[root@adminviva ~]# mount -t ext3 /dev/sdb1 /home2

제대로 마운트가 되었는지 mount 명령과 df를 통해 확인하자.

[root@adminviva ~]# mount
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
/dev/sda6 on /home type ext3 (rw)
/dev/sda3 on /usr type ext3 (rw)
/dev/sda2 on /var 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)
/dev/sdb1 on /home2 type ext3 (rw)

[root@adminviva ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             2.9G  150M  2.6G   6% /
none                  125M     0  125M   0% /dev/shm
/dev/sda6              15G   68M   14G   1% /home
/dev/sda3             5.8G  1.2G  4.4G  21% /usr
/dev/sda2             5.8G   98M  5.4G   2% /var
/dev/sdb1             7.9G   51M  7.5G   1% /home2
[root@adminviva ~]#

정상적으로 마운트가 된 것을 확인한 후 /etc/fstab 파일에 새롭게 추가한 디스크의 파일시스템 정보를 추가하자. /etc/fstab에 추가하여야 부팅 시 자동으로 마운트가 된다.
/etc/fstab 을 수정한 후 꼭 재부팅을 해보는 것이 좋다. 우선은 그냥 사용해도 무방하지만, /etc/fstab 파일을 잘못 수정하여 추후에 원격지에서 재부팅을 했는데, 제대로 부팅이 안되면 난감해지니 서버 옆에 있을 때 확인해 보는 것이 좋을듯 하다.

[root@adminviva ~]# vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
LABEL=SWAP-sda5         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
/dev/sdb1               /home2                  ext3    defaults        1 2
~
~
"/etc/fstab" 13L, 976C written                                                     
[root@adminviva ~]# reboot




--------------------------------------------------광고(Advertising)-------------------------------------------------------------------------------------