Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 知乎专栏 | 视频教程 | About

第 8 章 Network Attached Storage(NAS 网络附加存储)

目录

8.1. Network Storage - Openfiler
8.1.1. Accounts
8.1.2. Volumes
8.1.2.1. RAID
8.1.2.2. iSCSI
8.1.2.2.1. Microsoft iSCSI Software Initiator
8.1.3. Quota
8.1.4. Shares
8.2. OpenMediaVault
8.3. FreeNAS

8.1. Network Storage - Openfiler

Openfiler is a powerful, intuitive browser-based network storage software distribution. Openfiler delivers file-based Network Attached Storage and block-based Storage Area Networking in a single framework.

openfiler 的官方网站

过程 8.1. Openfiler Storage Control Center

  1. 登录管理界面

    			
    https://<ip address>:446/
    			
    			

    初始帐号和密码是: openfiler/password

  2. 首先要修改默认密码

    Accounts->Admin Password

    Current Password:  password
    New Password:  新密码
    Confirm New Password:  确认密码
    			

    Submit 提交

8.1.1. Accounts

  • 用户认证

    openfiler.ldif

    dn: ou=people,dc=bg7nyt,dc=cn
    ou: people
    objectClass: organizationalUnit
    
    dn: ou=Idmap,dc=bg7nyt,dc=cn
    ou: Idmap
    objectClass: organizationalUnit
    			

    添加people组织单元

    [chenjingfeng@backup ldap]$ ldapadd -x -D "cn=root,dc=bg7nyt,dc=cn" -W -f openfiler.ldif
    Enter LDAP Password:
    adding new entry "ou=people,dc=bg7nyt,dc=cn"
    
    adding new entry "ou=Idmap,dc=bg7nyt,dc=cn"
    			
    1. Accounts->Authentication

      Use LDAP: 打勾

      Server:  ldap.bg7nyt.cn
      Base DN:  dc=bg7nyt,dc=cn
      Root bind DN:  cn=root,dc=bg7nyt,dc=cn
      Root bind Password:  你的密码
      					
    2. Services->LDAP Settings

      Base DN:  dc=bg7nyt,dc=cn
      Root bind DN:  cn=root,dc=bg7nyt,dc=cn
      Root Password:  你的密码
      					
    3. Services->Enable/Disable

    4. Accounts->Account Administration

      1. Group Administration

        Group Name: nfs
        							
      2. User Administration

        Username: 用户名
        Password: 密码
        Retype password: 确认密码
        Primary Group: 用户组
        							

        查看组织单元:ou=people,dc=bg7nyt,dc=cn

        							
        [chenjingfeng@backup ldap]$ ldapsearch -x -b 'ou=people,dc=bg7nyt,dc=cn'
        # extended LDIF
        #
        # LDAPv3
        # base <ou=people,dc=bg7nyt,dc=cn> with scope sub
        # filter: (objectclass=*)
        # requesting: ALL
        #
        
        # people, bg7nyt.cn
        dn: ou=people,dc=bg7nyt,dc=cn
        ou: people
        objectClass: organizationalUnit
        
        # neo, People, bg7nyt.cn
        dn: uid=neo,ou=People,dc=bg7nyt,dc=cn
        objectClass: inetOrgPerson
        objectClass: posixAccount
        homeDirectory: /dev/null
        loginShell: /bin/false
        cn: neo
        givenName: neo
        sn: neo
        uid: neo
        uidNumber: 500
        gidNumber: 500
        
        # search result
        search: 2
        result: 0 Success
        
        # numResponses: 3
        # numEntries: 2
        							
        							

