VMware Cloud Community
maal
Contributor
Contributor

Mount smb at startup

Hi,

I'm using ESX 3.0.1 32039 and I added the following command at startup (/etc/rc.d/rc.local):

mount -t smbfs -o username=myuser,password=mypwd //192.168.1.5/backup /mnt/backup[/b]

Of course i tested this command in the shell and it works fine but when i reboot my server the mount is not done ???

Anyone know why ?

Thx

0 Kudos
11 Replies
VirtualKenneth
Virtuoso
Virtuoso

Redirect the output of the command to a log file so you can check what's going on

mount -t smbfs -o username=myuser,password=mypwd //192.168.1.5/backup /mnt/backup > /tmp/log 2>&1

This makes sure that ALL messages (not only error messages) get logged. Maybe this helps you

Maybe networking isn't yet (completely) active when the rc.local scripts executes

maal
Contributor
Contributor

Thank you for the usefull tip here is the error message:

901: session setup failed: Call timed out: server did not respond after 20000 milliseconds

SMB connection failed

Perhaps should i add a delay to start my command but i don't know how...

0 Kudos
VirtualKenneth
Virtuoso
Virtuoso

Well you know the way to award the "useful tip" right ? Smiley Happy

You can try and use the "sleep" command for it, but this only helps if it really is a timeout issue. If it's just the order of starting services this will not work...

But you can try it anyhow.

EDIT: BTW, to verify if it's a order of a timeout you can also add a ping command in the startup with the output to the log file.

0 Kudos
bxg
Contributor
Contributor

Not a complete solution here, but wouldn't be setting this up in /etc/fstab be the correct way of doing this?

Issue command opening ESX firewall to be open for SMB client

esxcfg-firewall -e smbClient

Possibly change AD/Windows server settings to allow client connection from Linux (ESX) (depends on version of OS you are connecting to, see post in this link)

http://www.vmware.com/community/thread.jspa?messageID=563162򉟚;

modify /etc/fstab to mount SMB share - see this link for example

http://www.vmware.com/community/thread.jspa?messageID=573479򌀧

No need to reboot to test, just issue command mount -a to remount, and this will list any errors.

0 Kudos
dinny
Expert
Expert

Hiya,

I haven't tried it on ESX 3.01 yet - but I found a very similar issue on ESX 2.52 - which may well have a similar solution:

I could happily manually mount the SMB share - but adding a mount command in the /etc/fstab never worked at boot.

In the end I found the following needed doing:

By default nothing seems to try to mount smb shares in the boot process.

There is a K75netfs file (this is to bring down any mounted network file systems at shutdown)

This is a symbolic link to /etc/init.d/netfs

But there was no corresponding start command to mount them at boot - I needed to create a startup netfs script via:

cd to /etc/rc3.d (where we want script to be) - then run:

ln -s /etc/init.d/netfs S75netfs (L not I - for link)

Subsequent boots then mounted the file system OK[/i]

I suspect the same issue may well apply to ESX 3.01?

Let me know?

Dinny

0 Kudos
biekee
Hot Shot
Hot Shot

I had the same issue, my solution is:

1. put an entry in /etc/fstab:

//192.168.1.5/backup //mnt/backup smbfs username=myuser,password=mypwd 0 0

2. add an entry in /etc/rc.local:

mount -a

That does the trick at my ESX 2.5 and 3.01 environment.

See if that helps,

bk

0 Kudos
Nautilus
Enthusiast
Enthusiast

/etc/fstab

//server/share /mnt/mountpoint smbfs noauto,username=username,password=passwoooorrdd 0 0

just the last step

type chkconfig netfs on and enter, this was Smiley Happy

after the reboot your mount will be done !

Kind regards Nautilus ________________________________________________________________________________________________________________________________________________ If you found this or any other post helpful please consider the use of the Helpfull/Correct buttons to award points
0 Kudos
dinny
Expert
Expert

Hi Nautilus,

I come from a mainly Windows background - but I'm guessing:

chkconfig netfs on[/i]

is a far easier/better way of acheiving what I did manually via :

ln -s /etc/init.d/netfs S75netfs[/i] etc....

Is that correct?

Dinny

0 Kudos
Nautilus
Enthusiast
Enthusiast

Hi Nautilus,

I come from a mainly Windows background - but I'm

guessing:

me too Smiley Happy

chkconfig netfs on[/i]

is a far easier/better way of acheiving what I did

manually via :

ln -s /etc/init.d/netfs S75netfs[/i] etc....

why you are making a link ?? set the netfs on for your runlevel

you can query this chkconfig --list, when you do not set this ON, you will see OFF as setting for netfs, and when you type

chkconfig netfs on , this will be enabled, you dont need a symbolink link.

Is that correct?

Dinny

look this thread

http://www.vmware.com/community/message.jspa?messageID=505989

Kind regards Nautilus ________________________________________________________________________________________________________________________________________________ If you found this or any other post helpful please consider the use of the Helpfull/Correct buttons to award points
0 Kudos
dinny
Expert
Expert

Hiya,

I was only doing it that way because I more or less worked out how it all hung together from first principles - I didn't know much about runlevels or chkconfig at the time.

chkconfig netfs on[/i] is a far better way to go.

Dinny

0 Kudos
johnswb
Enthusiast
Enthusiast

biekee

This did the trick for me; thx for the info.

Will Johnson VCP on VI3 / VI4 vSphere 5
0 Kudos