Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5839445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:35:07+00:00 2026-05-22T11:35:07+00:00

The Challenge : I have an Linux hand-held device, which records data and stores

  • 0

The Challenge: I have an Linux hand-held device, which records data and stores it to the disc. It should exchange these data with a Windows application via USB. When this data is accessible by the user – e.g. via USB-mass-storage – it has to be encrypted. It should work out-of-the-box, with a variety of OS, also for citrix terminal sessions, etc.

The Plan: I create a file-system in user-space with FUSE, and offer it to windows via mass-storage. Whenever Windows accesses one file, I get a callback and encrypt the data on the fly. Further more, we can have some dynamic content – e.g. when some password is written into a file, more content is shown.

The Problem: When using the mass-storage gadget (e.g. g_file_storage) it only accepts files or block-devices – but no file-systems (directories). Why?

[…] it provides a simple interface to read and write sectors of data—much like the low-level interface used to access any hard drive […]. Operating systems may treat the USB drive like a hard drive, and can format it with any file system they like. (from wikipedia)

So there is no chance to have a dynamic file-system via mass-storage… and this seems to be the reason, why my android mobile phone un-mounts all data on the phone, when I connect it to the PC.

Options:

  • Create a ‘block-device in userspace‘ – similar to FUSE (need a reverse-FAT-driver, when I want to offer files dynamically)
  • Implement my own nbd-server to create a block-device (need a reverse-FAT-driver as well?)
  • I save encrypted files to a partition, and pass this partition to the mass-storage gadget (Problem would be the performance and the lack of dynamic interaction)
  • Do not offer a mass-storrage device and watch out for other ideas (eth over USB)

At the moment, only the last option seems to be realistic – or do you have another tip for me?

I would be grateful!

Charly

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:35:08+00:00Added an answer on May 22, 2026 at 11:35 am

    The USB mass storage protocol is a block device protocol; it does not operate at the level of files or directories. The Windows host expects to see a raw VFAT filesystem exposed by the g_mass_storage driver, and will make writes and reads to VFAT metadata as appropriate to figure out how directories are structured.

    Because of this, it’s nontrivial to expose a FUSE filesystem to the windows host. You’d have to emulate VFAT, assigning blocks in the virtual filesystem to metadata and to data, and since the windows host is free to cache any data or metadata it reads, once you assign some metadata or data it cannot change (so changes to your FUSE data could not be reflected in the windows filesystem). The windows host can also delay and reorder writes to both metadata and data – it’s all real mess if you try to emulate.

    Now, there are some things you can do:

    1. You can write a custom IFS driver on the windows side to interact with your linux device over a custom protocol that works at the file/directory level.
    2. You can treat the USB device as a virtual ethernet port, and speak CIFS to the windows host
    3. You can somehow create a static VFAT layout on connection time to expose to the windows host; not-yet-decryptable data can return I/O errors in order to avoid the Windows host caching raw encrypted data.
    4. You can just encrypt a raw block device using dm-crypt, and expose this entire block device (encrypted as one chunk) to windows.
    5. You could implement a MTP gadget.

    These approaches come with their own problems:

    1. Requires a windows driver to be installed, and to be signed by microsoft etc. Can’t be used on a machine without administrative access to install the driver.
    2. Won’t autoplay; the user would need to browse through the network browser to get access to the files. Firewall settings may interfere. May have significant overhead.
    3. Very complex. Handling metadata updates on the backend may be extremely difficult. Surprise unplug events may be devastating. Windows behavior on receiving an IO error may be a problem if the user tries to access a locked file.
    4. No file-level encryption is available, but otherwise should work well.
    5. I’m unsure exactly how much support for non-media files MTP has; support is not as widespread as mass storage support.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following challenge at hand: I have a fanpage for a apartment
Here's the challenge: I have a Flash movie which will be embedded in a
Challenge: I have this code that fails to compile. Can you figure out what's
For those who like a good WPF binding challenge: I have a nearly functional
I have a challenge I need some input on. I am currently recruiting programmers
I have a challenge that I am trying to solve and I can't work
I challenge you :) I have a process that someone already implemented. I will
I have a SQL challenge that is wracking my brain. I am trying to
I have the following challenge, and I haven't found a good answer. I am
I have a pretty basic challenge-based iPhone game, and I wanted to know what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.