David Burton
2005-Aug-27 11:11 UTC
[Samba] Samba clients can't see partitions mounted via loop device from image files
Is there something special about filesystems mounted via the loop device, which prevents Samba from sharing them? I have a small LAN with several PCs on it. It has a few Windows machines, and a Linux machine running Mandrake 10 (kernel 2.6.3), which shares out its root ("/") read-only as "c". (Temporarily, for testing, it is shared with full write permissions, which I know is terrible.) On the Mandrake (er, Mandriva) Linux box, I have image files from a few small hard disk drives. While logged on as root, I've mounted partitions on two of those image files, via the loop device: # first partition in drive1.ima is an NTFS partition: losetup -r -o 32256 /dev/loop1 drive1.ima mount -t ntfs /dev/loop1 /mnt/img1 # first partition in drive2.ima is a FAT32 partition: losetup -o 32256 /dev/loop2 drive2.ima mount -t vfat /dev/loop2 /mnt/img2 The drive*.ima files and /mnt/img* mount points are all owned by root and are wide-open ("chmod 777"). The loop device mounts work fine: From the Linux box, I can view the files in both /mnt/img1/* and /mnt/img2/* with no problems, and I can create or modify files in /mnt/img2/* Samba is also working: From a Win2K or WinNT 4.0 client PC, I can see everything on the Linux box, and I can read (and temporarily write) files in any of the other partitions which are mounted on the Linux box. But the Windows client machines cannot see any files on either of the two loop-device-mounted partitions. Why?? Note that the syptoms on the two partitions are different. Attempting to browse \\Linuxbox\c\mnt\img1\ (the NTFS partition) from either Windows PC yields: Exploring - \\Linuxbox\c\mnt\img1 -------------------------------------------- X \\Linuxbox\c\mnt\img1 is not accessable. Access is denied. [Retry] [Cancel] Attempting the browse \\Linuxbox\c\mnt\img2\ (the FAT32 partition) from either Windows PC gives no error, but doesn't show any files, either. It is almost as if there was nothing mounted on the mount point folder. But I can tell that the Linux box does know that /mnt/img1 is being accessed, because when a Windows PC is browsing the contents of \\Linuxbox\c\mnt\img2\ in Windows Explorer (and seeing nothing but an empty folder), the Linux box nevertheless cannot umount it, because the umount command yields an error: umount: /mnt/img2: device is busy Does anyone know what is going wrong, and how to fix it, so that the Windows machines can see the loop-device-mounted partitions? Thanks! -Dave dave146 at burtonsys dot com, but please no spam
David Burton
2005-Sep-02 17:29 UTC
[Samba] SOLVED: Samba clients can't see partitions mounted via loop device
dave146@burtonsys.com (David Burton) wrote:> Is there something special about filesystems mounted via > the loop device, which prevents Samba from sharing them?....> On the Mandrake (er, Mandriva) Linux box, I have image > files from a few small hard disk drives. While logged > on as root, I've mounted partitions on two of those > image files, via the loop device: > > # first partition in drive1.ima is an NTFS partition: > losetup -r -o 32256 /dev/loop1 drive1.ima > mount -t ntfs /dev/loop1 /mnt/img1 > # first partition in drive2.ima is a FAT32 partition: > losetup -o 32256 /dev/loop2 drive2.ima > mount -t vfat /dev/loop2 /mnt/img2The problem had nothing to do with the use of the loop device. The "mount" commands were the problem. They needed the "-o umask=0" option, so that Samba's "nobody" user could access the mounted partitions: mount -t ntfs -o umask=0 /dev/loop1 /mnt/img1 mount -t vfat -o umask=0 /dev/loop2 /mnt/img2 -Dave dave146 at burtonsys dot com, but please no spam