红联Linux门户
Linux帮助

为FreeBSD添加新硬盘

发布时间:2006-10-15 01:27:13来源:红联作者:nxfte
  本文介绍手工为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来确认系统是否找到新添加的硬盘。
  准备[code]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#[/code]初始化磁盘[code]vms# fdisk -BI ad1
******* Working on device /dev/ad1 *******
fdisk: invalid fdisk partition table found
vms#[/code]建立FreeBSD分区[code]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#[/code]建立逻辑分区[code]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*)[/code]格式化分区,创建文件系统[code]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, ...[/code]加载分区[code]vms# mkdir -p /disk1
vms# mount -t ufs /dev/ad1s1e /disk1[/code]
文章评论

共有 0 条评论