freenas安装mysql_FreeNAS 安装与配置(版本9.3 与11.04)

本文档介绍了在FreeNAS 11.04上安装和配置MySQL的过程,包括磁盘格式化、分区、挂载、开机自动挂载以及Linux系统下通过iscsi连接FreeNAS的步骤。详细步骤涵盖从创建目标(Target)到登录共享存储,并实现了iscsi磁盘的自动挂载。
摘要由CSDN通过智能技术生成

#格式化完成检查

[root@localhost data]# fdisk -l

Disk/dev/sda: 214.7 GB, 214748364800 bytes, 419430400sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x000a43f1Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83Linux/dev/sda2 1026048 419430399 2092021768e Linux LVM

Disk/dev/mapper/centos-root: 205.8 GB, 205759971328 bytes, 401874944sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk/dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk/dev/sdb: 107.4 GB, 107374182400 bytes, 209715200sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 4096 bytes / 1048576bytes

Disk label type: dos

Disk identifier:0xd96b07f4Device Boot Start End Blocks Id System/dev/sdb1 2048 209715199 104856576 83 Linux

#指定分区格式

[root@localhost data]# mkfs.ext4 /dev/sdb1

mke2fs1.42.9 (28-Dec-2013)

Filesystem label=OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=256blocks6553600 inodes, 26214144blocks1310707 blocks (5.00%) reserved forthe super user

First data block=0Maximum filesystem blocks=2174746624

800 block groups

32768 blocks per group, 32768fragments per group8192inodes per group

Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872Allocating group tables:doneWriting inode tables:doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information:done

#挂载并写入文件

[root@localhost ~]# mkdir /data/iscsi

[root@localhost ~]# mount -t ext4 /dev/sdb1 /data/iscsi/

