• 흐림동두천 2.2℃
  • 흐림강릉 1.4℃
  • 구름많음서울 2.4℃
  • 구름많음대전 3.3℃
  • 흐림대구 5.9℃
  • 흐림울산 5.2℃
  • 구름많음광주 4.5℃
  • 구름많음부산 6.3℃
  • 구름많음고창 0.8℃
  • 흐림제주 8.7℃
  • 구름많음강화 -1.0℃
  • 구름많음보은 1.3℃
  • 구름많음금산 1.9℃
  • 흐림강진군 5.0℃
  • 흐림경주시 3.8℃
  • 구름많음거제 7.6℃
기상청 제공

Linux상에서 하드디스크 추가하기

#############################

# 하드추가와 파티션 나누기

#        2005. 5. 11 이황배

#        kosthb@gmail.com

#############################

 

[root@112s /]# fdisk /dev/sdc     ==> 세번째 하드 추가/파티션나누기

 

The number of cylinders for this disk is set to 4462.

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): p           ==> 하드 상태를 본다 "p" 엔터

  

isk /dev/sdc: 255 heads, 63 sectors, 4462 cylinders

Units = cylinders of 16065 * 512 bytes

 

   Device Boot    Start       End    Blocks   Id  System

 

Command (m for help): n            ==> 현재 아무런 파티션도 없는 상태이다.

                                                        "n"으로 새로운 파티션을 추가한다

Command action

   e   extended

   p   primary partition (1-4)

p 선택 후 엔터

Partition number (1-4): 1          ==> 파티션 번호를 지정

 

First cylinder (1-4462, default 1):  ==> 값을 넣주는데 default값이 1이다.

Using default value 1              ==> default값인 1이 사용된다는 메시지다.

Last cylinder or +size or +sizeM or +sizeK (1-4462, default 4462): +2000M  ==> 용량을 적는다

[[ 용량은 +sizeM(메가단위), +sizeK(키로단위) 로 하면 된다 ]]

 

==> 현재 작업에서는 2000MB를 설정해주었다.

 

Command (m for help): p             ==> "p"를 입력하여 상태를 확인한다.

 

Disk /dev/sdc: 255 heads, 63 sectors, 4462 cylinders

Units = cylinders of 16065 * 512 bytes

 

   Device Boot    Start       End    Blocks   Id  System

/dev/sdc1             1       255   2048256   83  Linux

 

==> /dev/sdc1 으로 2GB로 파티션이 생겨났다.

 

Command (m for help): n            ==> 새로운 파티션을 하나 더 추가하겠다.

 

Command action

   e   extended

   p   primary partition (1-4)

2

Invalid partition number for type `2'

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 2           ==> "2"로 두번째 파티션을 추가하겠다.

 

First cylinder (256-4462, default 256): 256   ==> 기본값은 256이다. 입력하든 않하든 상관없다.

Last cylinder or +size or +sizeM or +sizeK (256-4462, default 4462):    ==>원하는 용량을 적는다.

Using default value 4462

 

여기에서 보면, 현재 작업중인 파티션외에 새로운 파티션이 더 필요하다면 해당 공간을 남겨두고 작업하고, 이게 마지막 파티션이라면 모두 선택하도록 한다.

기본값이 모두 선택으로 나와있어서 입력하지않고 바로 엔터를 쳤다.

 

Command (m for help): p            ==> 하드상태를 확인해보자

 

Disk /dev/sdc: 255 heads, 63 sectors, 4462 cylinders

Units = cylinders of 16065 * 512 bytes

 

   Device Boot    Start       End    Blocks   Id  System

/dev/sdc1             1       255   2048256   83  Linux      ==> 첫번째나눈 파티션

/dev/sdc2           256      4462  33792727+  83  Linux      ==> 두번째나눈 파티션

 

Command (m for help): w             ==> "w"로 저장하고 나온다.

 

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

information.

Syncing disks.

You have new mail in /var/spool/mail/root

 

파티션 나누는 작업은 이로서 끝이 났다.

 

 

########################################################################################

 

 

ext3 파일 시스템으로 포맷하기

=======================================================

root@112s /]# mke2fs -j /dev/sdc1       ==> 첫번째 파티션 포맷하기

mke2fs 1.26 (3-Feb-2002)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

256512 inodes, 512064 blocks

25603 blocks (5.00%) reserved for the super user

First data block=0

16 block groups

32768 blocks per group, 32768 fragments per group

16032 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912

 

Writing inode tables: done                           

Creating journal (8192 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@112s /]# mke2fs -j /dev/sdc2      ==> 두번째 파티션 포맷하기

mke2fs 1.26 (3-Feb-2002)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

4227072 inodes, 8448181 blocks

422409 blocks (5.00%) reserved for the super user

First data block=0

258 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

 

Writing inode tables: done                           

Creating journal (8192 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.

 

포맷 완료

 

 

/etc/fstab 수정하기

=======================================================

/dev/sdc1        /파티션명                   ext3    defaults,noatime        1 2

/dev/sdc2        /파티션명                 ext3    defaults        1 2

 

위 두줄을 /etc/fstab에 추가해주면 된다.


 

 

나눈 하드를 마운트시켜준다.

[root@112s /]# mount /wecan3

[root@112s /]# mount /var2

mount: mount point /var2 does not exist

 

문제발생

/var2가 존재하지 않는다고 나온다.

이 문제는 / 가서 /var2디렉토리를 만들어주면 해결된다.

 

다시 마운트시킨다.

 

[root@112s /]# mount /var2

  

 모두 끝났다.