wiki:jazz/12-04-05

2012-04-05

hadoop.nchc.org.tw

  • 參考 2011-06-20 筆記
  • <服務> 將 hadoop.nchc.org.tw 的 /home 容量加大
    • 這次比較不同的是採用 iSCSI 的硬碟
    • 測試環境:Debian GNU/Linux 6.0.4
      jazz@hadoop:~$ lsb_release -a
      No LSB modules are available.
      Distributor ID: Debian
      Description: Debian GNU/Linux 6.0.4 (squeeze)
      Release: 6.0.4
      Codename: squeeze
      
    • 測試步驟:
      • 安裝 open-iscsi
        jazz@hadoop:~$ sudo apt-get install open-iscsi
        
      • 修改 /etc/iscsi/iscsid.conf
        --- iscsid.conf.org 2012-04-05 17:04:06.000000000 +0800
        +++ iscsid.conf 2012-04-05 17:05:15.000000000 +0800
        @@ -25,10 +25,10 @@
        #*****************
        
        # To request that the iscsi initd scripts startup a session set to "automatic".
        -# node.startup = automatic
        +node.startup = automatic
        #
        # To manually startup the session set to "manual". The default is manual.
        -node.startup = manual
        +# node.startup = manual
        
        # *************
        # CHAP Settings
        @@ -36,12 +36,12 @@
        
        # To enable CHAP authentication set node.session.auth.authmethod
        # to CHAP. The default is None.
        -#node.session.auth.authmethod = CHAP
        +node.session.auth.authmethod = CHAP
        
        # To set a CHAP username and password for initiator
        # authentication by the target(s), uncomment the following lines:
        -#node.session.auth.username = username
        -#node.session.auth.password = password
        +node.session.auth.username = 登入帳號
        +node.session.auth.password = 登入密碼
        
        # To set a CHAP username and password for target(s)
        # authentication by the initiator, uncomment the following lines:
        @@ -50,12 +50,12 @@
        
        # To enable CHAP authentication for a discovery session to the target
        # set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
        -#discovery.sendtargets.auth.authmethod = CHAP
        +discovery.sendtargets.auth.authmethod = CHAP
        
        # To set a discovery session CHAP username and password for the initiator
        # authentication by the target(s), uncomment the following lines:
        -#discovery.sendtargets.auth.username = username
        -#discovery.sendtargets.auth.password = password
        +discovery.sendtargets.auth.username = 登入帳號
        +discovery.sendtargets.auth.password = 登入密碼
        
        # To set a discovery session CHAP username and password for target(s)
        # authentication by the initiator, uncomment the following lines:
        
      • 啟動 iscsid
        jazz@hadoop:~$ sudo /etc/init.d/open-iscsi restart
        [sudo] password for jazz:
        Unmounting iscsi-backed filesystems: Unmounting all devices marked _netdev.
        Disconnecting iSCSI targets:.
        Stopping iSCSI initiator service:.
        Starting iSCSI initiator service: iscsid.
        Setting up iSCSI targets:
        iscsiadm: No records found!
        .
        Mounting network filesystems:.
        
      • 掃描 iSCSI 硬碟
        jazz@hadoop:~$ sudo iscsiadm -m discovery -t sendtargets -p X.X.X.X(iSCSI Target Server 的 IP)
        X.X.X.X:3260,0 iqn.2011-09.com.ems5:das-2000-i112a-fff000958:dev0
        
      • 使用 iSCSI 硬碟
        jazz@hadoop:~$ sudo iscsiadm -m node --targetname "iqn.2011-09.com.ems5:das-2000-i112a-fff000958:dev0" --login &
        
      • 查看 dmesg 會發現找到 iSCSI 硬碟在 /dev/sdX (這裡找到在 /dev/sdd)
        [2659438.350894] Loading iSCSI transport class v2.0-870.
        [2659438.359496] iscsi: registered transport (tcp)
        [2659438.382648] iscsi: registered transport (iser)
        [2659566.984113] scsi8 : iSCSI Initiator over TCP/IP
        [2659567.555637] scsi 8:0:0:0: Direct-Access     EMS5     DAS 2000-i112a   211  PQ: 0 ANSI: 4
        [2659567.556192] sd 8:0:0:0: [sdd] Very big device. Trying to use READ CAPACITY(16).
        [2659567.556792] sd 8:0:0:0: [sdd] 7811891200 512-byte logical blocks: (3.99 TB/3.63 TiB)
        [2659567.556937] sd 8:0:0:0: [sdd] Write Protect is off
        [2659567.556940] sd 8:0:0:0: [sdd] Mode Sense: bb 00 00 00
        [2659567.557250] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
        [2659567.557594] sd 8:0:0:0: [sdd] Very big device. Trying to use READ CAPACITY(16).
        [2659567.558192]  sdd: unknown partition table
        [2659567.577709] sd 8:0:0:0: [sdd] Very big device. Trying to use READ CAPACITY(16).
        [2659567.578310] sd 8:0:0:0: [sdd] Attached SCSI disk
        
      • 把 /dev/sdd 用 fdisk 先切割一個 partition /dev/sdd1
        jazz@hadoop:~$ sudo fdisk /dev/sdd
        jazz@hadoop:~$ sudo fdisk -ul /dev/sdd
        
        Disk /dev/sdd: 3999.7 GB, 3999688294400 bytes
        255 heads, 63 sectors/track, 486267 cylinders, total 7811891200 sectors
        Units = sectors of 1 * 512 = 512 bytes
        Sector size (logical/physical): 512 bytes / 512 bytes
        I/O size (minimum/optimal): 512 bytes / 512 bytes
        Disk identifier: 0xc99c92c5
        
           Device Boot      Start         End      Blocks   Id  System
        /dev/sdd1              63  4294961684  2147480811   83  Linux
        
      • 開始著手把 /dev/sdd1 加入 LVM2
        jazz@hadoop:~$ sudo partprobe
        jazz@hadoop:~$ sudo pvcreate /dev/sdd1
          Physical volume "/dev/sdd1" successfully created
        jazz@hadoop:~$ sudo vgextend hadoop /dev/sdd1
          Volume group "hadoop" successfully extended
        jazz@hadoop:~$ sudo vgdisplay
          --- Volume group ---
          VG Name               hadoop
          System ID             
          Format                lvm2
          Metadata Areas        3
          Metadata Sequence No  5
          VG Access             read/write
          VG Status             resizable
          MAX LV                0
          Cur LV                1
          Open LV               1
          Max PV                0
          Cur PV                3
          Act PV                3
          VG Size               4.65 TiB
          PE Size               4.00 MiB
          Total PE              1219685
          Alloc PE / Size       695398 / 2.65 TiB
          Free  PE / Size       524287 / 2.00 TiB
          VG UUID               PTdhAu-cGBn-ZoWh-hL9u-MQ0F-enKT-DOcEtC
        ### 記下 Total PE 的數字
        jazz@hadoop:~$ sudo lvresize -l 1219685 /dev/mapper/hadoop-hadoop--home
          Extending logical volume hadoop-home to 4.65 TiB
          Logical volume hadoop-home successfully resized
        ~$ sudo resize2fs /dev/mapper/hadoop-hadoop--home
        resize2fs 1.41.12 (17-May-2010)
        Filesystem at /dev/mapper/hadoop-hadoop--home is mounted on /home; on-line resizing required
        old desc_blocks = 170, new_desc_blocks = 298
        
Last modified 12 years ago Last modified on Apr 5, 2012, 6:04:13 PM