Tuesday, December 20, 2011

Map san xuống server solaris sử dụng UFS and ZFS

1. Sử dụng UFS
 
-- Kiểm tra ổ dĩa hiện tại
root@c4is-standby-s # echo |format

AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@1f,700000/scsi@2/sd@0,0
       1. c1t1d0
          /pci@1f,700000/scsi@2/sd@1,0
       2. c1t2d0
          /pci@1f,700000/scsi@2/sd@2,0
       3. c1t3d0
          /pci@1f,700000/scsi@2/sd@3,0
       4. c5t600A0B8000330D0A0000054748BF696Bd0
          /scsi_vhci/ssd@g600a0b8000330d0a0000054748bf696b
       5. c5t600A0B80004700CE0000057348BF6846d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057348bf6846
       6. c5t600A0B80004700CE0000057748BF6AD0d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057748bf6ad0
Specify disk (enter its number): Specify disk (enter its number):

-- Vào SAN tạo volumn sau đó map xuống host
--Sau khi map xuống xong kiểm tra ổ đĩa mới 

root@c4is-standby-s # echo |format

AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@1f,700000/scsi@2/sd@0,0
       1. c1t1d0
          /pci@1f,700000/scsi@2/sd@1,0
       2. c1t2d0
          /pci@1f,700000/scsi@2/sd@2,0
       3. c1t3d0
          /pci@1f,700000/scsi@2/sd@3,0
       4. c5t600A0B8000330D0A0000054748BF696Bd0
          /scsi_vhci/ssd@g600a0b8000330d0a0000054748bf696b
       5. c5t600A0B80004700CE00001D8C4EF0CD9Cd0
          /scsi_vhci/ssd@g600a0b80004700ce00001d8c4ef0cd9c
       6. c5t600A0B80004700CE0000057348BF6846d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057348bf6846
       7. c5t600A0B80004700CE0000057748BF6AD0d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057748bf6ad0
Specify disk (enter its number): Specify disk (enter its number):

-- Ổ đĩa hiện tại đc map xuống là
 5. c5t600A0B80004700CE00001D8C4EF0CD9Cd0


-- Xác định lại silde của partition cần format để chọn  newfs

root@c4is-standby-s # format
Searching for disks...done

c5t600A0B80004700CE00001D8C4EF0CD9Cd0: configured with capacity of 1024.00GB


AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@1f,700000/scsi@2/sd@0,0
       1. c1t1d0
          /pci@1f,700000/scsi@2/sd@1,0
       2. c1t2d0
          /pci@1f,700000/scsi@2/sd@2,0
       3. c1t3d0
          /pci@1f,700000/scsi@2/sd@3,0
       4. c5t600A0B8000330D0A0000054748BF696Bd0
          /scsi_vhci/ssd@g600a0b8000330d0a0000054748bf696b
       5. c5t600A0B80004700CE00001D8C4EF0CD9Cd0
          /scsi_vhci/ssd@g600a0b80004700ce00001d8c4ef0cd9c
       6. c5t600A0B80004700CE0000057348BF6846d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057348bf6846
       7. c5t600A0B80004700CE0000057748BF6AD0d0
          /scsi_vhci/ssd@g600a0b80004700ce0000057748bf6ad0

--- chọn ổ đĩa mới thứ 5 mới gắn vào

Specify disk (enter its number): 5
selecting c5t600A0B80004700CE00001D8C4EF0CD9Cd0
[disk formatted]
Disk not labeled.  Label it now? yes


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
        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
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> p


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
        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
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk sectors available: 2147467230 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector          Size          Last Sector
  0       root    wm                34       128.00MB           262177   
  1       swap    wu            262178       128.00MB           524321   
  2 unassigned    wu                 0            0                0   
  3 unassigned    wm                 0            0                0   
  4 unassigned    wm                 0            0                0   
  5 unassigned    wm                 0            0                0   
  6        usr    wm            524322      1023.74GB           2147467229   
  8   reserved    wm        2147467230         8.00MB           2147483613   

