admin管理员组文章数量:1438924
目录
文章目录
- 目录
- 一 、准备两台机器
- 1.1 windows 7 系统
- 1.2 linux Centos7.2 系统
- 1.3 保证两台机器网络可以ping通
- 二 、共享windows上的F盘中的特定文件夹
- 三 、linux上执行挂载命令
- 3.1 创建文件夹作为挂载点(也可以用已经存在的)
- 3.2 在挂载点文件夹中创建文件
- 3.3 在windows共享文件夹中创建文件
- 3.4 在linux上执行挂载命令
- 3.5 在linux挂载点文件夹内创建新文件(夹)
- 3.6 在windows共享文件夹内创建新文件(夹)
- 3.7 在linux挂载点文件夹内删除文件(夹)
- 3.8 在windows共享文件夹内删除文件(夹)
- 四、取消挂载
一 、准备两台机器
1.1 windows 7 系统
IP地址:192.168.2.93
1.2 linux Centos7.2 系统
IP地址:192.168.2.250
1.3 保证两台机器网络可以ping通
二 、共享windows上的F盘中的特定文件夹
共享账号:ad
共享密码:sharepasswd
共享成功之后,可以通过\\192.168.2.93的方式连接到共享文件夹。
三 、linux上执行挂载命令
3.1 创建文件夹作为挂载点(也可以用已经存在的)
注意:挂载点是必须先存在的。
[root@dscq-250 ~]# pwd
/root
[root@dscq-250 ~]# mkdir /root/test
[root@dscq-250 ~]# ll
总用量 4
-rw-------. 1 root root 1000 8月 4 10:50 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 9月 9 15:05 test
3.2 在挂载点文件夹中创建文件
[root@dscq-250 test]# pwd
/root/test
[root@dscq-250 test]# touch from_linux_before_mount.log
[root@dscq-250 test]# ll
总用量 0
-rw-r--r--. 1 root root 0 9月 9 15:08 from_linux_before_mount.log
3.3 在windows共享文件夹中创建文件
3.4 在linux上执行挂载命令
[root@dscq-250 test]# cd ../ #挂载时一定不要在挂载点当前目录,否则容易挂载失败
[root@dscq-250 ~]# mount //192.168.2.93/share /root/test -o username=ad,,password=sharepasswd
[root@dscq-250 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 50G 6.7G 44G 14% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 89M 3.8G 3% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/mapper/centos-home 146G 680M 146G 1% /home
/dev/xvda1 497M 125M 373M 26% /boot
tmpfs 730M 0 730M 0% /run/user/0
//192.168.2.93/share 430G 40G 390G 10% /root/test ##看到这一行表示挂载成功##
[root@dscq-250 ~]# cd /root/test/
[root@dscq-250 test]# ll
总用量 0
drwxr-xr-x. 2 root root 0 9月 9 11:41 12233
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
注意:
- 挂载成功之后,查看windows共享文件夹发现并没有新增挂载前在linux挂载点创建的文件(夹);
- 挂载成功之后,查看linux挂载点发现已经新增挂载前在windows共享文件夹创建的文件(夹);
- 挂载成功之后,查看linux挂载点并未看到挂载前在linux挂载点文件夹创建的文件(夹);
3.5 在linux挂载点文件夹内创建新文件(夹)
[root@dscq-250 test]# pwd
/root/test
[root@dscq-250 test]# ll
总用量 0
drwxr-xr-x. 2 root root 0 9月 9 11:41 12233
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
[root@dscq-250 test]# touch from_linux_after_mount.log
[root@dscq-250 test]# ll
总用量 0
drwxr-xr-x. 2 root root 0 9月 9 11:41 12233
-rwxr-xr-x. 1 root root 0 9月 9 15:40 from_linux_after_mount.log #####
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
注意:挂载成功之后,若在linux挂载点创建新文件(夹)是可以在windows共享文件夹中查看到的;
3.6 在windows共享文件夹内创建新文件(夹)
[root@dscq-250 test]# ll
总用量 0
drwxr-xr-x. 2 root root 0 9月 9 11:41 12233
-rwxr-xr-x. 1 root root 0 9月 9 15:40 from_linux_after_mount.log
drwxr-xr-x. 2 root root 0 9月 9 15:42 from windows after mount #######
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
注意:挂载成功之后,若在windows共享文件夹创建新文件(夹)还是可以在linux挂载点文件夹中查看到的;
3.7 在linux挂载点文件夹内删除文件(夹)
[root@dscq-250 test]# ll
总用量 0
drwxr-xr-x. 2 root root 0 9月 9 11:41 12233
-rwxr-xr-x. 1 root root 0 9月 9 15:40 from_linux_after_mount.log
drwxr-xr-x. 2 root root 0 9月 9 15:42 from windows after mount
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
您在 /var/spool/mail/root 中有新邮件
[root@dscq-250 test]# rm -rf 12233
[root@dscq-250 test]# ll
总用量 0
-rwxr-xr-x. 1 root root 0 9月 9 15:40 from_linux_after_mount.log
drwxr-xr-x. 2 root root 0 9月 9 15:42 from windows after mount
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
注意:挂载成功之后,若在linux挂载点删除新文件(夹)是可以在windows共享文件夹中看到变化的;
3.8 在windows共享文件夹内删除文件(夹)
操作删除文件夹from windows after mount
[root@dscq-250 test]# pwd
/root/test
[root@dscq-250 test]# ll
总用量 0
-rwxr-xr-x. 1 root root 0 9月 9 15:40 from_linux_after_mount.log
-rwxr-xr-x. 1 root root 0 9月 9 11:42 from windows before mount.txt
-rwxr-xr-x. 1 root root 0 9月 9 11:42 欢迎来到共享文件夹.txt
注意:挂载成功之后,若在windows共享文件夹删除新文件(夹)是可以在linux挂载点文件夹中看到变化的;
四、取消挂载
[root@dscq-250 test]# umount /root/test
umount: /root/test:目标忙。
(有些情况下通过 lsof(8) 或 fuser(1) 可以
找到有关使用该设备的进程的有用信息)
[root@dscq-250 test]# cd ../
[root@dscq-250 ~]# umount /root/test
[root@dscq-250 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 50G 6.7G 44G 14% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 89M 3.8G 3% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/mapper/centos-home 146G 680M 146G 1% /home
/dev/xvda1 497M 125M 373M 26% /boot
tmpfs 730M 0 730M 0% /run/user/0
[root@dscq-250 ~]# cd /root/test/
[root@dscq-250 test]# ll
总用量 0
-rw-r--r--. 1 root root 0 9月 9 15:34 from_linux_before_mount.log
注意:取消挂载之后,原来在/root/test文件夹中的文件(夹)又可以看到了;
版权声明:本文标题:如何将局域网中的windows硬盘挂载到 linux系统中 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/biancheng/1747596115a2725260.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论