volman: an experimental FreeBSD volume manager

Hi,

A while ago I wrote [thread=23105]an elaborate shell script[/thread] to provide HAL-style disk mounting in Openbox (still my favourite WM btw). Personally it's been really successful for my own use, and I get the impression others have liked it too. Well I've been tweaking it here and there, and it's now an even more elaborate shell script, but it's at the point where I think it can serve as a generic FreeBSD volume manager for more than just Openbox.

It still lacks a client for KDE/Gnome/XFCE type environments, but I decided to put up what I've written so far in the hope someone will write a client for the above. I haven't used those desktop environments for a while, and don't plan to anytime soon, so I figured it's best someone else called the shots on how such a client should work!

The CLI and Openbox clients are rewritten for the new client/server architecture, and they function in much the same way as before. And yes, I changed the name of it again! I felt the old name was too misleading as this technically is not an auto-mounting thingie. (unless someone writes a client to do just that)

It's in the PR database for now: PR ports/161977.

Hopefully this one will get committed!

In addition to the new architecture, NTFS3G aka read/write NTFS support is now done! Sudo is also no longer needed, and a configuration file with some options has been added. In total this supports UFS, EXT2, FAT32, and NTFS. Only USB based storage devices have been tested by me.
 
Aragon, thanks a lot for your script!
But i can't understand how it setup to work properly.
I do:
extract ports/161977 in /usr/ports/sysutils
# cd /usr/ports/sysutils/volman && make install clean
After install i'm add to rc.conf
Code:
volmand_enable="YES"
and
# cp /usr/local/etc/volman.conf.example /usr/local/etc/volman.conf
and edit it:
Code:
# What device names amountd must look for.
DEVMATCH="^(da|mmcsd)"

# What label names amountd must look for.
LABELMATCH="^(msdosfs|ntfs|ufs)/"

# Base directory into which volumes will be mounted.
MNTPREFIX=/media

# If YES, subdirectories below MNTPREFIX will always match the device name.
# Otherwise the volume's label will be used if it exists.
DEVMPOINT=NO

# Where amount keeps all its working data and FIFOs.
WRKDIR=/var/tmp/volman
after that i'm do
# /usr/local/etc/rc.d/volmand start
and insert flash disk
# tail /var/log/messages
Code:
Nov  5 00:11:13 OLD-BSD volmand: CREATE da1
Nov  5 00:11:13 OLD-BSD kernel: ugen0.5: <vendor 0x13fe> at usbus0
Nov  5 00:11:13 OLD-BSD kernel: umass1: <vendor 0x13fe USB DISK 2.0, class 0/0, rev 2.00/1.00, addr 5> on usbus0
Nov  5 00:11:13 OLD-BSD kernel: da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
Nov  5 00:11:13 OLD-BSD kernel: da1: < USB DISK 2.0 PMAP> Removable Direct Access SCSI-0 device 
Nov  5 00:11:13 OLD-BSD kernel: da1: 1.000MB/s transfers
Nov  5 00:11:13 OLD-BSD kernel: da1: 3825MB (7834944 512 byte sectors: 255H 63S/T 487C)
Nov  5 00:11:14 OLD-BSD volmand: CREATE da1s1
but not in /media or anywhere else and in output of df not appears new device.
I have a
Code:
vfs.usermount=1
what i do wrong?
Maybe problem in that my flash disk uses FAT32 with locale CP1251, or it LABEL have cyrillic symbols in that codepage?

My OS is FreeBSD 9.0 RC1
 
G_Nerc said:
I have a
Code:
vfs.usermount=1
Usermount not needed.


G_Nerc said:
what i do wrong?
Type vmount. It should show you a list of devices that have been detected, and their mount status. Once you see the one you want to mount:

$ vmount da1s1

And the same when you want to umount it.


G_Nerc said:
Maybe problem in that my flash disk uses FAT32 with locale CP1251, or it LABEL have cyrillic symbols in that codepage?

My OS is FreeBSD 9.0 RC1
See what happens, and let us know. :)
 
