[Samba] Re: Multiple client access same file

Chris de Vidal cdevidal at yahoo.com
Sun Feb 23 04:45:53 GMT 2003


--- Shane Kennedy <skenn at indigo.ie> wrote:
> Basically, the application freezes in patches, and
> eventually, app 
> hangs.  With 8 users accessing 2 identical shares 
> (I duplicated the iso, 
> mount both of them, and share both), at least 2 of
> them are likely to 
> have hung within 5 minutes.

I'm not sure this would even work well in Windows. 
CDs make poor multi-user drives.  As I understand it,
they work well in single-user applications where the
head doesn't have to move around much.  I recall
someone telling me I'd burn out a CD drive in no time
if I shared it on an FTP server, and Samba would be no
different.

Instead, Linux (and probably other *nixes) gives you
the option to copy the contents of a CD to an iso and
then mount that iso into a loopback device just like
any other files in your system.  In a nutshell, this
is how it's done:

Make sure your kernel has loop support:
depmod -a
modprobe -l | grep loop
(Nothing?  Try this: grep loop /proc/filesystems.  If
it's there, it's built into the kernel.  If not,
compile it in or as a module.)
mkdir /samba/share/cdrom1 (or something like that)
(insert CD)
mount /mnt/cdrom
cd /mnt/cdrom
mkisofs -o /place/where/you/store/iso/files/cdrom1.iso
.
(man mkisofs or read the CD-writing HOWTO for details
or other flags you might need)
vi /etc/fstab
(add a line like this:)
/place/where/you/store/iso/files/cdrom1.iso
/samba/share/cdrom1 iso9660 loop=/dev/loop1
(all on one line)
mount /samba/share/cdrom1

Do the same for your other CDs, except you're using
/samba/share/cdrom2 and /dev/loop2, and so on.

Finally, write shares in /etc/samba/smb.conf:
[cdrom1]
path=/samba/share/cdrom1
[cdrom2]
path=/samba/share/cdrom2
...

You can get fancy with fstab mount options like
gid=sambausers and put everyone in this group for
read-only.  umask=227 will give r-xr-x--- perms to
every file and directory for execution.

The caveats are iso files (like CDs) are read-only. 
This may be to your benefit, as the user can't
corrupt, delete, overwrite, modify, trojanize, etc.
your programs.

Also this takes up 650MB per image (naturally) but
with hard drives costing about $1/GB this is hardly a
problem.  And you can store wayy more images in a
server with a 100GB drive than with a bunch o' CD
drives.

Lastly, the loop module takes an argument to allow
more than 8 loopback devices.  modinfo loop or Google
for details.  You'll also need corresponding devices
added for your extra loopback devices in /dev
(/dev/loopXX), like so:
mknod /dev/loop46 b 7 46
mknod /dev/loop47 b 7 47
mknod /dev/loop48 b 7 48
...


Hope this helps,
/dev/idal

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


More information about the samba mailing list