歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> BSD >> 為FreeBSD添加新硬盤!

為FreeBSD添加新硬盤!

日期:2017/2/28 11:26:31   编辑:BSD


本文介紹手工為FreeBSD添加新硬盤的一般性方法。假設我們的FreeBSD已經有了一塊IDE硬盤,我們需要為它添加一塊新的IDE硬盤,並把新添加的硬盤的所有空間作為一個分區加載到/disk1下面。
基礎知識
FreeBSD分區描述符為從"a"到"h"的8個字母。根據慣例,分區"c"被保留用作描述整個磁盤,"a"用作標識根分區,"b"用作標識交換分區。對於新添加的硬盤,我們常常只建立一個分區,標識為"e"。
IDE硬盤標記為ad,而SCSI硬盤標記為da,從0開始計數,因此,我們新添加的IDE硬盤將作為ad1出現在系統中。
一般步驟
把新的IDE硬盤接入系統,並確認開機以後系統找到了新添加的硬盤。可以通過檢查/var/run/dmesg.boot來確認系統是否找到新添加的硬盤。
准備
vms# dd if=/dev/zero of=/dev/rad1 bs=1k count=1
1+0 records in
1+0 records out
1024 bytes transferred in 0.000822 secs (1245640 bytes/sec)
vms#
初始化磁盤
vms# fdisk -BI ad1
******* Working on device /dev/ad1 *******
fdisk: invalid fdisk partition table found
vms#
建立FreeBSD分區
vms# disklabel -B -w -r ad1s1 auto
vms# Feb 23 14:01:40 /kernel: ad1: cannot find label (no disk label)
Feb 23 14:01:40 /kernel: ad1s1: cannot find label (no disk label)
Feb 23 14:01:40 /kernel: ad1: cannot find label (no disk label)
Feb 23 14:01:40 /kernel: ad1s1: cannot find label (no disk label)
vms#
建立邏輯分區
vms# disklabel -e ad1s1
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 18931
sectors/unit: 19083393
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 19083393 0 unused 0 0 # (Cyl. 0 - 18931*)
e: 19083393 0 4.2BSD 4096 8192 16 # (Cyl. 0 - 18931*)
格式化分區,創建文件系統
vms# newfs /dev/ad1s1e
Warning: Block size and bytes per inode restrict cylinders per group to 67.
Warning: 3968 sector(s) in last cylinder unallocated
/dev/ad1s1e: 19083392 sectors in 4660 cylinders of 1 tracks, 4096 sectors
9318.1MB in 70 cyl groups (67 c/g, 134.00MB/g, 8512 i/g)
super-block backups (for fsck -b #) at:
32, 274464, 548896, 823328, 1097760, 1372192, 1646624, 1921056, 2195488, 2469920, 2744352, 3018784, 3293216, 3567648,
3842080, 4116512, 4390944, 4665376, ...
加載分區
vms# mkdir -p /disk1
vms# mount -t ufs /dev/ad1s1e /disk1
Copyright © Linux教程網 All Rights Reserved