partition> q


==> chú ý thấy vị trí thứ 6 dung lượng là 1G  => chính là s6
 

Tạo newfs

newfs /dev/rdsk/c5t600A0B80004700CE00001D8C4EF0CD9Cd0s6
 


-- Tạo một thư mục tên u04, sao đó mount vào
mount -F ufs /dev/dsk/c5t600A0B80004700CE00001D8C4EF0CD9Cd0s6 /u04

Chú ý: thay thế rdsk bằng dsk


=====================
Lệnh để clean cache device 

devfsadm -Cv

Thêm thông tin vào vfstab
vi /etc/vfstab

/dev/dsk/c5t600A0B80004700CE00001D8C4EF0CD9Cd0s6  /dev/rdsk/c5t600A0B80004700CE00001D8C4EF0CD9Cd0s6   /u04    ufs     2       yes     -

Mount và test thử vfstab

#umount /u04
#mount /u04


2. Sử dụng ZFS

1. Kiểm tra kết nối FC từ server đến SAN Switch

root@SMS-S # luxadm -e port
/devices/pci@7c0/pci@0/pci@1/pci@0,2/SUNW,emlxs@1/fp@0,0:devctl    CONNECTED
/devices/pci@7c0/pci@0/pci@1/pci@0,2/SUNW,emlxs@2/fp@0,0:devctl    CONNECTED


root@SMS-S # echo |format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0
          /pci@780/pci@0/pci@9/scsi@0/sd@0,0
       1. c0t2d0
          /pci@780/pci@0/pci@9/scsi@0/sd@2,0
       2. c4t600A0B8000330D0A00001A964ED581DDd0
          /scsi_vhci/ssd@g600a0b8000330d0a00001a964ed581dd
       3. c4t600A0B80004700CE00001CF54ED5754Cd0
          /scsi_vhci/ssd@g600a0b80004700ce00001cf54ed5754c
Specify disk (enter its number): Specify disk (enter its number): 

Chú ý:  Nếu server chưa thấy Volume trên SAN thì dung lệnh devfsadm –Cv hoặc reboot server.
2. Khởi tạo volume với định dạng ZFS file

root@SMS-S # zpool create u03 c4t600A0B80004700CE00001CF54ED5754Cd0

invalid vdev specification
use '-f' to override the following errors:

zpool create -f diskbackup c6t600A0B800047006456456530057548BF69DEd0

root@SMS-S # zpool status -v u03
  pool: u03
 state: ONLINE
 scrub: none requested
config:

        NAME                                     STATE     READ WRITE CKSUM
        u03                                      ONLINE       0     0     0
          c4t600A0B80004700CE00001CF54ED5754Cd0  ONLINE       0     0     0

errors: No known data errors
root@SMS-S #

3. Test tốc độ đọc ghi trên U03
  
Script test  u03



date
mkfile 10G testfile
date



root@SMS-S # date
Fri Jan 27 14:53:21 ICT 2012
root@SMS-S # date
Fri Jan 27 14:55:18 ICT 2012

# zpool iostat u03 1


u03         8.86G  1007G      0    551      0  68.6M
u03         8.86G  1007G      0    285      0  35.4M
u03         8.86G  1007G      0    327      0  40.7M
u03         8.86G  1007G      0    220      0  27.4M
u03         8.86G  1007G      0    380      0  47.1M
u03         8.86G  1007G      0    284      0  35.2M
u03         8.86G  1007G      0    413      0  51.5M
u03         8.86G  1007G      0  1.12K      0   142M
u03         8.86G  1007G      0  1.04K   128K   128M
u03         9.42G  1007G      0  1.03K      0   131M
u03         9.42G  1007G      0    831      0   103M
u03         9.42G  1007G      0    570      0  70.8M
u03         9.42G  1007G      0    594      0  73.6M
u03         9.42G  1007G      0    570      0  70.8M
u03         9.42G  1007G      0    725      0  90.0M
u03         9.99G  1006G      0    342      0  37.2M

No comments: