Where It All Started.

Where It All Started.

Life, Stock Trading, Investments, Business and Startup. Most are programming stuff.

Tag: arch

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.


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.

Changing Xserver Default Applications Using XDG Tools

XDG (freedesktop.org) which stands for X Desktop Group is a group which develop the X11 and xdg utilities which currently runs as barebones of linux desktop. So how do we change the defaults when opening a file on XServer?

Be free, and live life fully.

β€” Caroline Shaw.

So how do we configure XDG?

Tools that we will be using to configure xdg can be found in xdg-utils package (utilities like xdg-settings and xdg-mime).
So to set the default application to open a certain mime type, you need run the code below:

xdg-mime default Thunar.desktop inode/directory

The command above would add the new mime application settings to ~/.local/share/applications/defaults.list. It basically tells xdg-mime to open a directory using Thunar (XFCE filemanager).

Fun Fact

  1. freedesktop.org (fd.o) is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operating systems. It was founded by Havoc Pennington, a GNOME developer working for Red Hat in March 2000. The project’s servers are hosted by Portland State University, sponsored by Hewlett-Packard, Intel, and Google. β†©οΈŽ