Logging and DataMine on One USB Drive in Separate Partitions

This procedure should work on any UI7 device. I created it because the Plus only has 1 usb port and a 16Gb usb stick made for a lot of wasted space (logging only uses 500Mb). The end result is that there are 2 partitions on a single stick with both logging and DataMine enabled and writing to the same stick. The logging data goes to the standard Vera 1st partition (/dev/sda1) and the DataMine data goes to the 2nd partition (/dev/sda2). Another benefit is that the 2nd partition is formatted FAT so you can just plug the usb into any Windows machine and copy the data directly to your hard drive.

  1. Plug a usb drive into the Vera.
  2. In a browser, go to Settings ? Logs, click on “store logs on usb device”. Vera will create and format the 1st partition on your USB stick and automatically reboot.
  3. Go back into Settings ? Logs then turn off storing logs on usb device. Vera will reboot.
  4. ssh into your Vera as root, password is on the bottom of device. If this is your first time, accept the key. Also, change your password with the passwd command.
  5. Create 2nd partition
    5.1. fdisk -l #should see /dev/sda1 (and likely a bunch of errors on mtdblock devices, ignore them)
    5.2. fdisk /dev/sda #run interactively
    5.2.1. p #to see partition table
    5.2.2. n #to create 2nd partition
    5.2.3. p #create partition as primary
    5.2.4. 2 #create 2nd partition, leaving Vera?s alone
    5.2.5. Select defaults to use all the rest of the usb drive for the 2nd partition or enter ending cylinder. Don?t mess with the starting cylinder.
    5.2.6. p #confirm 2nd partition parameters
    5.2.7. w #write new partition table; may get a warning but mine still worked
  6. Reboot Vera manually from Settings ? Net & Wifi, then click the Reboot button. Ssh back into the Vera.
  7. Check for the 2nd partition
    7.1. fdisk -l #errors on mtdblock devices but should show /dev/sda1 and /dev/sda2
  8. Format the 2nd partition as FAT with a label
    8.1. mkfs.vfat -n datamine /dev/sda2 #label is ?datamine? or use whatever you want
    8.2. mkdir /datamine #can use any directory name
    8.3. mount /dev/sda2 /datamine #but use same name here
    8.4. df -h #to show filesystems; should see /dev/sda2
  9. Test copy a file to /datamine
    9.1. cp /mios_constants.sh /datamine
    9.2. cat /datamine/mios_constants.sh #should work
    9.3. rm /datamine/mios_constants.sh #remove file
  10. Back in the web interface, go into the dataMine device, click Advanced, then click on Variables.
  11. Click on the ?switch to input type text? for SetDataDirectory and set to /datamine/ (or whatever directory you used in mkdir) then click a blank spot elsewhere on that page.
  12. Click on the ?switch to input type text? for SetMountPoint and set to /dev/sda2 then click a blank spot elsewhere on that page.
  13. Reboot Vera.
  14. Go to the Vera’s DataMine web page - you should be able to enable devices for logging.

NOTE: Unlike other, similar instructions to get DataMine2 working on UI7 here I did not set or unset any other parameters, nor did I need to add any commands to my Lua startup. DataMine mounted the 2nd partition and started up.

Cheers,
cb4

Great howto

Should be:
df -h
And moved after 8.4 (mount)

Done and thanks.

cb4

Interesting fact from the Vera Plus. It automatically creates two partitions on the USB stick. I started at Step 8 above and it worked OK. I also put the Mount command (step 8.3) in my startup file as it loses the mount on a Reboot.

@cb4 - thanks

Greg

Where is the startup file you put the mount command into?

Apps → Develop Apps → Edit Startup Lua

thank you so much for this walkthrough. it worked flawless without a hitch. however, i was using a unpowered usb hub for my Insteon PLM and had two USB sticks (1 for vera log, 1 for datamine). Now I can just use one. I suppose the first one I pulled was /dev/sda and was gone. So I just substituted /dev/sdb and good to go. Thanks again!

That’ll work, but it also displays the “lua error in scene and event” error in the UI. To avoid this you want to enter this in the startup lua

[font=andale mono]os.execute(“mount /dev/sda2 /datamine”)[/font]

Almost 1 year after you opened this topic, this piece of information is of awesome value (at least for newbies like me).
I’ve been searching for some days on how to get dataMine working on my VeraPlus (UI7) and only with this help i was able to do it.
Thank you very much for such comprehensive information @cb4!!!

gemini1971

I’m curious since disabling the Vera logs from going to the USB drive in step 3, is it safe to assume then that they are going to the local flash space within the Vera and NOT the USB drive?

I too noticed that the Vera Plus created a sda1 and sda2 on my USB. Unfortunately I didn’t see the post about starting at step 8 and just completed all the steps and finally have my saved graphs and configurations surviving a LUA reload. But I would like my Vera logs to the USB. I guess my next step will be to enable it and hope that I can backup/restore my files.

