先创建OpenBSD的fdisk分区表
代码: 全选
# [color=royalblue]fdisk -e wd1[/color]
Enter 'help' for information
fdisk: 1> [color=royalblue]p[/color]
Disk: wd1 geometry: 4865/255/63 [78165360 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
*0: A9 0 1 1 - 4865 144 63 [ 63: 78165297 ] NetBSD
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
fdisk: 1> e 0
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
*0: A9 0 1 1 - 4865 144 63 [ 63: 78165297 ] NetBSD
Partition id ('0' to disable) [0 - FF]: [A9] (? for help) a6
Do you wish to edit in CHS mode? [n]
offset: [63]
size: [78165297]
fdisk:*1> [color=royalblue]w[/color]
Writing MBR at offset 0.
fdisk: 1> [color=royalblue]q[/color]
或者按照FAQ上的方法更简单:
代码: 全选
# [color=royalblue]fdisk -i wd1[/color]
Do you wish to write new MBR and partition table? [n] [color=royalblue]y[/color]
Writing MBR at offset 0.
#
然后运行如下命令
代码: 全选
#[color=royalblue]disklabel -e wd1[/color]
代码: 全选
# /dev/rwd1c:
type: unknown
disk: WDC WD400BB-75A
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 77545
total sectors: 78165360
rpm: 3600
interleave: 1
boundstart: 63
boundend: 78165360
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg]
[color=red]a: 5309136 63 4.2BSD 2048 16384 0[/color]
[color=red]b: 263088 5309199 swap[/color]
c: 78165360 0 unused
[color=red]d: 78165360 0 unused[/color]
[color=red]e: 41943888 5572287 4.2BSD 2048 16384 0[/color]
[color=red]f: 8389584 47516175 4.2BSD 2048 16384 0[/color]
[color=red]g: 22259601 55905759 4.2BSD 2048 16384 0[/color]
# Notes:
# Up to 16 partitions are valid, named from 'a' to 'p'. Partition 'a' is
# your root filesystem, 'b' is your swap, and 'c' should cover your whole
# disk. Any other partition is free for any use. 'size' and 'offset' are
# in 512-byte blocks. fstype should be '4.2BSD', 'swap', or 'none' or some
# other values. fsize/bsize/cpg should typically be '2048 16384 16' for a
# 4.2BSD filesystem (or '512 4096 16' except on alpha, sun4, ...)
代码: 全选
# /dev/rwd1c:
type: unknown
disk: WDC WD400BB-75A
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 77545
total sectors: 78165360
rpm: 3600
interleave: 1
boundstart: 63
boundend: 78156225
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg]
c: 78165360 0 unused
[color=royalblue]d: 78165297 63 4.2BSD 1024 8192 16[/color]
# Notes:
# Up to 16 partitions are valid, named from 'a' to 'p'. Partition 'a' is
# your root filesystem, 'b' is your swap, and 'c' should cover your whole
# disk. Any other partition is free for any use. 'size' and 'offset' are
# in 512-byte blocks. fstype should be '4.2BSD', 'swap', or 'none' or some
# other values. fsize/bsize/cpg should typically be '2048 16384 16' for a
# 4.2BSD filesystem (or '512 4096 16' except on alpha, sun4, ...)
还需要建立新的文件系统:
代码: 全选
# [color=royalblue]newfs wd1d[/color]
/dev/rwd1d: 38166.6MB in 78165296 sectors of 512 bytes
763 cylinder groups of 50.05MB, 6406 blocks, 12864 inodes each
super-block backups (for fsck -b #) at:
32, 102528, 205024, 307520, 410016, 512512, 615008, 717504, 820000, 922496, 1024992,
1127488, 1229984, 1332480, 1434976, 1537472, 1639968, 1742464, 1844960, 1947456, 2049952,
2152448, 2254944, 2357440, 2459936, 2562432, 2664928, 2767424, 2869920, 2972416, 3074912,
3177408, 3279904, 3382400, 3484896, 3587392, 3689888, 3792384, 3894880, 3997376, 4099872,
4202368, 4304864, 4407360, 4509856, 4612352, 4714848, 4817344, 4919840, 5022336, 5124832,
5227328, 5329824, 5432320, 5534816, 5637312, 5739808, 5842304, 5944800, 6047296, 6149792,
6252288, 6354784, 6457280, 6559776, 6662272, 6764768, 6867264, 6969760, 7072256, 7174752,
7277248, 7379744, 7482240, 7584736, 7687232, 7789728, 7892224, 7994720, 8097216, 8199712,
8302208, 8404704, 8507200, 8609696, 8712192, 8814688, 8917184, 9019680, 9122176, 9224672,
9327168, 9429664, 9532160, 9634656, 9737152, 9839648, 9942144, 10044640, 10147136,
10249632, 10352128, 10454624, 10557120, 10659616, 10762112, 10864608, 10967104, 11069600,
11172096, 11274592, 11377088, 11479584, 11582080, 11684576, 11787072, 11889568, 11992064,
12094560, 12197056, 12299552, 12402048, 12504544, 12607040, 12709536, 12812032, 12914528,
13017024, 13119520, 13222016, 13324512, 13427008, 13529504, 13632000, 13734496, 13836992,
13939488, 14041984, 14144480, 14246976, 14349472, 14451968, 14554464, 14656960, 14759456,
14861952, 14964448, 15066944, 15169440, 15271936, 15374432, 15476928, 15579424, 15681920,
15784416, 15886912, 15989408, 16091904, 16194400, 16296896, 16399392, 16501888, 16604384,
16706880, 16809376, 16911872, 17014368, 17116864, 17219360, 17321856, 17424352, 17526848,
17629344, 17731840, 17834336, 17936832, 18039328, 18141824, 18244320, 18346816, 18449312,
18551808, 18654304, 18756800, 18859296, 18961792, 19064288, 19166784, 19269280, 19371776,
19474272, 19576768, 19679264, 19781760, 19884256, 19986752, 20089248, 20191744, 20294240,
20396736, 20499232, 20601728, 20704224, 20806720, 20909216, 21011712, 21114208, 21216704,
21319200, 21421696, 21524192, 21626688, 21729184, 21831680, 21934176, 22036672, 22139168,
22241664, 22344160, 22446656, 22549152, 22651648, 22754144, 22856640, 22959136, 23061632,
23164128, 23266624, 23369120, 23471616, 23574112, 23676608, 23779104, 23881600, 23984096,
24086592, 24189088, 24291584, 24394080, 24496576, 24599072, 24701568, 24804064, 24906560,
25009056, 25111552, 25214048, 25316544, 25419040, 25521536, 25624032, 25726528, 25829024,
25931520, 26034016, 26136512, 26239008, 26341504, 26444000, 26546496, 26648992, 26751488,
26853984, 26956480, 27058976, 27161472, 27263968, 27366464, 27468960, 27571456, 27673952,
27776448, 27878944, 27981440, 28083936, 28186432, 28288928, 28391424, 28493920, 28596416,
28698912, 28801408, 28903904, 29006400, 29108896, 29211392, 29313888, 29416384, 29518880,
29621376, 29723872, 29826368, 29928864, 30031360, 30133856, 30236352, 30338848, 30441344,
30543840, 30646336, 30748832, 30851328, 30953824, 31056320, 31158816, 31261312, 31363808,
31466304, 31568800, 31671296, 31773792, 31876288, 31978784, 32081280, 32183776, 32286272,
32388768, 32491264, 32593760, 32696256, 32798752, 32901248, 33003744, 33106240, 33208736,
33311232, 33413728, 33516224, 33618720, 33721216, 33823712, 33926208, 34028704, 34131200,
34233696, 34336192, 34438688, 34541184, 34643680, 34746176, 34848672, 34951168, 35053664,
35156160, 35258656, 35361152, 35463648, 35566144, 35668640, 35771136, 35873632, 35976128,
36078624, 36181120, 36283616, 36386112, 36488608, 36591104, 36693600, 36796096, 36898592,
37001088, 37103584, 37206080, 37308576, 37411072, 37513568, 37616064, 37718560, 37821056,
37923552, 38026048, 38128544, 38231040, 38333536, 38436032, 38538528, 38641024, 38743520,
38846016, 38948512, 39051008, 39153504, 39256000, 39358496, 39460992, 39563488, 39665984,
39768480, 39870976, 39973472, 40075968, 40178464, 40280960, 40383456, 40485952, 40588448,
40690944, 40793440, 40895936, 40998432, 41100928, 41203424, 41305920, 41408416, 41510912,
41613408, 41715904, 41818400, 41920896, 42023392, 42125888, 42228384, 42330880, 42433376,
42535872, 42638368, 42740864, 42843360, 42945856, 43048352, 43150848, 43253344, 43355840,
43458336, 43560832, 43663328, 43765824, 43868320, 43970816, 44073312, 44175808, 44278304,
44380800, 44483296, 44585792, 44688288, 44790784, 44893280, 44995776, 45098272, 45200768,
45303264, 45405760, 45508256, 45610752, 45713248, 45815744, 45918240, 46020736, 46123232,
46225728, 46328224, 46430720, 46533216, 46635712, 46738208, 46840704, 46943200, 47045696,
47148192, 47250688, 47353184, 47455680, 47558176, 47660672, 47763168, 47865664, 47968160,
48070656, 48173152, 48275648, 48378144, 48480640, 48583136, 48685632, 48788128, 48890624,
48993120, 49095616, 49198112, 49300608, 49403104, 49505600, 49608096, 49710592, 49813088,
49915584, 50018080, 50120576, 50223072, 50325568, 50428064, 50530560, 50633056, 50735552,
50838048, 50940544, 51043040, 51145536, 51248032, 51350528, 51453024, 51555520, 51658016,
51760512, 51863008, 51965504, 52068000, 52170496, 52272992, 52375488, 52477984, 52580480,
52682976, 52785472, 52887968, 52990464, 53092960, 53195456, 53297952, 53400448, 53502944,
53605440, 53707936, 53810432, 53912928, 54015424, 54117920, 54220416, 54322912, 54425408,
54527904, 54630400, 54732896, 54835392, 54937888, 55040384, 55142880, 55245376, 55347872,
55450368, 55552864, 55655360, 55757856, 55860352, 55962848, 56065344, 56167840, 56270336,
56372832, 56475328, 56577824, 56680320, 56782816, 56885312, 56987808, 57090304, 57192800,
57295296, 57397792, 57500288, 57602784, 57705280, 57807776, 57910272, 58012768, 58115264,
58217760, 58320256, 58422752, 58525248, 58627744, 58730240, 58832736, 58935232, 59037728,
59140224, 59242720, 59345216, 59447712, 59550208, 59652704, 59755200, 59857696, 59960192,
60062688, 60165184, 60267680, 60370176, 60472672, 60575168, 60677664, 60780160, 60882656,
60985152, 61087648, 61190144, 61292640, 61395136, 61497632, 61600128, 61702624, 61805120,
61907616, 62010112, 62112608, 62215104, 62317600, 62420096, 62522592, 62625088, 62727584,
62830080, 62932576, 63035072, 63137568, 63240064, 63342560, 63445056, 63547552, 63650048,
63752544, 63855040, 63957536, 64060032, 64162528, 64265024, 64367520, 64470016, 64572512,
64675008, 64777504, 64880000, 64982496, 65084992, 65187488, 65289984, 65392480, 65494976,
65597472, 65699968, 65802464, 65904960, 66007456, 66109952, 66212448, 66314944, 66417440,
66519936, 66622432, 66724928, 66827424, 66929920, 67032416, 67134912, 67237408, 67339904,
67442400, 67544896, 67647392, 67749888, 67852384, 67954880, 68057376, 68159872, 68262368,
68364864, 68467360, 68569856, 68672352, 68774848, 68877344, 68979840, 69082336, 69184832,
69287328, 69389824, 69492320, 69594816, 69697312, 69799808, 69902304, 70004800, 70107296,
70209792, 70312288, 70414784, 70517280, 70619776, 70722272, 70824768, 70927264, 71029760,
71132256, 71234752, 71337248, 71439744, 71542240, 71644736, 71747232, 71849728, 71952224,
72054720, 72157216, 72259712, 72362208, 72464704, 72567200, 72669696, 72772192, 72874688,
72977184, 73079680, 73182176, 73284672, 73387168, 73489664, 73592160, 73694656, 73797152,
73899648, 74002144, 74104640, 74207136, 74309632, 74412128, 74514624, 74617120, 74719616,
74822112, 74924608, 75027104, 75129600, 75232096, 75334592, 75437088, 75539584, 75642080,
75744576, 75847072, 75949568, 76052064, 76154560, 76257056, 76359552, 76462048, 76564544,
76667040, 76769536, 76872032, 76974528, 77077024, 77179520, 77282016, 77384512, 77487008,
77589504, 77692000, 77794496, 77896992, 77999488, 78101984,
先创建挂载点, 我们假设将这块新硬盘挂载到 /gobsd, 这个目录必须先创建,否则挂载不上:
代码: 全选
# [color=royalblue]mkdir /gobsd[/color]
代码: 全选
/dev/wd0a / ffs rw 1 1
/dev/wd0i /home ffs rw,nodev,nosuid 1 2
/dev/wd0d /tmp ffs rw,nodev,nosuid 1 2
/dev/wd0e /usr ffs rw,nodev 1 2
/dev/wd0f /usr/obj ffs rw,nodev,nosuid 1 2
/dev/wd0g /var ffs rw,nodev,nosuid 1 2
/dev/wd0h /var/log ffs rw,nodev,nosuid 1 2
[color=royalblue]/dev/wd1d /gobsd ffs rw 1 1[/color]
重新启动后,查看一下文件系统:
代码: 全选
login as: [color=royalblue]root[/color]
[email protected]'s password:[color=royalblue]whocares?[/color]
Last login: Tue Aug 3 16:13:08 2010 from 192.168.2.34
OpenBSD 4.7-stable (GENERIC) #0: Mon Aug 2 22:09:37 CDT 2010
Welcome to OpenBSD: The proactively secure Unix-like operating system.
Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code. With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.
#
# [color=royalblue]df[/color]
Filesystem 512-blocks Used Avail Capacity Mounted on
/dev/wd0a 2058188 88480 1866800 5% /
/dev/wd0i 30959068 4 29411112 0% /home
/dev/wd0d 2058252 12 1955328 0% /tmp
/dev/wd0e 16509164 5093788 10589920 32% /usr
/dev/wd0f 6186940 4 5877592 0% /usr/obj
/dev/wd0g 6186940 501132 5376464 9% /var
/dev/wd0h 6186940 120 5877476 0% /var/log
/dev/wd1d 75687016 2 71902664 0% /gobsd
如果想先不启动系统,这样:
代码: 全选
# [color=royalblue]mount /dev/wd1d /gobsd[/color]
但是如果要以后自动挂载,你还是需要修改/etc/fatab文件。