# volman: an experimental FreeBSD volume manager



## aragon (Oct 24, 2011)

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 (Oct 24, 2011)

[reserved for documentation]


----------



## wblock@ (Oct 24, 2011)

Please also post on the new freebsd-desktop mailing list.  Thanks!


----------



## G_Nerc (Nov 4, 2011)

*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

```
volmand_enable="YES"
```
and
`# cp /usr/local/etc/volman.conf.example /usr/local/etc/volman.conf`
and edit it:

```
# 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`

```
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 
	
	



```
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


----------



## aragon (Nov 4, 2011)

G_Nerc said:
			
		

> I have a
> 
> 
> 
> ...


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.


----------



## G_Nerc (Nov 4, 2011)

Yes it works! Thanks a lot!
But i have some request 

Maybe add in conf file option with ability to automount devices?
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*
 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_)


----------



## aragon (Nov 4, 2011)

G_Nerc said:
			
		

> Yes it works! Thanks a lot!


Great!  Welcome.



			
				G_Nerc said:
			
		

> Maybe add in conf file option with ability to automount devices?
> 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. 



			
				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?


----------



## G_Nerc (Nov 4, 2011)

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}}_)

```
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 )


----------



## plamaiziere (Nov 6, 2011)

aragon said:
			
		

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




```
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


----------



## aragon (Nov 10, 2011)

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.


----------



## bigtoque (Nov 11, 2011)

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.


----------



## aragon (Nov 11, 2011)

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.


----------



## SNK (Dec 30, 2011)

Great, it seems that eadler@ picked it up. Hopefully it will committed soon.


----------



## SNK (Jan 7, 2012)

Today sysutils/volman got committed to the ports collection! beergrin


----------



## zeissoctopus (Jan 8, 2012)

Many thanks to aragon as well as all contributors.


----------



## unull (Feb 17, 2012)

Thanks for this nice piece of software!

I wrote a small program that uses libnotify to show a notification on your desktop if you plug in a USB stick. Works perfectly with sysutils/volmand

If anyone is interested, grab the source from https://github.com/funglaub/devd-notifier


----------



## femc7488 (Feb 24, 2012)

*T*hanks, volman is useful. *I* love it.


----------



## Seagate (Jan 4, 2017)

aragon said:


> Usermount not needed.
> 
> 
> 
> ...



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?


----------



## Sergei_Shablovsky (Jun 2, 2022)

aragon said:


> Added to my todo list.
> 
> 
> 
> 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.


Thank You for port.

So what about automount as plamaiziere commands wrote ?


----------



## grahamperrin@ (Jun 4, 2022)

Sergei_Shablovsky said:


> … 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.



aragon said:


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



23105 was:









						auto mounting in Openbox
					

Hi  So I finally ditched Xfce 4.6 and decided to give Xfce 4.8 a skip to try something else instead.  After playing with LXDE for a bit, I've ended up using standalone Openbox, tint2, and various other bits for my new desktop setup.  I poked around for HAL-esque auto mounting setups, but they...




					forums.freebsd.org
				






aragon said:


> PR ports/161977.



161977 – New port: sysutils/volman FreeBSD specific volume manager – _Closed FIXED_


----------