I’m curious what the point of step 3 is for if the Vera Plug includes both partitions by default now.

cb4 thanks for your post, I was breaking my head with this and your instructions worked like a charm! In the event that anyone would like to do the same but on a separate USB drive, I have modified cb4’s instructions to allow you to do so. I had extra USB sticks and a small 4 port hub I wasn’t using. Note I have a few extra steps as I had tried different methods that didn’t work so I do a little cleanup.

I modified the below to mount on a second usb rather than messing with a second partition on the same usb. This way I could use the datamine drive externally without messing with the native vera logging. Also you do this at your own risk as you can royally mess things up if you don’t know what you are doing specifically when messing with the partitions…

This procedure should work on any UI7 device. Note the Plus only has 1 usb port and a depending on the size of your usb stick there may be alot of wasted space as logging only uses 500Mb ( I have not verified this). I had USB sticks lying around so I opted for using two anyway. This way I could use the datamine drive without messing with the native vera logging. The end result is that there are two drives and 2 partitions (one on each although vera might create 2 on the logging drive). On the second stick the DataMine App will be enabled for writing on its own partition. The logging data goes to the standard Vera 1st partition (/dev/sda1) and the DataMine data goes to the 1st partition on the second disk(/dev/sdb1). Another benefit is that the 2nd usb drive / partition is formatted FAT so you can just plug the usb into any Windows / Linux machine and copy the data directly to your hard drive.

  1. Plug a usb drive into the Vera (for logging does not have to be large).
  2. In a browser, go to Settings ? Logs, click on “store logs on usb device”. Vera will create and format the 1st partition on your first USB stick and automatically reboot.
  3. ssh into your Vera as root, password is on the bottom of device. If this is your first time, accept the key. Also, change your password with the passwd command.
  4. Plug a second usb drive into the Vera (for datamine I use a 32 gig stick as I had it in a box but it really doesnt have to be that large).
  5. Create 2nd partition
    5.1. fdisk -l #should see /dev/sda1 (and likely a bunch of errors on mtdblock devices, ignore them. I didnt see any but apparently others might get these.)
    5.2. fdisk /dev/sdb #run interactively ( note the new drive!!! )
    5.2.1. p #to see partition table
    5.2.2. n #to create 1st partition on the second drive
    5.2.3. p #create partition as primary
    5.2.4. 1 #create 1st partition on the second drive, leaving Vera’s alone on the first drive
    5.2.5. Select defaults to use all the rest of the usb drive for the 1st partition on the second drive or enter ending cylinder. Don’t mess with the starting cylinder.
    5.2.6. p #confirm 2nd partition parameters
    5.2.7. w #write new partition table; may get a warning but mine still worked
  6. Reboot Vera manually from Settings , Net & Wifi, then click the Reboot button. Ssh back into the Vera.
  7. Check for the 2 partitions
    7.1. fdisk -l #errors on mtdblock devices but should show /dev/sda1 and /dev/sdb1
  8. Format the 1st partition on the second drive as FAT with a label
    8.1. mkfs.vfat -n datamine /dev/sdb1 #label is “datamine” or use whatever you want
    8.2. mkdir /dataMine #can use any directory name
    8.3. mount /dev/sdb1 /dataMine #but use same name here
    8.4. df -h #to show filesystems; should see /dev/sdb1
  9. Test copy a file to /dataMine
    9.1. cp /mios_constants.sh /dataMine
    9.2. cat /dataMine/mios_constants.sh #should work
    9.3. rm /dataMine/mios_constants.sh #remove file
  10. Back in the web interface, go into the dataMine device, click Advanced, then click on Variables.
  11. Click on the “switch to input type text” for SetDataDirectory and set to /dataMine/ (or whatever directory you used in mkdir) then click a blank spot elsewhere on that page.
  12. Click on the “switch to input type text” for SetMountPoint and set to /dev/sdb1 then click a blank spot elsewhere on that page.
  13. Click on the “switch to input type text” for SetMountOptions (Should be empty) then click a blank spot elsewhere on that page.
  14. Click on the “switch to input type text” for SetMountUUID (Should be empty) then click a blank spot elsewhere on that page.
  15. Click on the “switch to input type text” for mountLocation (Should be empty buyt will auto populate once you reboot.) then click a blank spot elsewhere on that page.
  16. If you have tried a different process and it didn’t work make sure you clean up the startup.lua as it may conflict.
    Go to APPS → click DEVELOP APPS → Select Edit Startup Lua and make sure there is no code for mounting ( this probably should be empty)
  17. Reboot Vera.
  18. Go to the Vera’s DataMine web page - you should be able to enable devices for logging.

NOTE: Unlike other, similar instructions to get DataMine2 working on UI7 here I did not set or unset any other parameters, nor did I need to add any commands to my Lua startup. DataMine mounted the 2nd partition and started up.