Debianにハードディスクを増設

ついにサーバーに160GBのハードディスクを追加しました。

物理的には単純にIDEのプライマリーのスレーブに接続しただけです。
以下はフォーマットとマウントについてメモします。

まずは接続されているか「dmesg」で確認します。

hdb: Maxtor 6Y160P0, ATA DISK drive

とあればOK。たまたま元々つけていたHDDと同じ型番でした。もちろん型番などは違う場合もありますが。
IDE 0:0ならhda
IDE 0:1ならhdb
IDE 1:0ならhdc
IDE 1:1ならhdd
です。

まずは「fdisk」でパーティションの確認。

<code>
$ su
# fdisk /dev/hdb

The number of cylinders for this disk is set to 19929.
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」で現在の設定の確認。
Disk /dev/hdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       19930   160086496+   b  W95 FAT32
</code>

すでにパーティションはあるのでそのまま使用する。「t」でシステムタイプをext3のために83にする。

<code>
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Changed system type of partition 1 to 83 (Linux)
</code>

「w」で保存して終了。

<code>
Command (m for help): 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.
</code>

でext3でフォーマット。

<code>
# mkfs -j /dev/hdb1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
20021248 inodes, 40021624 blocks
2001081 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1222 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

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
</code>

「fstab」にオートマウントするように書き込む。
今回は「backupdisk」というラベルをパーティションに設定し、「/mnt/backupdisk」にマウントするように設定する。
まずはラベルの指定。

<code>
# e2label /dev/hdb1 backupdisk
# e2label /dev/hdb1 //設定の確認
backupdisk
</code>

マウントポイントの作成。

<code>
# mkdir /mnt/backupdata
</code>

「/etc/fstab」をエディタで開き以下の行を追記。

<code>LABEL=backupdisk        /mnt/backupdisk ext3    defaults        0       0</code>

再起動したら自動マウントされました〜。

コメントを残す

メールアドレスが公開されることはありません。

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*