# Mounting Samba Partitions

## Ian

I've just gotten my Gentoo computer up and running perfectly (well, windows got killed in the process, but that could be considered a good omen...), except for being able to mount samba shares.  a while back i got an old computer, and put debian on it.  my dad then gave me a 120 gig hard drive, and said "turn it into a server".  so, i did, and got samba running perfectly.  now, the only time i reboot that computer is when the power goes out, and i barely touch it.  because i have a 100 MB/sec ethernet LAN in my house, i decided to put my MP3s on the debian computer, and i think i'm going to move my school work there too.  the reason?  as far as i know, i can't read fat32 partitions with linux (i know i can somehow, but i haven't found anything yet, and i haven't tried looking, yet).  seeing as i already have half a samba network set up, i figured i might as well finish it.

i went to www.samba.org, and looked around, trying to find out how to mount a samba partition.  i figured it out, but then realized you need the "smbfs" package to use the "smbmount/smbumount" commands.  i ran an "emerge smbfs", and of course, found nothing.  now, here's my problem.  i'm trying to get to my samba server, and hopefully be able to put something in fstab, so that i can auto mount when i boot (the gentoo computer is noisy, so i usually shut it off at night unless i'm compiling stuff).  in any case, i need to find out some way to get the smbfs package installed on my computer, so i can fix my problem.  take in mind, i just installed gentoo, so i don't know much, but i'm good at copying and pasting commands (or links to other places that might help me)  :Wink: .

----------

## splooge

emerge samba

Make sure samba is compiled into your kernel, it's under network file systems.

----------

## Ian

yeah, i got that far.  i actually figured out how to mount it, but it's not wanting to work.

```
# smbmount "\\\\Catbert\\Arch - Gen" /arch/gen username=Ian

Password:

4813: session setup failed: ERRSRV - ERRbadpw (Bad password - name/password pair in a Tree Connect or Session Setup are invalid.)

SMB connection failed

```

i try that with and without a username, and i get that same error every time.   i know for a fact that the username/password are correct, but i don't know why i'm being told they aren't. 

Anyone have any experience with making samba work?

<edit>

and yes, i know that my computer is named "Catbert", but it's something my dad started, so i'm sticking with it :p.Last edited by Ian on Sun Nov 03, 2002 1:15 am; edited 1 time in total

----------

## metalhedd

if smbfs is in the kernel you don't even need to emerge samba, you can just mount -t smbfs //debianbox/share /mnt/foo

As for fat32. linux supports read and write fully.. just mount the fat partition and everything will just work. vfat support has to be in the kernel.

you should probably specify fat in the mount options just to be safe. 

'mount -t vfat /dev/hda3 /mnt/winblows'

----------

## Ian

when i try 'mount -t smbfs //debianbox/share /mnt/foo' i get a little thing on mount...

```
# mount -t smbfs //Catbert/Arch - Gen /arch/gen

Usage: mount -V                 : print version

       mount -h                 : print this help

       mount                    : list mounted filesystems

       mount -l                 : idem, including volume labels

So far the informational part. Next the mounting.

The command is `mount [-t fstype] something somewhere'.

Details found in /etc/fstab may be omitted.

       mount -a                 : mount all stuff from /etc/fstab

       mount device             : mount device at the known place

       mount directory          : mount known device here

       mount -t type dev dir    : ordinary mount command

Note that one does not really mount a device, one mounts

a filesystem (of the given type) found on the device.

One can also mount an already visible directory tree elsewhere:

       mount --bind olddir newdir

or move a subtree:

       mount --move olddir newdir

A device can be given by name, say /dev/hda1 or /dev/cdrom,

or by label, using  -L label  or by uuid, using  -U uuid .

Other options: [-nfFrsvw] [-o options] [-p num].

For many more details, say  man 8 mount .
```

as far as i can tell, it just tells me how to use the mount command, but it's not actually mounting it.  at least now i understand how it works, but it's still not working :p.

----------

## metalhedd

in that case either you dont have smbfs support in your kernel or i told you the wrong commandline.  it might be sambafs or something, I dunno, I'm at a stupid NT4 Machine. blarg

----------

## Ian

lol, i have 'SMB File System Support' compiled in the kernel.  is that all i need?  also, there are a few different commands i've seen so far (from something like yours to something like mount.smbfs i think), so i'm starting to get more and more confused :p.  i'll try some more stuff out, see if i can find it.

----------

## metalhedd

never seen mount.smbfs but theres smbmount if you emerge samba.

----------

## splooge

"never seen mount.smbfs but theres smbmount if you emerge samba."

This is why I told him to emerge samba.  

smbmount -o username=xxx,password=xxx //server/share /mnt/wherever

----------

## Ian

uh splooge, your way gave me something similar to what i've been getting.  it also says that it's the same as mount.smbfs (that's probably where i saw it before).  so yeah, unless i just typed something in wrong (which could be the case) the smbmount thing doesn't work either :/.

----------

## splooge

Hrm, try adding this to /etc/fstab:

//10.1.1.200/c   /mnt/c   smbfs   noatime,noauto   0 0

Make sure your mount point /mnt/c exists:

mkdir /mnt/c

then:

mount /mnt/c

See if that helps.

----------

## Ian

nope, fstab doesn't like smbfs mounting in it.  just tells me the line it's on is bad.  this is starting to annoy me, because it should be so simple, yet it's not...

*pulls out his hair*

oh well, at least i'm getting somewhere with it (even though it is much yet).

----------

## splooge

For ease's sake ... take out the spaces in the sharename, and try again, making sure there's only the spaces that are appropriate in your fstab.

----------

## haidar

Hello,

I am not sure if you did this or not, I always have to add a username in the samba password file like this:

   smbpasswd username

it will prompt you for a password. you need to use the same username and password as in the windows machine.

also did you make sure that the option :

    encrypt passwords = true

is in your smb.conf file

I hope this helps.

Ayman

----------

## Ian

yeah, i've had the server side set up for a while now.  that part i know works, and i have no problem going windows --> linux (i haven't tried linux --> windows, because i never had to yet).  the problem i'm having is the client side on linux, because this is the first time i've gone linux (client) --> linux (server), mostly because i've never had a second linux computer till now :p.

Also, the way i set up the share names, they have spaces and such in them, so they looked pretty on my windows computers (yeah, a stupid reason, but it meant hitting the space bar twice, so i didn't really care).

----------

## Ian

 *splooge wrote:*   

> For ease's sake ... take out the spaces in the sharename, and try again, making sure there's only the spaces that are appropriate in your fstab.

 

i just tried this, and it works, partially.  it sees the share, and tries to connect, but it seems to refuse the password :/.  i have a few more things i can try, but i'm not sure if it will work.

----------

## securiteaze

Try this

```
mount -t smbfs -o username=Ian,password=pass //Catbert/Arch\ -\ Gen /mnt/catbert
```

I also agree that spaces in shares are not wonderful, but if you like 'em, so be it.

----------

## Ian

thank you * a bajillion  :Very Happy: 

that way works, why i don't know, but just that it does, after i remembered to put my password in place of pass, that is... :p.  i tried to remove the spaces, but since i'm lazy and use SWAT, i wasn't able to easily.  of course, it takes me a whole 3 seconds to take them out, but i guess if this way works, it's better.  once again, thanks a bunch, because i think this means that my base system is finally complete  :Smile: .

----------

## Liebniz

metalhedd, are you sure about that smbfs kernel support being all you require for the system to act as a smb client?

i've spent a few hours searching threads, docs, samba site, how-to's (and on and on) with no success of finding any information about that issue.

my situation: i have only a 2gb drive on my laptop and all i need is the smb client piece.  i would prefer not to emerge samba, as the package is so large.  however, it looks like i have to do that in order to mount any foreign partitions.

i have smbfs support in the kernel.  i tried it statically and as a module. in all instances, a 'lsmod' showed it was in fact loaded.  however, a 'mount -t smbfs //foreign/share /mnt/mntpoint -o username=fred' returns only the now familiar 'smbfs not supported in the kernel'.

actully i do have samba emerged and it works fine, but i would like to unmerge it for the space value if i can...

...or did you just copy the smbmount binary from another system to make that work?

----------

## metalhedd

well I emerge samba in its entirety (sp?) because I had full intentions of using the server as well.. but I remember seeing somewhere that you don't need the server installed or running, you just need to mount the shares as smbfs.  if you're saying that right now you have samba installed completely and you still can't mount the shares then the problem must be somewhere else.  did you try the smbmount or smbclient commands>?

----------

## Liebniz

that's the thing.  when you emerge samba, it works fine (well, it may be an issue samba mounting a foreign partition onto a local reiserfs filesystem, but that's another issue) 

i was also under the impression that there was enough smb kernel support to effectively work as a smb client without emerging samba.  perhaps i read too much into that functionality.  kernel support doesn't imply 'client'.  it must have been wishful thinking on my part.

anyway, the whole goal of gentoo (imho) is to have only exactly what you need, and no more.  and what you have, you have optimized.  that's obviously important when you only have a p166mmx laptop with a 2gb drive.

i ended up just emerging samba.  i may have extra utils on my machine that i won't use but at least i can now have /usr/portage and  /var/tmp/portage as mounted partitions.

 :Confused: 

----------

## Oo.et.oO

from man fstab:

 *Quote:*   

> If the name of the mount point contains spaces these can be escaped as `\040'.

 

this, of course, works for the device as well (in this case the smb share)

here is my fstab:

```

# <fs>             <mountpoint>    <type>     <opts>    <dump/pass>

/dev/hda1      /boot   ext3   noauto,noatime   1 1

/dev/hda2      /   ext3   noatime    0 0

/dev/hda3      none      swap      sw 0 0

proc         /proc      proc      defaults 0 0

/dev/cdroms/cdrom0      /mnt/cdrom      auto           user,noauto,ro 0 0

/dev/fd0      /mnt/floppy   auto      user,noauto 0 0

//lex/my\040shared\040fo   /mnt/lex/mp3   smbfs      user,noauto 0 0

```

----------

