Koozali.org: home of the SME Server

[Announce] usbdisks manager

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« on: January 29, 2007, 06:31:48 PM »
Here is a new contrib to manage your usb disks thanks to the server manager.

your disk must already have been partitioned and formated, with a UUID.

wget http://mirror.contribs.org/smeserver/contribs/jppialasse/SME7/usbdisksmanager/smeserver-usbdisksmanager-0.2-0.1.noarch.rpm
or alternate
wget http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.2-0.1.noarch.rpm

yum localinstall smeserver-usbdisksmanager-0.2-0.1.noarch.rpm

you will be able to add a mount point for each partition and the contrib will do the mount every time it is plugged. and to auto mount drives when pluged in your media directory.

/!\ firewire can be supported if you have a kernel that allow it (the one from centos is not fully compliant)

JPP

waiting for your informations

/edit/
new release 0.2-0.1
using yum to install

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: [BETA] usbdisks manager
« Reply #1 on: January 29, 2007, 10:53:28 PM »
Quote from: "unnilennium"
rpm -Uvh http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.1-0.3.noarch.rpm
Please do not use rpm to install as SME Server uses yum by default.[list=1]
  • Download the rpm using wget for instance
    Code: [Select]
    wget http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.1-0.3.noarch.rpm
  • Do a yum localinstall
    Code: [Select]
    yum localinstall smeserver-usbdisksmanager-0.1-0.3.noarch.rpm[/list:o]Advantages of yum is that all necessary dependencies can be resolved and downloaded from enabled repositories.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #2 on: January 31, 2007, 11:14:49 PM »
new release :

wget http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.1-0.5.noarch.rpm
yum localinstall smeserver-usbdisksmanager-0.1-0.5.noarch.rpm

Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
[Announce] usbdisks manager
« Reply #3 on: February 01, 2007, 04:50:22 AM »
Could I use this same contrib to manage firewire disks?  :?

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #4 on: February 01, 2007, 01:16:20 PM »
As i have no fire wire disk for the moment i have not tested; but you should test.

Tell me if it works, if yes it's perfect, if no i 'll ask you some information to add the support :

what is the result of :
Code: [Select]
/usr/bin/udevinfo -a -p /sys/block/sda
(if the partition you want to manage is /dev/sda1)

I need the first lines like this:

Quote
follow the class device's "device"
  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host2/target2:0:0/2:0:0:0':
    BUS="scsi"
    ID="2:0:0:0"

this example is from a usb disk

Offline Mjohnson

  • *
  • 172
  • +0/-0
[Announce] usbdisks manager
« Reply #5 on: February 03, 2007, 04:53:18 PM »
Works great.  Thanks for the contribution.
......

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #6 on: February 04, 2007, 04:29:56 PM »
release 0.5

added FireWire support
some littles things corrected
added help page


There's a known issue to add UUID to a disk which has no UUID: it seems impossible through the manager nothing happen. so it is assumed that usb drive are well formatted with you label and UUID set and unique .


wget http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.1-0.5.noarch.rpm

yum localinstall smeserver-usbdisksmanager-0.1-0.5.noarch.rpm

nitrouze

[Announce] usbdisks manager
« Reply #7 on: March 03, 2007, 12:18:44 PM »
Hi,

First, merci for the contrib  :wink:

Can I suggest to add mounting options to the db and panel as some specific options might be needed by other contribs (ie suid for apache ...) ?

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #8 on: March 03, 2007, 01:14:51 PM »
yes this a great idea.
I was planning on making a new release with auto mount for the /media folder as it is often asked. It another good thing you suggest.


Can you explain exactly what option would be needed to you.

JPP

nitrouze

[Announce] usbdisks manager
« Reply #9 on: March 03, 2007, 02:04:22 PM »
As more and more contribs, especially backups ones, are depending on "external drives", what about adding a "mount option" to the panel to set the -o options of mount ...

