US
12 MIN READ TIME

Answers

Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com

Neil Bothwick

has the Linux kernel running through his wetware.

Q Sticky computer

I have a device that records data to a USB stick. I cannot change this, it is a ‘black box’. It works fine except that in order to access the data, I have to stop the devices, change sticks and start a new session. Is there a way to connect a Linux box to the USB ports on the device so that it sees the Linux box as a USB storage device and records the data to its hard drive? I have not heard of such a thing, but it would mean I could access the data while it was running.

A There is a solution using the Linux kernel gadget class, but it has a couple of drawbacks. The first is that the kernel module used for this, g_mass_ storage, is not normally enabled on distribution kernels, so you most likely need to install the distro’s kernel source package, enable the CONFIG_USB_ MASS_STORAGE option, then recompile it. The other drawback is that the filesystem you use to receive the data is mounted on the other device, so any changes to it from your computer will probably cause corruption. However, most devices that record to USB storage expect a FAT filesystem and split the output into files of 1GB or 2GB. Provided you only read from these files, and do not touch the one currently being written to, you should be OK, but no promises.

Once you have compiled the kernel and rebooted, you create somewhere for the data to be written, called the backing storage. This can be either a hard disk partition or a file. A partition is easiest – all you need to do is format the partition with an appropriate filesystem and tell the module to use it, for example:

If you want to use a file as the backing storage, create and format it with:

This creates a 16GB (bs x count) file – give this as the file option for the module. Now you can connect your USB cable, and your black box device should see the ‘USB stick’ you have created. To avoid any chance of data corruption, when you need to access the backing storage, you should mount it read-only, like this:

Unlock this article and much more with
You can enjoy:
Enjoy this edition in full
Instant access to 600+ titles
Thousands of back issues
No contract or commitment
Try for 99c
SUBSCRIBE NOW
30 day trial, then just $9.99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
October 2023
VIEW IN STORE

Other Articles in this Issue


