smbmount fails to resolve hostname's address

Solution 1:

That's weird... normally smbmount can figure out names on its own. However, since it doesn't, you could use nmblookup to figure out which resolution methods work, and then use it as part of your mount command. For example, if you use a WINS server:

$ nmblookup -R -U 172.16.1.3 Haruhi
querying Haruhi on 172.16.1.3
172.16.1.3 Haruhi<00>

then you can extract it with a little shell work:

$ nmblookup -R -U 172.16.1.3 Haruhi | grep 'Haruhi<00>' | cut -d' ' -f1
172.16.1.3

so you can put it all together:

smbmount //HP/D /media/hp/d/ -o ip=`nmblookup -R -U 172.16.1.3 HP | grep 'HP<00>' | cut -d' ' -f1`

and thus you don't have an IP listed.

Solution 2:

On Debian and probably others, install winbind:

apt-get install winbind

And check that "/etc/nsswitch.conf" has "wins" in the "hosts" line, as in:

hosts: files dns wins

This second one may already have been done for you.

The package creates the file /lib/libnss_wins.so

http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/integrate-ms-networks.html#id2668413

You can then just add the entries to the /etc/fstab file.