>>FIRST MISSION//LOGS//admin//creating-a-browse-able-virtual-file-archive-in-linux.MD
[ + ] TARGET_LOCKED200 OK
NOV 19, 2018timer 3 MIN READSYS_TAG: admin STATUS: VERIFIED_WORKING

Creating A Browse-able Virtual File Archive in Linux

ENGINE: KERNEL // STABLE
BASE_ARCH: x86_64
HOST: VASTORIGINS.COM
GPG: OKSIG_ID: 0x4EB27DB0
Creating A Browse-able Virtual File Archive in Linux
SPEC_IMAGE // PROVENANCE_VERIFIED

In Linux, there are many ways to create a virtual file archive, and once you understand the idea, a whole world of possibilities opens up. A virtual file archive is a storage file which imitates an inode storage device, meaning it behaves like what a physical drive can do, but it is all contained in a single ordinary file. You can mount it, write to it, copy files in and out, and even encrypt it, while from the outside it just looks like one file sitting on your disk.

So how do we create this virtual file archive? What we will be using is the most primitive way to create one, using the Linux built in toolset. No extra packages, no fancy new software, just the classic trio of command line utilities that have been doing this job for decades.

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 into Linux, which is the best kind of requirement. To be transparent, what I’m currently using is Arch Linux, but these tools behave the same on every distribution.

  • dd
  • losetup
  • mount

That is the entire shopping list. All three are part of the standard Linux toolset, so there is nothing to install and nothing to configure before we start.

🛠️ So, what do we do now?

First, create the file that will be used as the file archive:

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

Let us break down what is happening here. dd copies from the input file (if) to the output file (of), and in this case both are special: we read from /dev/zero, the endless source of zeros, and write into our new file gem.bin. The seek=1G part is the trick that saves us disk space. Instead of writing a whole gigabyte of zeros, dd simply skips to the one gigabyte mark, creating what is called a sparse file: it reports a size of 1GB, but actually consumes almost no disk space until you start putting real data into it.

Next, set up a loop block device to handle input and output, which is how we emulate a physical drive:

losetup /dev/loop0 gem.bin

Loop devices are Linux’s way of making a file pretend to be a block device. Once this command runs, /dev/loop0 behaves as if it were a real disk, even though its guts are really just our file.

Then create the mountable directory, the folder where our fake drive will appear:

mkdir -p /mnt/vfa

And finally, mount the loop block device to that directory:

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

That is it: the file gem.bin is now a real filesystem mounted at /mnt/vfa. Anything you write into that directory lands inside the file, and you can browse it, back it up, or move it to another machine like any other file. You will probably need sudo for the losetup and mount commands, and when you are done, remember to unmount with umount /mnt/vfa and detach the loop device with losetup -d /dev/loop0 to keep your system clean.

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.
[ SIGNATURE VERIFIED // GPG 0x4EB27DB0 // PROVENANCE SECURE ]
➔ RETURN TO LOGS