Cycling and bicycle discussion forums. 
   Click here to join our community Log in to access your Control Panel  


Go Back   > >

Foo Off-Topic chit chat with no general subject.

User Tag List

Reply
 
Thread Tools Search this Thread
Old 03-26-09, 11:36 AM   #1
mlts22 
Senior Member
Thread Starter
 
Join Date: Aug 2006
Bikes:
Posts: 998
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
mlts22 is offline   Reply With Quote
Old 03-26-09, 11:42 AM   #2
KingTermite 
On my TARDIScycle!
 
KingTermite's Avatar
 
Join Date: Jun 2005
Location: Eastside Seattlite Termite Mound
Bikes: Trek 520, Trek Navigator 300, Peugeot Versailles PE10DE
Posts: 3,924
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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 *******.
KingTermite is offline   Reply With Quote
Old 03-26-09, 11:53 AM   #3
mlts22 
Senior Member
Thread Starter
 
Join Date: Aug 2006
Bikes:
Posts: 998
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
mlts22 is offline   Reply With Quote
Old 03-26-09, 12:06 PM   #4
KingTermite 
On my TARDIScycle!
 
KingTermite's Avatar
 
Join Date: Jun 2005
Location: Eastside Seattlite Termite Mound
Bikes: Trek 520, Trek Navigator 300, Peugeot Versailles PE10DE
Posts: 3,924
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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 *******.
KingTermite is offline   Reply With Quote
Old 03-26-09, 01:02 PM   #5
Scummer
Genetics have failed me
 
Scummer's Avatar
 
Join Date: Jun 2007
Location: Zorneding, Germany
Bikes: Norwid Aaland, Dahon mju, Pedalforce CX1, Trek Madone 5.9, Old MTB and lots of spare parts
Posts: 2,989
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 1 Post(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.
Scummer is offline   Reply With Quote
Old 03-26-09, 01:02 PM   #6
tjwarren
call me T.J.
 
Join Date: Jul 2008
Bikes: trek 820
Posts: 361
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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?
tjwarren is offline   Reply With Quote
Old 03-26-09, 01:19 PM   #7
mlts22 
Senior Member
Thread Starter
 
Join Date: Aug 2006
Bikes:
Posts: 998
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
mlts22 is offline   Reply With Quote
Old 03-26-09, 01:37 PM   #8
MrCrassic 
Senior Member
 
MrCrassic's Avatar
 
Join Date: Jun 2007
Location: Brooklyn, NY
Bikes: 2008 Giant OCR1 (with panda bear on the back!)
Posts: 3,650
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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
MrCrassic is offline   Reply With Quote
Old 03-26-09, 01:39 PM   #9
MrCrassic 
Senior Member
 
MrCrassic's Avatar
 
Join Date: Jun 2007
Location: Brooklyn, NY
Bikes: 2008 Giant OCR1 (with panda bear on the back!)
Posts: 3,650
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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
MrCrassic is offline   Reply With Quote
Old 03-26-09, 02:05 PM   #10
tjwarren
call me T.J.
 
Join Date: Jul 2008
Bikes: trek 820
Posts: 361
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
tjwarren is offline   Reply With Quote
Old 03-26-09, 10:28 PM   #11
RubenX 
Look! My Spine!
 
RubenX's Avatar
 
Join Date: Apr 2008
Location: Kissimmee, FL
Bikes:
Posts: 619
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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!"...
RubenX is offline   Reply With Quote
Old 03-27-09, 06:17 AM   #12
enine
Senior Member
 
Join Date: Nov 2008
Bikes:
Posts: 580
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
enine is offline   Reply With Quote
Old 03-27-09, 12:13 PM   #13
mlts22 
Senior Member
Thread Starter
 
Join Date: Aug 2006
Bikes:
Posts: 998
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(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.
mlts22 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -6. The time now is 06:14 AM.