环境:Ubuntu Server 12.04
网络上有很多自动挂载磁盘阵列的文章,但是卸载磁盘阵列却很少。本文尝试卸载磁盘阵列,阅读前请最好先看这篇文章Ubuntu Server12.04挂载磁盘阵列
步骤1:取消开机自动挂载
vim /etc/fstab
注释掉下面两行
# /iscsi was on /dev/sdb1 during installation
#UUID=50cb5268-d324-43bc-817e-8ac099d9c659 /iscsi ext4 defaults 0 2
保存退出。
步骤2:删除target
iscsiadm -m node -T iqn.2002-10.com.infortrend:raid.uid277744.001 -p 10.0.10.1 -u
或者
iscsiadm -m node --logoutall=all
步骤3:删除所有iscsi挂载的iqn和IP
cd /etc/iscsi
rm -rf initiatorname.iscsi
rm -rf nodes/
rm -rf send_targets/
步骤4:删除iscsi发现记录
iscsiadm -m node -o delete -T iqn.2002-10.com.infortrend:raid.uid277744.001 -p 10.0.10.1
步骤5:卸载所挂磁盘分区
umount /dev/sdb1
步骤6:删除挂载点
rm -rf /iscsi
步骤结束后挂载的磁盘阵列已经不在,但是使用命令
/etc/init.d/networking restart
依然会出现如下所示的情况
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces... * Disconnecting iSCSI targets
...done.
* Stopping iSCSI initiator service
...done.
* Disconnecting iSCSI targets
...done.
* Stopping iSCSI initiator service
...done.
* Starting iSCSI initiator service iscsid
* Error: InitiatorName file /etc/iscsi/initiatorname.iscsi is missing!
* The iSCSI driver has not been correctly installed and cannot start.
run-parts: /etc/network/if-up.d/open-iscsi exited with return code 1
为避免出现以下情况,我做了极端的做法。
sudo apt-get remove open-iscsi
rm -rf /etc/init.d/open-iscsi
sudo apt-get install open-iscsi
如果不介意上面的提示,可以忽略上面的极端做法。
步骤7:删除或者注释掉磁盘阵列IP网络
ifconfig eth1 down
vim /etc/network/interfaces
注释掉下面的内容
# The primary network interface
#auto eth1
#iface eth1 inet static
# address 10.0.10.10
# netmask 255.255.255.0
保存退出,电脑重启即可。