8.1.2. Volumes

  • 卷管理 [Volumes]

    我这里是使用VMware做的试验,在VMware中增加一些硬盘即可.

    1. Volumes -> Physical Storage Mgmt.

      Edit Disk Type Description Size Label type Partitions
      /dev/sda SCSI VMware, VMware Virtual S 8.00 GB msdos 3 (view)
      /dev/sdb SCSI VMware, VMware Virtual S 8.00 GB gpt 0 (view)
      /dev/sdc SCSI VMware, VMware Virtual S 8.00 GB gpt 0 (view)
      /dev/sdd SCSI VMware, VMware Virtual S 8.00 GB gpt 0 (view)
      ...
      					

      openfiler安装在/dev/sda,/dev/sda硬盘空间不用太大,单独给openfiler使用.建议做RAID 1(硬件RAID卡或服务器主版提供的RAID)

      其它硬盘是用于存储的硬盘,如果有条件这些硬盘组也最好做成硬RAID,没有条件我们可以在openfiler中做软件RAID.

      点击"Edit Disk"列表内硬盘标签,之后可以看到"Create a partition in /dev/sdb"

      Mode: Primary
      Partition Type: [Physical volume] / [RAID array member]
      Starting cylinder: 1
      Ending cylinder Size: 1044
      Size: 自动产生
      					

      单击"Create"创建分区

      Back to the list of physical storage devices

      如果没有特别需求,不需要创建多个分区.

      Edit partitions in /dev/sdb (1044 cylinders with "gpt" label)
      
      Device Type Number Start cyl End cyl Blocks Size Type Delete
      /dev/sdb1 Linux Physical Volume (0x8e) 1 1 10 78831 76.98 MB Primary Delete
      /dev/sdb2 Linux Physical Volume (0x8e) 2 10 100 721920 705.00 MB Primary Delete
      /dev/sdb3 Linux Physical Volume (0x8e) 3 100 200 801792 783.00 MB Primary Delete
      /dev/sdb4 Linux Physical Volume (0x8e) 4 200 300 802816 784.00 MB Primary Delete
      /dev/sdb5 Linux Physical Volume (0x8e) 5 300 400 801792 783.00 MB Primary Delete
      					
    2. Volumes->Volume Group Mgmt.

      Volume Group 可以实现动态扩展空间,注意如果在使用中有一个成员盘损坏,你将无法恢复数据.

      应急使用可以,不建议长期使用.

      Volume group name: vg0
      Select physical volumes to add: 在列表前面打勾
      /dev/sdb1 8.00 GB
      /dev/sdc1 8.00 GB
      					

      单击"Add volume group"创建vg0

      表 8.1. Volume Group Management

      Volume Group NameSizeAllocatedFreeMembersAdd physical storageDelete VG
      vg0

      15.94 GB

      0 bytes15.94 GBView memberPVs AddPVs Delete

      扩展Volume Group单击[PVs Add]按钮

      分区列表前面打勾

      [Submit]提交

    3. Volumes -> Create New Volume

      选择VG

      创建卷

      Volume Name: 卷名
      Volume Description: 描述
      Required Space (MB): 配额
      Filesystem type: 文件系统
      					

      单击[Create]按钮

8.1.2.1. RAID

Openfiler提供软RAID.

  1. Volumes -> Physical Storage Mgmt.

    点击"Edit Disk"列表内硬盘标签,之后可以看到"Create a partition in /dev/sdb"

    单击[Create]按钮创建RAID组成员

    单击[Back to the list of physical storage devices]返回到 "Physical Storage Management"

  2. Volumes -> Software RAID Mgmt.

    Select RAID array type: RAID(0,1,5,6,10)
    Select chunk size: 这可以针对你的需求做优化
    Select RAID devices to add: 打勾选择
    					

    单击[Add array]创建RAID

    RAID创建完成后,就可以卷组和卷

    Volumes -> Volume Group Mgmt. -> Create New Volume

    RAID 6 采用双校验盘最少4块硬盘

8.1.2.2. iSCSI

Volumes -> Create New Volume

单击[Create]按钮

单击[Update]按钮

Services -> Enable/Disable -> iSCSI target 确认已经 Enable

General -> Local Networks

单击[Update]按钮

Volumes -> List of Existing Volumes -> Select Volume Group

单击 iScsi 卷列表 Properties 下的 [Edit] 连接

默认是:Deny, 修为Allow

8.1.2.2.1. Microsoft iSCSI Software Initiator

开始菜单 找到 Microsoft iSCSI Initiator 并运行

单击 Discovery 选项卡

单击 [ Add ] 按钮

单击 [ OK ] 按钮

单击 Targets 选项卡

单击 [Refresh] 按钮 -> [Log On...]

单击 [ OK ] 按钮

完成Initiator设置

我的电脑 -> 单击鼠标右键 -> 管理

初始化硬盘

选择硬盘

初始化完成,红色图标消失后你就可以对磁盘分区,挂载卷,格式化。

使用 iSCSI 与使用本地磁盘完全一样。

Status -> iSCSI

8.1.3. Quota

  • [注意]注意

    有些文件系统不支持Quota

    1. Quota -> Guest Quota

      单击[Change]按钮

      单击[Apply]按钮

8.1.4. Shares

  • Shares

    单击列表内的连接.

    Folder name: 输入文件夹名
    			

    单击 [Create Sub-folder] 按钮 创建文件夹

    Share name: 输入共享名
    Share description: 描述
    Override SMB share name:  
    			

    单击[Change]按钮 修改

    组的权限制

    单击[Update]按钮

    主机访问权限配置

    单击[Update]按钮