{"id":818,"date":"2016-11-24T15:51:33","date_gmt":"2016-11-24T21:51:33","guid":{"rendered":"http:\/\/tiemensfamily.com\/TimOnCS\/?p=818"},"modified":"2016-11-24T15:51:33","modified_gmt":"2016-11-24T21:51:33","slug":"virtualbox-usb-flash-for-zfs","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2016\/11\/24\/virtualbox-usb-flash-for-zfs\/","title":{"rendered":"VirtualBox USB Flash for ZFS"},"content":{"rendered":"<p>To set up your USB Flash drives as pass-through in VirtualBox, here is what you can do.<\/p>\n<p>Next, plug in your flash drive and record its device.  For me, it was \/dev\/sde.  Look in \/var\/log\/syslog, or dmesg output, for the &#8220;[sde] Attached SCSI removable disk&#8221; line.  My device looked like this:<\/p>\n<pre>\nls -l \/dev\/sde\nbrw-rw---- 1 root disk 8, 64 Nov 24 15:22 \/dev\/sde\n<\/pre>\n<p>If you don&#8217;t run virtualbox as root (and you should not), then you&#8217;ll need to use the group to access \/dev\/sde.  Above, you can see it is &#8220;disk&#8221;.<br \/>\nNow, make sure the user that is running virtualbox is in the &#8220;disk&#8221; group (e.g. &#8216;tim&#8217; user):<\/p>\n<pre>\nsudo usermod -a G disk tim\n<\/pre>\n<p>After this, you may or may not have to reboot.  Run &#8220;groups&#8221; as your user.  Make sure you see &#8220;disk&#8221; listed.  If not, reboot (or maybe just logout and login).<\/p>\n<p>Then, for each USB Flash drive, run this VBoxManage command:<br \/>\n(Note: this command just creates a *.vmdk file that &#8220;links&#8221; to a raw device.  It does not touch or alter the device, but it does make sure your current user has permissions to the device):<\/p>\n<pre>\nVBoxManage internalcommands createrawvmdk -filename usbflash1.vmdk -rawdisk \/dev\/sde1\nchown tim:tim usbflash1.vmdk\n<\/pre>\n<p>Then, in the virtualbox GUI, under settings, choose Storage, then &#8220;add hard disk&#8221;, then &#8220;Choose existing disk&#8221;, then select the usbflash1.vmdk file created above.<\/p>\n<p>See the <a href=\"http:\/\/tiemensfamily.com\/TimOnCS\/2016\/11\/20\/zfs-flash-drives\/\" title=\"ZFS Flash Drives\">ZFS Fkash Drives<\/a> on how to create your ZFS volume from the USB Flash drive(s).  <\/p>\n<p>Next up: plugging the USB Flash drives into a different ZFS instance.<br \/>\n(In case it is not clear, the trade-off here is between:<br \/>\n1) Two separate USB flash drives, which can be used by just about any computer, but must be manually kept in sync, and manually compared looking for differences, versus<br \/>\n2) Two flash drives as a single ZFS mirror volume, where ZFS makes sure the contents are the same and scrubs them to make sure they stay that way.  However, you need a ZFS system to mount and use them.)<\/p>\n<p>The contents of usbflash1.vmdk:<\/p>\n<pre>\n# Disk DescriptorFile\nversion=1\nCID=1d3a8b59\nparentCID=ffffffff\ncreateType=\"fullDevice\"\n\n# Extent description\nRW 15130017 FLAT \"\/dev\/sde1\" 0\n\n# The disk Data Base \n#DDB\n\nddb.virtualHWVersion = \"4\"\nddb.adapterType=\"ide\"\nddb.geometry.cylinders=\"15009\"\nddb.geometry.heads=\"16\"\nddb.geometry.sectors=\"63\"\nddb.uuid.image=\"33234751-eccf-4188-8e3d-a903b8a4ad74\"\nddb.uuid.parent=\"00000000-0000-0000-0000-000000000000\"\nddb.uuid.modification=\"ee7f3673-388e-42ab-9fa6-698cd80fb5bd\"\nddb.uuid.parentmodification=\"00000000-0000-0000-0000-000000000000\"\nddb.geometry.biosCylinders=\"941\"\nddb.geometry.biosHeads=\"255\"\nddb.geometry.biosSectors=\"63\"\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To set up your USB Flash drives as pass-through in VirtualBox, here is what you can do. Next, plug in your flash drive and record its device. For me, it was \/dev\/sde. Look in \/var\/log\/syslog, or dmesg output, for the &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2016\/11\/24\/virtualbox-usb-flash-for-zfs\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/818"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=818"}],"version-history":[{"count":0,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/818\/revisions"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}