Ads 468x60px

วันจันทร์ที่ 10 ตุลาคม พ.ศ. 2554

เพิ่มดิสก์ใหม่บน Solaris 10

เพิ่มดิสก์ใหม่บน Solaris 10
เช่นเดียวกับระบบปฏิบัติการ OS อื่นๆ เมื่อมีการเพิ่มดิสก์ก้อนใหม่เข้าไปในเครื่องที่ติดตั้ง Solaris 10 ต้องมีกระบวนการ หรือต้องรันคำสั่งก่อนที่จะเริ่มใช้ดิสก์ก้อนใหม่ได้

ในบทความนี้ทดสอบการเพิ่มดิสก์ก้อนใหม่ 1 ก้อน บน Solaris 10 (x86)
ใช้คำสั่ง format เพื่อดูว่า Solaris มองเห็นดิสก์อะไรบ้าง
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <DEFAULT cyl 4866 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@0,0
       1. c1t1d0 <DEFAULT cyl 4867 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@1,0
Specify disk (enter its number):
ดิสก์ก้อนใหม่ที่เพิ่มเข้ามาคือดิสก์หมายเลข 1 “c1t1d0″
พิมพ์หมายเลขของดิสก์แล้วกด [Enter] เพื่อเข้าสู่โหมดจัดการของดิสก์ก้อนที่ระบุ
Specify disk (enter its number): 1
selecting c1t1d0
[disk formatted]
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
พิมพ์คำสั่ง partition เพื่อเข้าสู่โหมดการแบ่ง partition
format> partition
WARNING - This disk may be in use by an application that has
          modified the fdisk table. Ensure that this disk is
          not currently in use before proceeding to use fdisk.
หากเจอข้อความ WARNING แบบด้านบน ให้พิมพ์คำสั่ง fdisk เพื่อแก้ไข
format> fdisk
No fdisk table exists. The default partition for the disk is:
  a 100% "SOLARIS System" partition
Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
y
format>
พิมพ์คำสั่ง partition อีกครั้ง
format> partition
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition>
พิมพ์คำสั่ง print เพื่อแสดงการแบ่ง partition
partition> print
Current partition table (original):
Total disk cylinders available: 4866 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 4865       37.28GB    (4866/0/0) 78172290
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0
partition>
เริ่มต้น ทดลองสร้าง partition 0 มีขนาด 10 GB
partition> 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 10gb
ใช้คำสั่ง print เพื่อแสดง partition
partition> print
Current partition table (unnamed):
Total disk cylinders available: 4866 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0 - 1305       10.00GB    (1306/0/0) 20980890
  1 unassigned    wm       0               0         (0/0/0)           0
  2     backup    wu       0 - 4865       37.28GB    (4866/0/0) 78172290
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0
หลังจากแก้ไข partition พิมพ์คำสั่ง label เพื่อบันทึกข้อมูลลงดิสก์
partition> label
Ready to label disk, continue? y
partition> ^D
กดปุ่ม [Ctrl]+[D] เพื่อออกจากคำสั่ง format
ใช้คำสั่ง newfs เพื่อสร้าง filesystem บน partition ที่เพิ่งสร้างขึ้น
หมายเหตุ ชื่อไฟล์ device ของดิสก์ c1t1d0 – partition 0 คือ /dev/rdsk/c1t1d0s0
# newfs /dev/rdsk/c1t1d0s0
newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y
Warning: 870 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s0:     20980890 sectors in 3415 cylinders of 48 tracks, 128 sectors
        10244.6MB in 214 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
 20055584, 20154016, 20252448, 20350880, 20449312, 20547744, 20646176,
 20744608, 20843040, 20941472
แนะนำให้ใช้คำสั่ง fsck เพื่อตรวจสอบความถูกต้องของ filesystem ที่สร้างขึ้น ต้องไม่มีข้อความ error ใดๆ
# fsck -y /dev/rdsk/c1t1d0s0
** /dev/rdsk/c1t1d0s0
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3a - Check Connectivity
** Phase 3b - Verify Shadows/ACLs
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cylinder Groups
2 files, 9 used, 10331200 free (16 frags, 1291398 blocks, 0.0% fragmentation)
สร้าง mount point สำหรับ partition ใหม่
# mkdir /mnt/new-disk0
# mount /dev/rdsk/c1t1d0s0 /mnt/new-disk0
mount: /dev/rdsk/c1t1d0s0 not a block device
สำหรับ Solaris เวลาใช้คำสั่ง newfs หรือ fsck ชื่อ device ที่ระบุคือ /dev/rdsk/… แต่เวลาใช้คำสั่ง mount ต้องระบุชื่อ device เป็น /dev/dsk/…
# mount /dev/dsk/c1t1d0s0 /mnt/new-disk0
ใช้คำสั่ง df เพื่อตรวจสอบ mount point
# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       34G   3.7G    30G    11%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.6G   932K   1.6G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        34G   3.7G    30G    11%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.6G     8K   1.6G     1%    /tmp
swap                   1.6G    20K   1.6G     1%    /var/run
/dev/dsk/c1t0d0s7      1.9G   210M   1.6G    12%    /export/home
/dev/dsk/c1t1d0s0      9.9G    10M   9.7G     1%    /mnt/new-disk0
หากใช้งาน partition ใหม่ได้ถูกต้องเรียบร้อยแล้ว ต้องเพิ่มคอนฟิกเข้าไปในไฟล์ /etc/vfstab เพื่อให้เวลาบู๊ตเครื่องใหม่ มีการ mount partition ใหม่นี้โดยอัตโมมัติ
# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no      -
/dev/dsk/c1t0d0s7       /dev/rdsk/c1t0d0s7      /export/home    ufs     2       yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
# new disk
/dev/dsk/c1t1d0s0       /dev/rdsk/c1t1d0s0      /mnt/new-disk0  ufs     2       yes     -

0 ความคิดเห็น:

แสดงความคิดเห็น

Blogger templates