Categories
Development DevOps

Creating A Browse-able Virtual File Archive In Linux

In Linux, there are many ways to create a virtual file archive. A virtual file archive is a storage file which immitates an inode storage device, meaning its similar to what a physical drive can do but contained in a single archive. So how do we create this virtual file archive? What we will be using is the most primitive way to create a virtual file archive using Linux built in tool set.

The secret to happiness is freedom…​ And the secret to freedom is courage.

— Thucydides.

Prerequisites

The tooling that we will be using is already built in Linux. To be transparent what I’m currently using is Arch Linux.

  • dd
  • losetup
  • mount

So what do we do now?

Create the file that will be using as file archive.

dd if=/dev/zero of=gem.bin bs=1024 count=0 seek=1G

Setup a loop block device to handle input/output (emulating physical drives).

losetup /dev/loop0 gem.bin

Create the mountable directory.

mkdir -p /mnt/vfa

Mount the loop block device to the mountable directory.

mount -t ext3 /dev/loop0 /mnt/vfa

So guys, if you like this article hit like and subscribe. Hope you guys, enjoyed this article and as always live life!

Fun Fact

  1. losetup is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device. If only the loopdev argument is given, the status of the corresponding loop device is shown.
  2. dd is a command-line utility for Unix and Unix-like operating systems, the primary purpose of which is to convert and copy files.
  3. mount command serves to attach the filesystem found on some device to the big file tree.

By Edward Fitz Abucay

"How long is forever?"

I'm a software engineer with a passion for innovating and creating products, especially for startups in the web3 and blockchain space. I'm always excited to learn and work with new technologies, and I'm committed to delivering high-quality solutions that meet the needs of my clients or users.

In my free time, I enjoy listening to music of all genres, but classical music holds a special place in my heart. I find it both inspiring and calming, and it helps me to stay focused and creative. I'm also an avid reader of books and manga, and I enjoy discovering new authors and stories.

As a software engineer, I have a strong technical background with experience in various programming languages, frameworks, and tools. I'm always striving to improve my skills and stay up-to-date with the latest trends and best practices. I love working with startups, especially those in the web3 and blockchain space, because I believe that these technologies have the potential to revolutionize the way we live and work.

Overall, I'm a dedicated and driven individual with a wide range of interests and skills. I believe that my passion for software engineering, combined with my love of music and reading, makes me a well-rounded and adaptable professional.

Leave a Reply

Your email address will not be published. Required fields are marked *