Create a virtual hard disk using starwind and automatically mount it to centOS7 when it is booted
Objective: to create a starwind virtual disk in the windows_server_2008_r2 system and mount it in / mnt in centOS7.
Tool: windows_server2008_r2.iso, click the download link: http://pan.baidu.com/s/1o8g9wU2 password: 3jf6
Click the download link for starwind network storage software: http://pan.baidu.com/s/1pKGiYy3 password: 9ktd
Step: after installing the windows_server2008_r2 system (the installation process is omitted), install the starwind storage software in it. Here we refer to http://jimshu.blog.51cto.com/3171847/590412/ directly for the installation steps.
Here I would like to thank the original author The fourth step in the original text is to use windows itself as a client, here we only need to refer to the first three steps.
Step 1: configure the network
Create the centOS7 system, and put the centOS7 system and the windows_server system in the local area network.
Step 2: install the scsi client Note: refer to http://www.thinksaas.cn/topics/0/609/609262.html here
Open the centOS7 terminal
Yum install-y iscsi-initiator-utils
Check to see if there are shared disks
Iscsiadm-mode discoverydb-type sendtargets-portal 192.168.80.12-discover
Note: this IP address is the address of the windows system, and what I show here is
Mount disk
Iscsiadm-mode node-targetname iqn.2008-08.com.starwindsoftware:127.0.0.1-storedisk1-portal 192.168.80.12 targetname iqn.2008 3260-login
After the mount is successful, there is a prompt:
Step 3: Mount to the / mnt directory
Fdisk-l
You can see
Create a folder first
Mkdir / mnt/store1
Mount-t ntfs / dev/sdc1 / mnt/store1
An error occurred:
Solution: solve the problem by using ntfs-3g
Open the download point of ntfs-3g: http://www.tuxera.com/community/open-source-ntfs-3g/
Download, or click the link: http://pan.baidu.com/s/1mhGpfb6 password: tmt7
Place the downloaded file in centOS
Perform the following steps to compile and install:
Install gcc first
Yum-y install gcctar zxvf ntfs-3g_ntfsprogs-2017.3.23.tgzcd ntfs-3g_ntfsprogs-2017.3.23./configuremakemake install
It should be all right after the installation.
Mount-t ntfs-3g / dev/sdc1 / mnt/store1df-h
You can see that it has been mounted!
However, if you restart centOS, you also need to reinstall the above steps for mounting. To do this, you need to write a script for boot self-starting mount.
There are two ways to set up boot mount:
Method 1 needs to be under root:
Vi / etc/rc.d/rc.local
Add content at the end
Iscsiadm-- mode node-- targetname iqn.2008-08.com.starwindsoftware:127.0.0.1-storedisk1-- portal 192.168.80.12 targetname iqn.2008 3260-- loginmount-t ntfs-3g / dev/sdc1 / mnt/store1
Then restart the system.
Method 2 is in the form of script
Vi / etc/rc.d/rc.local
Add content at the end
/ mnt/gzjb/autorun.sh
This is the absolute path to be executed at boot time
Then create the corresponding directory
Mkdir / mnt/gzjbvi / mnt/gzjb/autorun.sh
Add content to autorun.sh
#! / bin/bashiscsiadm-- mode node-- targetname iqn.2008-08.com.starwindsoftware:127.0.0.1-storedisk1-- portal 192.168.80.12 targetname iqn.2008 3260-- loginmount-t ntfs-3g / dev/sdc1 / mnt/store1
Ctrl+c,:wq save
Give file permissions
Chmod + x autorun.sh
Just restart it.