Home » Questions » Computers [ Ask a new question ]

Can I share a hard drive both over USB and SMB?

Can I share a hard drive both over USB and SMB?

The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:

Asked by: Guest | Views: 285
Total answers/comments: 2
Guest [Entry]

"Basically, if I read you correctly, you want a Network Attached Storage device that allows you to access the data stored on it via USB and via an SMB network share simultaneously.

To muse a bit more with you, I think it is possible. It may not actually exist out in the world (yet), but it is possible to build something that behaves this way I think.

There is this device on newegg that seems to do what you are talking about, but judging by reviews it may not do what you want.

If you tried looking around, you might be able to find a way to repurpose a full-blown PC to both provide access to data on an internal hard-drive via both a USB connection and via SMB sharing. However, you might have to be creative with the USB side of things, as I doubt you could have the HDD available as mass storage coming from the PC, due to host/guest issues in USB. You could maybe have the HDD available over USB by using USB as a direct PC-to-PC connection system (kinda like PC-to-PC over parallel port, back in the day)."
Guest [Entry]

"I've accepted sheepsimulator's answer. But I thought I would post my own just to get this out there. I've thought about this some more, and here's the only way I can imagine this working:

Have a disk enclosure that has both a USB port and an Ethernet port. There's a bit of firmware in the enclosure the runs a webserver for configuration. The device has two modes, USB mode and NAS mode. You can switch between them with the web-based configuration (so the network port is always active, but SMB file sharing is not always active). To enter NAS mode, the device does a USB disconnect on it's USB port, the mounts the filesystem on the drive itself internally and starts the process to do SMB sharing. When switching to USB mode, the device shuts down the SMB process, unmounts the filesystem, then does a USB reconnect.

Without actually trying this, it seems like this would work and not cause problems. Pretty much anything expecting to talk to a USB Mass Storage device will handle the hotplug/unplug gracefully, and most SMB clients are ok with the server going away.

A slightly different (crazier?) version of this would be more automatic. Let's say USB mode is the default. When it's not doing anything else, it defaults to USB mode. The SMB sharing process is running, but because the USB side owns the drive there isn't a filesystem actually in place (yet). When an SMB request comes in that requires actual content, do the switch from USB to NAS like a described above. Maybe it stays in NAS mode for as long as there is some activity requiring SMB to access actual files within a configurable timeout.
This would probably generate a ton of connect/disconnects for the USB side and I can imagine various PCs on the network accidentally indexing, pinging or otherwise unintentionally causing the NAS side to wakeup often.

Huh, I want this to exist for cheap, but I can't imagine it would be cheap to produce. There's a bit of coding there."