- The default (no user input) could be "defaults" which should be ok for most of us (even if it's very permissive !)

- Specific needs for mounting could be set there according to mount -o syntax.

Quick exemple:
I'm using backuppc contrib via an usb drive mounted to /opt/backuppc, it needs "suid" option for web interface to work properly, so I add to manually modify your perl script to replace ...

#my $mount=`/bin/mount $dev -t auto $dest -o pamconsole,exec,noauto,managed`;

with ...

my $mount=`/bin/mount $dev -t auto $dest -o defaults`;

but it could preferably be ...

my $mount=`/bin/mount $dev -t auto $dest -o $DEFINED_MOUNT_OPTIONS`;

Another idea could be to use the label of the partition to try to guess its role (identified contrib ?) and its mount options need.

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #10 on: March 03, 2007, 02:18:15 PM »
what do you think about to guess it by searching the guid and uid of the destination folder and giving to the mount the same uid option ?

+ some personal option thanks to the panel.


JP

nitrouze

[Announce] usbdisks manager
« Reply #11 on: March 03, 2007, 05:38:55 PM »
It seems quite difficult to guess who's owning the share as the uid/guid 's mount point aren't representative enough.

/opt/backuppc being the mount point ...
ls -ld /opt/backuppc/
drwxr-xr-x  9 root root 4096 Mar  2 18:59 /opt/backuppc/
but once drive is mounted ...
ls -ld /opt/backuppc/*
drwxr-xr-x  10 backuppc backuppc  4096 Feb 26 16:00 /opt/backuppc/files

In that case, you won't be able to guess the correct owner. :?

Additionaly, several users might share the same "usb volume" and this is why the suid is so helpfull.

Same problem with fstab, as it has no clue of what params/ownership to give to the partition.

The easiest way is probably the "personal options" within panel/db.

Offline okepc

  • ***
  • 118
  • +0/-0
    • http://www.okepc.nl
[Announce] usbdisks manager
« Reply #12 on: March 05, 2007, 09:39:18 AM »
What about a panel addon that you give the option to mount cifs,samba etc. shares over the network?

Would be a nice addon

And call it Smeserver-Mountmanager  8)

Dirk

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #13 on: March 23, 2007, 01:17:09 AM »
Is it maybe usefull to have a "prop" in confusbdisks that is considering quota's? Something like :

QuotaOn|yes

During boot the quota files will be build when they don't exist so that's not a real concern to worry about (AFAIK). Main problem is that it needs to be added to the mount options and now it seems not possible to do this.

I managed to deal with this to manually make a mount in fstab to another location and get quota's active but this is ofcourse not the most dynamic way. And dynamics is what we are looking for I think.

Harro

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #14 on: April 08, 2007, 11:41:40 PM »
to Nitrouze:

next release will try to support such setting : uid and gid for auto "mount_to"



to okepc:


Yes it would be nice,but at the moment i would like to perfect this tool for removable drive.

to Confucius:

everytime i try to manage quota on a removable drive i just fail can you make me a short but complete how to ?


in a few days a new release ...


JP

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #15 on: April 09, 2007, 01:13:03 AM »
As far as I remember I had more difficulty formatting the disk than hooking it up with quota's.

Current situation :

once mounted using the USB manager
once mounted by adding a different mountpath in /etc/fstab with parameters : usrquota,grpquota

As mentioned earlier; this was enough to make it come back "quotad" after a reboot. Might be that a re-mount could do the trick aswell. Didn't try that 1.

I had trouble to find out how your mounting scheme works for tampering with the options.

Harro

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #16 on: April 09, 2007, 02:07:33 AM »
Wanted to make sure that I gave the right information... failed...

but went on...

Took quota files from the disk, restarted server... resulting in an error during boot. No recreated quota files.

successfull steps:

touch /dev/sda1/aquota.user
touch /dev/sda1/aquota.group

chmod 600 /dev/sda1/aquota.user
chmod 600 /dev/sda1/aquota.group

mount -o remount /dev/sda1

quotacheck -vgum /dev/sda1

Took a while to round it up because of : quotacheck: Checked 3074 directories and 45373 files ... but after that it was back to normal again.

Didn't see the information in the server-manager tho... went on..

quotaoff /dev/sda1
quotacheck /dev/sda1
quotaon /dev/sda1

And back on track, as if nothing ever was demolished...

Hope this might be more usefull...

Another hint: SME can be installed with the option "noquota" when I remember right (too lazy to verify spelling) so your module should also comply with this maybe. When that option has been used it shouldn't ask if the "manager" wants to have quota's on the disk(s). I guess this can be verified by checking for the existence of quota files on the main disk.

Harro

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #17 on: April 09, 2007, 11:28:34 PM »
And "Voila" ,

smeserver-usbdisksmanager 0.2 is released.

-added support for auto mount of drives inside media directory to the folder auto created

- added how to format my hard drive

- added mount options for the mount to (this will help for some applications).

wget http://mirror.contribs.org/smeserver/contribs/jppialasse/SME7/usbdisksmanager/smeserver-usbdisksmanager-0.2-0.1.noarch.rpm
or alternate
wget http://www.pialasse.com/RPMS/smeserver-usbdisksmanager-0.2-0.1.noarch.rpm

yum localinstall smeserver-usbdisksmanager-0.2-0.1.noarch.rpm

it can help to initialize quota, but i have not enought time to test it

JPP

PS: thanks Confucius for theses informations

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #18 on: April 10, 2007, 02:16:05 PM »
Ehmmmmm JPP..

I think there are a few minor issues that need more inspection:

WARNING in /etc/e-smith/templates//etc/crontab/usbdisks: Use of uninitialized value in string eq at /etc/e-smith/templates//etc/crontab/usbdisks line 19.
WARNING: Template processing succeeded for //etc/crontab: 1 fragment generated warnings
 at /sbin/e-smith/expand-template line 45

Harro

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #19 on: April 10, 2007, 02:31:11 PM »
Looks like you also forgot to put the status on enabled in the configuration or do I make a silly statement now because I never noticed this before ?

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #20 on: April 10, 2007, 03:38:10 PM »
JP,

I would like to think along but you have a lot on french. Would be nice when you put most on english so I can understand it better. Translation does help a little but still some things stay blurry to me.

When you have time, please consider this because I think there is enough potential in this module.

Harro

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #21 on: April 10, 2007, 04:50:18 PM »
Yes I must advise that the module disable everytime you update this.

I know this is irritating but it is a safe way i thing to avoid bad mounting.

(I irritated the same way when I update the awstats contrib and i need to activate it again)


Sorry for the french in the source code.
And even for a french it might not be of a great utility as it is like a code :)
For the next version i will translate the comments.

Offline Confucius

  • ****
  • 235
  • +0/-0
[Announce] usbdisks manager
« Reply #22 on: April 10, 2007, 04:54:22 PM »
JP,

Another addition. It works pretty perfect this way... BUT.. to get quota's active it's needed (after each mount or reboot) to make clear that quota's should be ON for that specific disk. Maybe you see an option to add the command "quotaon /dev/sdX" when the actual mounting is done (and ofcourse either grpquota or usrquota (or both) is in the options) ?

Now I do that manually and seems to work good. Without that command the quota's show as zero's...

Harro

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #23 on: April 10, 2007, 05:40:30 PM »
yes it could be transparent to add in the bash script and in teh perl script to execute thsi commande if the mount options contain grpquota or usrquota (or both) .

it is just a regular expression to do.

need to add this next week end.

Offline progitto

  • ****
  • 217
  • +0/-0
    • http://umbertomassari.dyndns.org
[Announce] usbdisks manager
« Reply #24 on: May 17, 2007, 08:48:49 AM »
Thank for this nice contribs!!
I have one question: I want save in a .txt file the list of the files of the removable disk on mount or auto-mount. I suppose that I have to add something like
Code: [Select]
ls [my_mount_position] -lRsh > /home/e-smith/files/ibays/primary/list.txt
in usr/sbin/usbdisks.sh.
The problem is that I can't understand where I have to do this ...  :oops:
Some tips for me?
Thanks

Offline Jean-Philippe Pialasse

  • *
  • 2,762
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Announce] usbdisks manager
« Reply #25 on: August 01, 2007, 01:56:18 AM »
sorry for the long time before the answer, i guess you have found alone :

I would install it in the usr/sbin/usbdisks.sh.
for every disk that are not known:
after the mount $repertoire  in line 128

if you want this for the mount_to defined disk
after the mount commande line 51

if you want for known disk auto mount iin media:
after the mount line 86

that make me think about a pre / post custom command  for each drives.... to add in the contrib