Yes it works! Thanks a lot!
But i have some request :)
  1. Maybe add in conf file option with ability to automount devices?
  2. And add options like mount_script [script to execute when mounts new device] (for example with that script will be easy integrate volman with idesk & fluxbox. Insert flash and icons for it appears), similar with umount_script
  3. And option to set prefered codepage. Because my flash disk after $ vmount da1s1 shows files in russian like ???????.pdf (Without volman i use for mounting such command # mount_msdosfs -L ru_RU.UTF-8 -D CP866 /dev/da0s1 /mnt/flash)
 
G_Nerc said:
Yes it works! Thanks a lot!
Great! Welcome.

G_Nerc said:
  1. Maybe add in conf file option with ability to automount devices?
  2. And add options like mount_script [script to execute when mounts new device] (for example with that script will be easy integrate volman with idesk & fluxbox. Insert flash and icons for it appears), similar with umount_script
For it to work that way would violate volman's design, and probably break things. The same can be achieved by writing a client daemon that does all that with the help of volman's API, which I'll hopefully get around to documenting soon. :p

G_Nerc said:
And option to set prefered codepage. Because my flash disk after $ vmount da1s1 shows files in russian like ???????.pdf Without volman i use for mounting such command # mount_msdosfs -L ru_RU.UTF-8 -D CP866 /dev/da0s1 /mnt/flash
I'll try hoof that into the API in the next version, but the client implementation I'm not sure about. How would you want to specify the code page?
 
aragon said:
I'll try hoof that into the API in the next version, but the client implementation I'm not sure about. How would you want to specify the code page?
I think it is need such options (as i see in volman script it will be one more option ${MNTOPTS_${3}} (-L ${LOCAL_CODEPAGE} -D ${FAT32_CODEPAGE} in my example with my FAT32 flash) for every mounted entry like ${MNTCMD_${3}})
Code:
LOCAL_CODEPAGE=ru_RU.UTF-8 ([I]codepage for local system UTF-8 by default[/I])
FAT32_CODEPAGE=CP866 ([I]preferred codepage for mounted FAT32 disks[/I])
NTFS_CODEPAGE=CP1251 ([I]preferred codepage for mounted NTFS disks[/I])
and etc for other supported FS
Maybe sorry for my piece of nonsense with option description :))
 
aragon said:
Hi,

A while ago I wrote [thread=23105]an elaborate shell script[/thread]

Code:
XMNTCMD_msdosfs="mount_msdosfs -m 666 -M 777"
XMNTCMD_ext2fs="mount -t ext2fs"
XMNTCMD_ufs="mount -t ufs"

You should auto-mount external storages with nosuid at least.

I don't think it's safe to auto-mount without checking that the user is able to do this (may be via a group ?)

Regards
 
plamaiziere said:
You should auto-mount external storages with nosuid at least.
Added to my todo list. :)


plamaiziere said:
I don't think it's safe to auto-mount without checking that the user is able to do this (may be via a group ?)
I need to nitpick and say that no auto mounting is taking place. It's all manual. The only difference is that it's abstracted away into a highly simplified command.

But I agree there might be room for loss of security. I don't know if I will implement authorization checks though. It's a simple fix to a simple problem and is a 3rd party port with an appropriate disclaimer that'll be installed by FreeBSD users with enough savvy to configure an X11 setup from scratch.
 
The script seems to work quite well. Many thanks!

One thing I've noticed (in openbox at least) is that if the device is connected when the system boots, the openbox menu just shows "No devices". If you unplug the device and plug it back in, the device is shown in the menu.

There is nothing listed If you type [CMD=""]vmount[/CMD]

I assume this is due to there not being an event for attaching a device because the device is already attached at boot.
 
bigtoque said:
I assume this is due to there not being an event for attaching a device because the device is already attached at boot.
Correct.

Volman doesn't consider what bus storage devices are attached to, so even hotplug SATA disks should get picked up by it. The only reason your fixed disks don't appear in its volume listing is because there's also no attachment event for them.
 

Attachments

  • oie_171156332YEDVCCh.png
    oie_171156332YEDVCCh.png
    5.4 KB · Views: 1,728
Usermount not needed.



Type vmount. It should show you a list of devices that have been detected, and their mount status. Once you see the one you want to mount:

$ vmount da1s1

And the same when you want to umount it.



See what happens, and let us know. :)

I've installed it and mount my external HDD via terminal. How to use it with Thunar or File Explorer? And how to unmount with volman?
 
… what about automount as plamaiziere commands wrote ?

I don't imagine a reply from aragon (not seen for more than eight years); and the port no longer has a maintainer.

[thread=23105]an elaborate shell script[/thread]

23105 was:



161977 – New port: sysutils/volman FreeBSD specific volume managerClosed FIXED
 
Back
Top