[root@localhost ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 192G 1.4G 191G 1% /

devtmpfs 3.9G 0 3.9G 0% /dev

tmpfs 3.9G 0 3.9G 0% /dev/shm

tmpfs 3.9G 8.7M 3.9G 1% /run

tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup

/dev/sda1 497M 108M 390M 22% /boot

tmpfs 797M 0 797M 0% /run/user/0

/dev/sdb1 99G 61M 94G 1% /data/iscsi

#设置开机自动挂载

echo "/dev/sdb1 /data/iscsi/ ext4 defaults 0 0" >> /etc/fstab

#检查

[root@localhost mnt]# cat /etc/fstab

#

#/etc/fstab

# Created by anaconda on Fri Nov10 19:40:13 2017#

# Accessible filesystems, by reference, are maintained under'/dev/disk'# Seeman pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#/dev/mapper/centos-root / xfs defaults 0 0UUID=115aec57-6962-443e-9878-943f3e207a84 /boot xfs defaults 0 0

/dev/mapper/centos-swap swap swap defaults 0 0

/dev/sdb1 /data/iscsi/ ext4 defaults 0 0

#查看并创建文件

[root@localhost ~]# df -h

Filesystem Size Used Avail Use%Mounted on/dev/mapper/centos-root 192G 1.4G 191G 1% /devtmpfs3.9G 0 3.9G 0% /dev

tmpfs3.9G 0 3.9G 0% /dev/shm

tmpfs3.9G 8.6M 3.9G 1% /run

tmpfs3.9G 0 3.9G 0% /sys/fs/cgroup/dev/sda1 497M 108M 390M 22% /boot

tmpfs 797M0 797M 0% /run/user/0

/dev/sdb1 99G 61M 94G 1% /data/iscsi

[root@localhost~]# cd /data/iscsi/[root@localhost iscsi]#touchtest2

[root@localhost iscsi]# ll

total16drwx------ 2 root root 16384 Nov 22 11:30 lost+found-rw-r--r-- 1 root root 0 Nov 22 11:59 test2

#卸载挂载的分区

[root@localhost ~]# umount /dev/sdb1

[root@localhost~]# df -h

Filesystem Size Used Avail Use%Mounted on/dev/mapper/centos-root 192G 1.4G 191G 1% /devtmpfs3.9G 0 3.9G 0% /dev

tmpfs3.9G 0 3.9G 0% /dev/shm

tmpfs3.9G 8.6M 3.9G 1% /run

tmpfs3.9G 0 3.9G 0% /sys/fs/cgroup/dev/sda1 497M 108M 390M 22% /boot

tmpfs 797M0 797M 0% /run/user/0

FreeNas11.04 配置iscsi

1、全局配置

d64329de4dcdc0c24b22ab5853713c44.png

2、采用不认证的方式

59c83e431601594d41cb3bd220764af6.png

3、配置后的效果

fb676708fc1ba1050efe3a93247f5154.png

4、配置认证网络

3ea3967afa3ae364d3d5025b4520545a.png

5、ALL 或192.168.1.1/24 (某一网段)

06eb825c262219be47be7aeadddf1afc.png

6、配置共享账号

6fdbe3334f7ec0bfbc6da1c3afbe3bd7.png

配置共享账号效果如下:

72c350912b1770da76911eeb53a66c07.png

7、配置Targent不认证方式访问

ccd12e595e8a85ebe9dad8de92a59554.png

63b728f8bf68e5878f82d118fce3e38e.png

8、配置共享目录名称,位置,大小,硬盘RPM.

5004d4ff2992bd4b4ec68eb1491e47d8.png

9、Extents配置完成效果图

de06211abbf363089e4692d083191e1f.png

10、设置Associated Targets

ec9c97c2fce4ac931068eb6189de7b4e.png

11、点发现(Discovery)---->Discover Portal:输入IP和端口号--->ok。(其它地方直接用默认设置,即可)

90580778c67cdbe2894abd27e31fec2a.png

12、Targets(查看连接状态)

e568e8cdf28bb3c6eab42fca54bbfc97.png

13、点磁盘管理,会弹出(检测到了新硬盘),指定GPT格式,再分区格式化,即可使用。

6ea1d9886a028b64b2572889bf38ad3b.png

如果之前挂载过相同的iscsi磁盘,再挂载时会报错,只需点再Rescan Disks即可,修复。

14、linux下Targets连接方法

#注意他们的端口号是不一样的(备注:默认3260时,可以不指定端口号 )

[root@template ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.140

#如果改了端口号,在后面要指定端口号

[root@template ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.140:3261

192.168.1.140:3261,2 iqn.gitlab.11.0

15、登录到共享存储(备注:这里测试登录不同端口的共享盘)

[root@template ~]# iscsiadm -m node -T iqn.gitlab.11.0 -p 192.168.1.140:3261 -l

Logging in to [iface: default, target: iqn.gitlab.11.0, portal: 192.168.1.140,3261] (multiple)

Login to [iface: default, target: iqn.gitlab.11.0, portal: 192.168.1.140,3261] successful.

16、卸载iscsi

[root@next-cloud-server ~]# iscsiadm -m node -T iqn.netcloud.11.0 -u

Logging out of session [sid: 1, target: iqn.netcloud.11.0, portal: 10.0.101.6,3261]

Logout of [sid: 1, target: iqn.netcloud.11.0, portal: 10.0.101.6,3261] successful.

17、实现iscsi自动挂载磁盘

Fedora25设置开机自动挂载

#配置iscsi自动发现

cat /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.netcloud.11.0

#重新启动服务

systemctl restart iscsid

systemctl status iscsid

systemctl enable iscsid

#设置开机自动挂载

[root@next-cloud-server ~]# vi /etc/rc.d/rc.local

#!/bin/sh

#mount iscsi disk 5TB

sleep 10

mount -t xfs /dev/sda /data

#授权

chmod +x /etc/rc.d/rc.local

#添加服务

[root@next-cloud-server ~]# vim /usr/lib/systemd/system/rc-local.service

# This file is part of systemd.

#

# systemd is free software; you can redistribute it and/or modify it

# under the terms of the GNU Lesser General Public License as published by

# the Free Software Foundation; either version 2.1 of the License, or

# (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by

# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.

[Unit]

Description=/etc/rc.d/rc.local Compatibility

ConditionFileIsExecutable=/etc/rc.d/rc.local

After=network.target

[Service]

Type=forking

ExecStart=/etc/rc.d/rc.local start

TimeoutSec=0

RemainAfterExit=yes

GuessMainPID=no

#添加下面两行代码,实现rc-local作为服务启动

[Install]

WantedBy=multi-user.target

#启动服务

systemctl daemon-reload

systemctl start rc-local.service   (备注:去掉这行)

systemctl enable rc-local.service

参考:http://blog.csdn.net/u013372441/article/details/77414471

18、挂载分区5T

分区

fdisk /dev/sda

g   #大于5tb

再回车分区到完成

partprobe

mkfs.xfs -f /dev/sda

mount -t xfs /dev/sda /data/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值