Linuxでは、新しいハードディスクの詳細をマウントします。

5237 ワード

http://blog.csdn.net/sanshiqiduer/article/details/5954725
http://blog.chinaunix.net/uid-25829053-id-3067619.html
この二つのウェブサイトによって完成できます。コピーデータは以下の通りです。
阿里雲サーバーに対して、システムの初建を行います。
(一)ハードディスクの分布を見て、新しいハードディスクをパーティションします。
[root@cncmailダタ1 fdisk-l ## ここは現在のシステムを調べています。いくつかのハードディスクがあります。
Disk/dev/sda:36.4 GB、36401479680 bytes  255 heads、63 sectors/track、4425 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Device Boot Start End Blocks Id System  /dev/sda 1*1 255 208256 83 Linux  /dev/sda 2 256 10241437+83 Linux  /dev/sda 3 4296 4425 104225 82 Linux swap  /dev/sda 4 1531 4295 22209862+f Win 95 Ext'd(LBA)  /dev/sda 5 1531 2805 10241406 83 Linux  /dev/sda 6 2806 4295 11968393+83 Linux
Partation table entries are not in disk order
Disk/dev/sdb : 36.7 GBで、36703918080 bytes菷ここで発見されました/dev/sdb、容量は36.7 Gで、まだパーティションに切断されていません。  255 heads、63 sectors/track、4462 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Disk/dev/sdc doesn't contain a valid partition table  [root@linuxroot fdisk/dev/vdb ## 次は/dev/sdbパーティションをパーティションします。
The number of cylinders for this disk is set to 4462.  The re is nothing wrong with that、but this is larger than 1024、  and could in certain setups cause problems with:  1)ソフトウェアthat runs at boot time(e.g.,old versions of LILO)  2)bootting and partitioning software from other OSS  (e.g.DOS FDISK,OS/2 FDISK)
Command(m for help): m  Command action  a togggle a bootble flags  b edit bsd disklabel  c toggle the dos comptibility flags  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テーブル  p print the partition table  q quit without saving changes  s create a new empty Sunddisklabel  t change a partition's system id  u change display/entry units  v verify the partitionテーブル  w write table to disk and exit  x extra functionlity(experts only)
Command(m for help): p ## 現在のハードディスクの下のパーティションリストを印刷します。
Disk/dev/sdb:36.7 GB、36703918080 bytes  255 heads、63 sectors/track、4462 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Device Boot Start End Blocks Id System
Command(m for help): n ## パーティションを追加  Command action  e exteded  p primary partition(1-4) ## メインパーティションは通常選択されていますので、ここでPを打ちます。 p  Partion number(1-4):1 ## ここは最初のパーティションですので、1だけを選択して、2番目のパーティションなら、2を選択して、順番に類推します。  First cylinder(1−4462、default 1): ## 新しいパーティションの開始ディスクブロック  Using default value 1  Last cylinder or+size or+size or+sizeK(1-4462,default 4462): もしパーティション10 Gが必要なら、ここで直接入力できます。ここでは全部ハードディスクの空間を使うので、デフォルトで使います。  Using default value 4462
Command(m for help): p
Disk/dev/sdb:36.7 GB、36703918080 bytes  255 heads、63 sectors/track、4462 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Device Boot Start End Blocks Id System  /dev/sdb 1 4462 35840933+83 Linux ## ここで最初のパーティションが分かれました。このパーティションをハードディスクに書き込みます。  Command(m for help): w  The partition table has been altered!
Calling ioctl()to re-read partitioioioionition table.  Syncing disk.
(二) 次の仕事はこのハードディスクをフォーマットすることです。 ,私はここでext 3にフォーマットしています。  [root@linuxroot mke 2 fs-j/dev/vdb 1  mke 2 fs 1.32(09-Nov-2002)  Filesystem label=  OS type:Linux  Block size=4096(log=2)  Fragment size=4096(log=2)  4480448 inodes、8960245 blocks  448012 blocks(5.00%)rerrved for the super user  First data block=0  274 block groups  32768 blocks per group,32768 framents per group  16352 inodes per group  Superblock backup stored on blocks:  32768、98304、163840、229376、294912、819200、884736、1605632、2654208、  4096000,79624
Writing inode tables:done  Creating jurnal(8192 blocks):done  Writing super blocks and filesystem accounting information: done
This filesystem will be autticaally checked every 23 mounts or  180 days、whichever compes first.Use tune 2 fs-c or-i to override.
フォーマットができているかどうか確認してください。  [root@linuxroot.⑵璖fdisk-l
Disk/dev/sda:36.4 GB、36401479680 bytes  255 heads、63 sectors/track、4425 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Device Boot Start End Blocks Id System  /dev/sda 1*1 255 208256 83 Linux  /dev/sda 2 256 10241437+83 Linux  /dev/sda 3 4296 4425 104225 82 Linux swap  /dev/sda 4 1531 4295 22209862+f Win 95 Ext'd(LBA)  /dev/sda 5 1531 2805 10241406 83 Linux  /dev/sda 6 2806 4295 11968393+83 Linux
Partation table entries are not in disk order
Disk/dev/sdb:36.7 GB、36703918080 bytes  255 heads、63 sectors/track、4462 cylinders  ユニティ=cylinders of 16065*512=8225280 bytes
Device Boot Start End Blocks Id System /dev/sdb 1 4462 35840933+83 Linux
fdisk-lを入力してください。先のパーティションが見えます。後で使います。
mkfs-t ext 3-c/dev/vdb 1
フォーマットを行います。複数のパーティションがあれば、sdb 1をsdb 2 sdb 3に変更できます。これを類推して、具体的にはfdisk-lで各パーティションの名前を見ることができます。
上の図の青い部分はハードディスクの巻き取りを書いています。巻き取りをしたくないなら、直接に車を押すことができます。今はパーティションができました。このパーティションをマウントして使えます。ここでmntディレクトリの下に載せてもいいです。自分でディレクトリを作って載せてもいいです。
mount/dev/vdb 1/alidata
パーティションのサイズが予定通りかどうかを見てください。df-THコマンドを使って、現在マウントされているパーティションとサイズを見てください。私たちが割り当てたパーティションを見ました。
システムを再起動するたびに、このパーティションの変更/etc/fstabファイルを自動的にマウントすることができます。
vi /etc/fstab
は最後の位置に追加されます。
/dev/vdb1  /alidata ext3 defaults 0 0
Esc:wq保存後、マシンを再起動すると、自動的にハードディスクをマウントします。さもないと、マシンを再起動するたびに、手動でマウントする必要があります。