linux文件备份到windows方法

背景

需编写部门wiki备份数据脚本。但wiki部署在linux上,而需将备份数据传到windows上。

方案

  1. 在windows上共享一个目录;
  2. 将windows上共享的目录绑定到/mnt目录下;
  3. 将linux文件cp到绑定了windows共享目录的/mnt下;

过程记录

在windows上创建共享目录

在我的本地创建目录F: estRemoteBakData
在我本地创建一个用户 test / test!23
共享文件地址:testRemoteBakData (file://xxx/testRemoteBakData)

//192.168.x.xxx/testRemoteBakData

将windows上共享的目录绑定到/mnt目录下

mount -t smbfs -o username=test,password=test!23 //192.168.x.xxx/testRemoteBakData /mnt/backup
(ps:需提前创建好/mnt/backup目录)

运行出错:mount: unknown filesystem type 'smbfs'

查看资料说是需要将smbfs 修改为cifs (http://blog.csdn.net/alan_wdd/article/details/50441743)
mount -t cifs -o username=test,password=test!23 //192.168.x.xxx/testRemoteBakData /mnt/backup

mount.cifs -o username="test",password="test!23" //192.168.x.xxx/testRemoteBakData /mnt/backup
再次运行:出现权限问题

发现问题了,密码和输入的密码不一样啊,难道是不能用符号作为密码吗?

修改windows的test用户的密码为:test/test123

再次尝试挂载,成功!!!
mount -t cifs -o username=test,password=test123 //192.168.x.xxx/testRemoteBakData /mnt/backup

那我尝试能不能将linux上的文件拷贝到windows上
可以复制文件过去,也可创建目录。哈哈哈

问题处理

第一次挂载成功,但是当我拷贝了一个20G+的文件后,第二次挂载就出现如下问题:

mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

处理方法:
(参考:http://blog.chinaunix.net/uid-27092216-id-4606003.html
http://blog.csdn.net/linking530/article/details/45825659)
regedit启动注册表
创建
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory ManagementLargeSystemCache” to “”1
创建LargeSystemCache并赋值为1

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParametersSize” to “3″.
我将1 修改为 3

重启windows系统

参考自:http://bbs.csdn.net/topics/200079789

原文地址:https://www.cnblogs.com/wsygdb/p/7390573.html