volman: an experimental FreeBSD volume manager

Having trouble or general questions about porting software to FreeBSD? Ask here.

volman: an experimental FreeBSD volume manager

Postby aragon » 24 Oct 2011, 19:01

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[/pr].

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
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby aragon » 24 Oct 2011, 19:01

[reserved for documentation]
aragon
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby wblock@ » 24 Oct 2011, 19:18

Please also post on the new freebsd-desktop mailing list. Thanks!
User avatar
wblock@
Old Fart
 
Posts: 10199
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby G_Nerc » 04 Nov 2011, 18:24

Aragon, thanks a lot for your script!
But i can't understand how it setup to work properly.
I do:
extract [FILE]ports/161977[/FILE] in [FILE]/usr/ports/sysutils[/FILE]
[CMD="#"]cd /usr/ports/sysutils/volman && make install clean[/CMD]
After install i'm add to [FILE]rc.conf[/FILE]
Code: Select all
volmand_enable="YES"

and
[CMD="#"]cp /usr/local/etc/volman.conf.example /usr/local/etc/volman.conf[/CMD]
and edit it:
Code: Select all
# 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
[CMD="#"]/usr/local/etc/rc.d/volmand start[/CMD]
and insert flash disk
[CMD="#"]tail /var/log/messages[/CMD]
Code: Select all
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 [FILE]/media[/FILE] or anywhere else and in output of [FILE]df[/FILE] not appears new device.
I have a
Code: Select all
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 [FILE]FreeBSD 9.0 RC1[/FILE]
G_Nerc
Member
 
Posts: 122
Joined: 14 Oct 2011, 09:24

Postby aragon » 04 Nov 2011, 18:47

G_Nerc wrote:I have a
Code: Select all
vfs.usermount=1

Usermount not needed.


G_Nerc wrote: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:

[cmd=$]vmount da1s1[/cmd]

And the same when you want to umount it.


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

My OS is [FILE]FreeBSD 9.0 RC1[/FILE]

See what happens, and let us know. :)
aragon
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby G_Nerc » 04 Nov 2011, 19:16

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 [FILE]volman[/FILE] with [FILE]idesk[/FILE] & [FILE]fluxbox[/FILE]. Insert flash and icons for it appears), similar with umount_script
  3. And option to set prefered codepage. Because my flash disk after [CMD="$"]vmount da1s1[/CMD] shows files in russian like [FILE]???????.pdf[/FILE] (Without volman i use for mounting such command [CMD="#"]mount_msdosfs -L ru_RU.UTF-8 -D CP866 /dev/da0s1 /mnt/flash[/CMD])
G_Nerc
Member
 
Posts: 122
Joined: 14 Oct 2011, 09:24

Postby aragon » 04 Nov 2011, 19:35

G_Nerc wrote:Yes it works! Thanks a lot!

Great! Welcome.

G_Nerc wrote:
  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 [FILE]volman[/FILE] with [FILE]idesk[/FILE] & [FILE]fluxbox[/FILE]. 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 wrote:And option to set prefered codepage. Because my flash disk after [CMD="$"]vmount da1s1[/CMD] shows files in russian like [FILE]???????.pdf[/FILE] Without volman i use for mounting such command [CMD="#"]mount_msdosfs -L ru_RU.UTF-8 -D CP866 /dev/da0s1 /mnt/flash[/CMD]

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
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby G_Nerc » 04 Nov 2011, 19:58

aragon wrote: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 [FILE]volman[/FILE] 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: Select all
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 :))
G_Nerc
Member
 
Posts: 122
Joined: 14 Oct 2011, 09:24

Postby plamaiziere » 06 Nov 2011, 13:53

aragon wrote:Hi,

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


Code: Select all
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
Member
 
Posts: 184
Joined: 04 Jan 2009, 21:37
Location: Rennes, France

Postby aragon » 10 Nov 2011, 02:37

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

Added to my todo list. :)


plamaiziere wrote: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.
aragon
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby bigtoque » 11 Nov 2011, 19:48

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
Junior Member
 
Posts: 75
Joined: 16 Jul 2010, 05:55

Postby aragon » 11 Nov 2011, 21:55

bigtoque wrote: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.
aragon
Giant Locked
 
Posts: 2031
Joined: 16 Nov 2008, 17:04
Location: Cape Town, South Africa

Postby SNK » 30 Dec 2011, 13:58

Great, it seems that eadler@ picked it up. Hopefully it will committed soon.
SNK
Member
 
Posts: 130
Joined: 15 May 2011, 18:34
Location: The Netherlands

Postby SNK » 07 Jan 2012, 19:38

Today [port]sysutils/volman[/port] got committed to the ports collection! :beer:beergrin
SNK
Member
 
Posts: 130
Joined: 15 May 2011, 18:34
Location: The Netherlands

Postby zeissoctopus » 08 Jan 2012, 07:57

Many thanks to aragon as well as all contributors.
zeissoctopus
Member
 
Posts: 140
Joined: 08 Aug 2009, 09:09
Location: Hong Kong

Postby unull » 17 Feb 2012, 10:58

Thanks for this nice piece of software!

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

If anyone is interested, grab the source from https://github.com/funglaub/devd-notifier
Attachments
oie_171156332YEDVCCh.png
oie_171156332YEDVCCh.png (5.42 KiB) Viewed 722 times
unull
Junior Member
 
Posts: 11
Joined: 13 Feb 2012, 16:16

Postby femc7488 » 24 Feb 2012, 09:21

Thanks, volman is useful. I love it.
femc7488
Junior Member
 
Posts: 16
Joined: 16 Apr 2009, 19:16


Return to Porting New Software

Who is online

Users browsing this forum: No registered users and 0 guests