Advertise on Bikeforums.net



User Tag List

Results 1 to 13 of 13
  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    998
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linux as a USB device?

    This is something I have not been able to find much on, but this is for a project I'm tinkering with:

    How can one make Linux (or BSD) appear to another machine as a USB device, and is there hardware that would allow this? I'm not meaning a USB host that uses a type "A" port, but a USB device that uses a type "B" port. I'd like to build a machine that uses Linux and LVM capabilities, and where I can plug it into another machine, have it appear as plain USB hard disk.

    The goal is to make a "mini SAN" where I can plug four machines into the Linux box, each seeing different volumes while in reality, the volumes are just chunks carved from LVM partitions. Is this possible at all? My goal is to make an embedded box that boots up, asks for a hardware crypto card and PIN, mounts multiple partitions via encrypted loopback and makes them available as plain removable USB drives to whatever hosts are plugged in.

  2. #2
    On my TARDIScycle! KingTermite's Avatar
    Join Date
    Jun 2005
    Location
    Eastside Seattlite Termite Mound
    My Bikes
    Trek 520, Trek Navigator 300, Peugeot Versailles PE10DE
    Posts
    3,928
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm a bit confused still as to what it is you are trying to do.

    Do you to plug in a linux machine in to another linux machine and have it show up as a USB hard disk? If so, then why does port type matter? You can get an A/B converter if needed, right?
    Quote Originally Posted by coffeecake View Post
    - it's pretty well established that Hitler was an *******.

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    998
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by KingTermite View Post
    I'm a bit confused still as to what it is you are trying to do.

    Do you to plug in a linux machine in to another linux machine and have it show up as a USB hard disk? If so, then why does port type matter? You can get an A/B converter if needed, right?
    The port type matters because it tells which is the USB host, and which is the device. A B socket means that that is a device, while an A plug means that it is the host which gives commands.

    What I want to do is have other machines plug into the Linux machine, using a normal A-B cable just like you do with any other removable drive. The Linux box is going to be handling an encryption layer and a LVM layer for RAID. The computers plugged into it just see a removable disk.

  4. #4
    On my TARDIScycle! KingTermite's Avatar
    Join Date
    Jun 2005
    Location
    Eastside Seattlite Termite Mound
    My Bikes
    Trek 520, Trek Navigator 300, Peugeot Versailles PE10DE
    Posts
    3,928
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlts22 View Post
    The port type matters because it tells which is the USB host, and which is the device. A B socket means that that is a device, while an A plug means that it is the host which gives commands.

    What I want to do is have other machines plug into the Linux machine, using a normal A-B cable just like you do with any other removable drive. The Linux box is going to be handling an encryption layer and a LVM layer for RAID. The computers plugged into it just see a removable disk.
    It sounds like something that would definitely need driver/kernel support. It doesn't sound like anything I've heard of being done already. Interesting idea.
    Quote Originally Posted by coffeecake View Post
    - it's pretty well established that Hitler was an *******.

  5. #5
    Genetics have failed me Scummer's Avatar
    Join Date
    Jun 2007
    Location
    Zorneding, Germany
    My Bikes
    Pedalforce CX1 & Trek Madone 5.9
    Posts
    2,831
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm.. how about this approach:
    http://www.linux-usb.org/usbnet/

    Just use an iSCSI driver to access the partitions from the hosts to your Linux iSCSI target.
    Gelato aficionado.

  6. #6
    call me T.J.
    Join Date
    Jul 2008
    My Bikes
    trek 820
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't go USB directly between two machines; you need to go through a USB hub.

    Why not just make it Network Attached Storage?

  7. #7
    Senior Member
    Join Date
    Aug 2006
    Posts
    998
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tjwarren View Post
    You can't go USB directly between two machines; you need to go through a USB hub.

    Why not just make it Network Attached Storage?
    In theory you can, however, the machine must have an ability to run as a USB device, which I have not found any way to do so.

    This is solving a different issue than NAS. What this machine is doing is providing secure access to disk volumes that are not being passed over any network. If I find a way to get this working with eSATA, this mini-SAN machine can replace the boot drives of 3-4 computers. Coupled with an encryption layer, this will allow people to work on some very sensitive data without any additional security measures needed.

    The goal is to have a mini SAN head that uses SATA, and USB instead of fiber channel. This will allow this technology to be used in a lot more places such as small businesses.

  8. #8
    Senior Member MrCrassic's Avatar
    Join Date
    Jun 2007
    Location
    Brooklyn, NY
    My Bikes
    2008 Giant OCR1 (with panda bear on the back!)
    Posts
    3,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlts22 View Post
    This is something I have not been able to find much on, but this is for a project I'm tinkering with:

    How can one make Linux (or BSD) appear to another machine as a USB device, and is there hardware that would allow this? I'm not meaning a USB host that uses a type "A" port, but a USB device that uses a type "B" port. I'd like to build a machine that uses Linux and LVM capabilities, and where I can plug it into another machine, have it appear as plain USB hard disk.

    The goal is to make a "mini SAN" where I can plug four machines into the Linux box, each seeing different volumes while in reality, the volumes are just chunks carved from LVM partitions. Is this possible at all? My goal is to make an embedded box that boots up, asks for a hardware crypto card and PIN, mounts multiple partitions via encrypted loopback and makes them available as plain removable USB drives to whatever hosts are plugged in.
    I see what you want to do. I don't think you need Linux to accomplish this, but here's a rough flow of what I think you have in mind:

    - Insert device into USB port.
    - Device is powered, begins booting Linux internally.
    - Linux is at login state, and prompts user to login to device.
    - User logs in, Linux auto-mounts write-accessible partition. Signals device to signal Windows to mount the path.
    - Path is mounted, and is now accessible until disconnected.

    One problem I can see here is preserving data at disconnect. I learned recently that file systems do not sync data immediately; the data to be written is cached and then is synced a few seconds later, when it automatically syncs all cached data. Unless you plan to mount the filesystem to sync everything at write time (which will make for a very slow storage device), a dirty shutdown might corrupt data.

    Another foreseeable problem is operating system integrity. What happens if, for some unknown reason, one of the system files gets corrupted and cannot boot the next time around? What happens if the bootloader gets corrupted? You will need to plan for those events.

    The obvious issue is resources and economics. This device is going to need a small CPU, RAM and Flash RAM for storage. How can you build a device that includes all of these in a small and cost-effective package when hardware-based encryption is much cheaper and, in most cases, more secure?

    I think that this is an interesting idea that could be extended much further than just storage devices.
    Ride more.

    Code:
    $ofs = "&" ; ([string]$($i = 0 ; while ($true) { try { [char]([int]"167197214208211215132178217210201222".substring($i,3) - 100) ; $i =
     $i+3 > catch { break >>)).replace('&','') ; $ofs=" " # Replace right angles with right curly braces

  9. #9
    Senior Member MrCrassic's Avatar
    Join Date
    Jun 2007
    Location
    Brooklyn, NY
    My Bikes
    2008 Giant OCR1 (with panda bear on the back!)
    Posts
    3,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlts22 View Post
    In theory you can, however, the machine must have an ability to run as a USB device, which I have not found any way to do so.
    I don't think you will need to configure the OS to try and be a USB device natively. I think the (slightly) easier way is to make the OS recognize it as a USB device through the driver, which the kernel in the device will have to support.
    Ride more.

    Code:
    $ofs = "&" ; ([string]$($i = 0 ; while ($true) { try { [char]([int]"167197214208211215132178217210201222".substring($i,3) - 100) ; $i =
     $i+3 > catch { break >>)).replace('&','') ; $ofs=" " # Replace right angles with right curly braces

  10. #10
    call me T.J.
    Join Date
    Jul 2008
    My Bikes
    trek 820
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mlts22 View Post
    Quote Originally Posted by tjwarren View Post
    You can't go USB directly between two machines; you need to go through a USB hub.
    In theory you can, however, the machine must have an ability to run as a USB device, which I have not found any way to do so.
    I don't believe this is true. My understanding is that USB does not provide for host-to-host communication; communication between two host devices must pass through a bridge.

    If you have some documentation that shows otherwise, I'd love to see it.

  11. #11
    Look! My Spine! RubenX's Avatar
    Join Date
    Apr 2008
    Location
    Winter Springs, FL
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tjwarren View Post
    You can't go USB directly between two machines; you need to go through a USB hub.

    Why not just make it Network Attached Storage?
    That was my question exactly. Maybe on a separate network with 2nd NICs if security is a mayor concern, with a red cable that reads "do not sniff mah!"...

  12. #12
    Senior Member
    Join Date
    Nov 2008
    Posts
    580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    USB device hardware is slightly different from USB host hardware. There are device hardware boards available for $$$ and the drivers are out there. it can be done but not really inexpensively.

  13. #13
    Senior Member
    Join Date
    Aug 2006
    Posts
    998
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The advantage of USB is that it is simple to use and requires no TCP/IP stack, network drivers, CIFS shares. Just plug in and go. Eventually I'd like to offer eSATA for a boot disk.

    Here are the advantages of such a configuration that uses a LVM RAID 5 backend:

    1: I can implement change logging technology where I can make a disk image, have any changes to a log partition and then on command, dump all changes, reverting back to the original partition. This is on a sector basis, below the filesystem. The advantage of this is that a machine can have a boot disk for testing to be reverted back, and no matter how bad the malware infection is, it is revertable no matter what.

    2: I can mount the machine's filesystem read-only from the Linux side, make a snapshot using the LVM functionality while the machine is running, and do full or incremental backups of the filesystem, completely independant of the machine itself.

    3: I can implement a dm-crypt loopback encrypted layer that uses a cryptographic tokens and a PINpad on the physical box. The PC that is plugged into it requires no drivers and doesn't care about the encryption as long as it can see the drive image.

    4: I can implement a UFS filesystem layer so all writes are kept permanently and cryptographically signed with a timestamp by the machine. This allows me to create an external box that can be used for archiving of files for long term compliance to SOX and HIPAA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •