分类:
2006-10-23 09:42:42
VI3中已经内置了smbclient. 但使用前你必须在configuration|security profile中放开smb client.
你可以用两种方式来使用samba, 一种我称之为ad hoc方式,一种为fstab方式。两者的区别在于对于ad hoc方式,所有的选项都在CLI中,而对于后者,则都在/etc/fstab文件中。
使用samba的步骤为:
1) 在一台Windows服务器上找一个目录,设置共享,并允许读写
2) 在service console中使用ad hoc方式或fstab方式mount这个共享目录
3) 利用cp或vmkfstools等工具备份VM或template
以下为几个常用命令,其中BI-SDS1为对方Windows Server的NetBIOS名称。也即ipconfig /all中的hostname。
1) 查询服务器上的共享(口令指定在命令行中)
smbclient -I 192.168.0.239 -N -U administrator%password –L BI-SDS1
Domain=[BI-SDS1] OS=[Windows Server 2003 3790 Service Pack 1] Server=[Windows
rver 2003 5.2]
Sharename Type Comment
--------- ---- -------
Backup Disk
AimBuffer Disk
IPC$ IPC Remote IPC
ADMIN$ Disk Remote Admin
E$ Disk Default share
Domain=[BI-SDS1] OS=[Windows Server 2003 3790 Service Pack 1] Server=[Windows
rver 2003 5.2]
Server Comment
--------- -------
Workgroup Master
--------- -------
2) 查询服务器上的共享(口令根据提示输入)
smbclient -I 192.168.0.239 -N -U administrator –L BI-SDS1
3) mount共享目录
mount -t smbfs -o ip=192.168.0.239,username=Administrator,
password=******** //BI-SDS1/Backup /share
注意这里指定的共享目录Backup必须与查询时大小写一致。
ad hoc 方式:
前面常用命令已经涵盖了
fstab方式:
首先编辑/etc/fstab,以下为样例(都在一行):
//BI-SDS1/Backup /share smbfs ip=192.168.0.239,username=Administrator,password=2ghlmcl,noauto 0 0
然后mount /share或mount //BI-SDS1/Backup就可以了。