LINUX FORMAT
MEET THE TEAM
The big news is that Linux gaming has leapfrogged Mac OS on Steam for the first time. Which classic game would you love to play again on your Linux PC?
Smarter Pi Guy
We’re not fighting the tide of the AI
LINUX FORMAT
The #1 open source mag
REGULARS AT A GLANCE
Proton turns five and Linux overtakes Mac OS
THIS ISSUE: Valve’s game-changing Proton turns five Kernel 6.5 hits the streets Vim creator dies Happy birthday to Debian
Linux kernel 6.5 ready to ship
The stable version of kernel 6.5 has a number of exciting updates, especially for Intel and AMD users.
Death of Bram Molenaar
The creator of Vim and other projects dies, aged 62.
GAME OVER!
Joe Brockmeier is head of community, Percona. “Sure,
NVK HAS LANDED
Faith Ekstrand is an engineering fellow at Collabora.
Happy birthday! Debian turns 30
And the Debian Project shows no sign of slowing down.
SUSE goes private
SUSE has plans to be taken private once again by owner EQT Partners.
LibreOffice 7.6 released
The Document Foundation releases another version of its powerful office suite.
Distro watch
What’s behind the free software sofa?
QUALITY CONTROL
Italo Vignoli is one of the LibreOffice and
PLUMB LINE
Jon Masters is a kernel hacker who’s been
Kernel Watch
Jon Masters keeps up with all the latest happenings in the Linux kernel, so you don’t have to.
Mailserver
WRITE TO US Do you have a burning
HotPicks
OnionShare Bulky Sweeper KDiskMark Min OnionMedia X Pwall Nostlan DevilutionX Paper Clip Menu Editor
OPEN SOURCE STREAMING
Stream all your media around your home and beyond – we look at the innovative new options!
REVIEWS
WD Black 8TB HDD
Shane Downing likes more performance in his performance products.
AMD Radeon RX 7600
With so much competition in the market, Chris Szewczyk tries to work out whether the new RX 7600 does enough to beat the pack.
Window Maker Live
Nate Drake gets into the frame of things with Window Maker – adesktop experience reminiscent of a ’90s Mac.
OPNSense 23.7
Nate Drake has the good sense to try out OPNSense, a powerful firewall distro based (in a roundabout fashion) on FreeBSD.
Rhino Linux 2023.1
Nate Drake takes a ride on the Rhino, exploring the rich Unicorn desktop, as well as the pleasures and perils of rolling releases.
Mask of the Rose
There’s an indescribable horror in the basement. Management just employed it to do the accounting, and Joshua Wolens has to make it tea.
ROUNDUP
Personal cloud servers
Michael Reed compares five open source personal cloud servers to find out if they’re really free, what it takes to install them and what they can do.
Obtaining and installing
We want to see a variety of installation types suitable for different scenarios.
Installable apps
Some systems can do more than just file share and can be expanded.
The user interface
You’ll see it every day, so it has to be good.
Mobile apps
You probably want to be able to access your files while on the move.
File synchronisation
Automatic duplication of a folder on your computer to your cloud.
Storage back-ends
Flexibility in terms of where you store your file data is a boon.
Freemium vs free
Does the enterprise version offer vital features not in the free one?
The verdict
Personal cloud servers
A.I.-POWERED RASPBERRY Pi
Tam Hanna has followed the Raspberry Pi since the first revision, and puts the RPi 4 to work on amusing AI tasks.
Smart hardware choices
With great ecosystem diversity comes a great amount of choice.
Sounds like trouble
Recognising our northern accents will tax this poor Pi audio model.
A face for AI…
We’re not the prettiest, but perhaps our Pi might not take offence.
Our chatty AI man
Get your Pi to chat like a human, mostly.
Pi USER
Rejoice! 271% more Pi available than in 2022
Les Pounder wonders if 75% of all statistics are made up, but at least he can buy a Pi 4 now.
RISC-V x86
Box64 emulation.
Lichee RISC-V
Small and delicious.
MORE Pi FOR EVERYONE
Les Pounder works with groups such as the
52Pi Rack Tower
Les Pounder owns multiple Raspberry Pis but has yet to make a cluster. Perhaps this enclosure will see him put all of his Pis on the shelf?
Elegoo Neptune 4
“Smoke me a Klipper, I’ll be back for breakfast!” cries Denise Bertacchi.
Control a Pi bot with a Wiimote
Les Pounder travels back to 2014, the last time that he held a Wiimote that wasn’t embedded in an LCD TV.
IN DEPTH
Fre/e/YOUR PHONE
Tired of being tracked and spied upon by popular mobile OSes, Jonni Bidwell is ditching Android and taking back privacy with /e/OS
Next-gen Wi-Fi
Another new wireless technology, already? Darien Graham-Smith looks ahead to the seventh generation of the IEEE networking standard.
TUTORIALS
Bring your images and videos to life
Not known for his love of cameras, Shashank Sharma still knows how to turn images into presentable GIFs and video clips into masterpieces.
Mapping made easy
KDE MARBLE
Manage your photo collection with finesse
Mike Bedford explains how DigiKam enables you to manage your photos, finding what you’re looking for with the most powerful of tools…
FORTRAN – the first high-level language
It might have been the world’s first high-level language, but Mike Bedford discovers that FORTRAN is still alive and well today.
Easily manage a free VPS with Virtualmin
David Bolton demonstrates how to set up Virtualmin on a free VPS and how to configure it to add websites.
Get more out of your Steam Deck
From external controllers to an external display, Neil Mohr offers a fistful of handy gaming tips for your Steam Deck.
ADMINISTERIA
Using Bash aliases for an easier life
Keep things simple by creating and using aliases to run your most frequently executed commands.
SSH like a pro
A selection of quick tips that are handy to have up your sysadmin sleeve.
Purge Docker debris
Docker is great at a lot of things but that doesn’t mean that it doesn’t require a dose of preventative maintenance periodically.
Bitwarden
A powerful, feature-packed open source password manager with a free option and decent pricing, thinks Mike Jennings.
ExpressVPN
Looking behind the hype machine, Mike Williams wonders whether this is as good as it sounds?
CODING ACADEMY
Text adventures: now in full colour!
Nate Drake embraces ancient graphics and dinky sound effects in the final part of our text adventure coding series.
Blast apart classic Breakout gaming code
PYGAME
Chat
X
Pocketmags Support