萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 作業系統 >  >> Solaris 介紹

Solaris 磁碟格式化與分割區實戰:format/fdisk/partition 完整操作流程

前置知識:IDE/SCSI 裝置命名

  • Primary IDE Master → c0d0
  • SCSI 範例:c1t6d0 (控制器 1, Target 6, LUN 0)

格式化前驅動程式載入

# drvconfig
# disks

format 互動式操作實錄

# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0 /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c1t6d0 /pci@0,0/pci9004,8178@f/sd@6,0
Specify disk (enter its number): 0

磁碟類型定義 (若無預設)

AVAILABLE DRIVE TYPES:
0. other
Specify disk type (enter its number): 0

# 依 BIOS Auto Detect (LBA 模式) 填寫幾何參數
Cylinders = 25232
Heads = 16
Sectors = 63
Enter number of data cylinders: 25232
Enter number of alternate cylinders [2]:
Enter number of physical cylinders [25234]:
Enter number of heads: 16
Enter number of data sectors/track: 63
Enter rpm of drive [3600]:
... (其餘採預設 Enter)
Enter disk type name (remember quotes): "cyl 25232 alt 2 hd 16 sec 63"

fdisk 分割區建立 (x86 平台必要)

format> fdisk
No fdisk table exists. Default: 100% "SOLARIS System" partition
Type "y" to accept: y
WARNING: Solaris fdisk partition changed - Please relabel the disk

format> fdisk
Total disk size is 25232 cylinders
Partition   Status  Type      Start  End    Length  %
=========   ======  ========  =====  ===    ======  ===
1           Active  Solaris   1      25231  25231   100

SELECT: 4 (Exit - update configuration)

partition (Slice) 規劃

format> partition
partition> print
Current partition table (cyl):
Total disk cylinders available: 25229 + 2 (reserved)

Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 25228 12.13GB (25229/0/0) 25430832
3 unassigned wm 0 0 0
4 unassigned wm 0 0 0
5 unassigned wm 0 0 0
6 usr wm 0 0 0
7 unassigned wm 0 0 0
8 boot wu 0 - 0 0.49MB (1/0/0) 1008
9 alternates wm 1 - 2 0.98MB (2/0/0) 2016

# 規劃原則:Slice 2/8/9 不動;Slice 0 從 cylinder 3 開始
partition> 0
Enter partition id tag [root]:
Enter partition permission flags [wm]:
Enter new starting cyl [0]: 3
Enter partition size [0b, 0c, 0.00mb, 0.00gb]: 25427808b  # 全部剩餘區塊

partition> 1
Enter partition id tag [swap]:
Enter partition permission flags [wu]:
Enter new starting cyl [0]: 0   # swap 通常置於磁碟最前端
Enter partition size: 1048576b  # 1GB swap (視記憶體調整)

partition> label   # 寫入分割表與標籤
Ready to label disk, continue? y
partition> quit
format> quit

後續建立檔案系統

# newfs /dev/rdsk/c0d0s0   # 根分割區
# newfs /dev/rdsk/c0d0s6   # /usr 或 /export/home
# swap -a /dev/dsk/c0d0s1  # 加入 swap (或編輯 /etc/vfstab 開機自動掛載)
x86 平台必須先 fdisk 建立 Solaris 分割區,再 partition 切 slice。SPARC 平台無 fdisk 步驟,直接 partition。
copyright © 萬盛學電腦網 all rights reserved