Safely remove drives from terminal

diskHave you noticed that different file manager apps provide different options to remove drives? You probably have sees the options unmount, eject and safely remove drives. In this article we’ll explore these options briefly and then hack a way to safety detach removable USB disk drives from a Linux system. Continue reading Safely remove drives from terminal

metastore: backup filesystem metadata

diskLet’s say you moved a directory of files from Linux to your FAT32 pen drive temporarily. The ownership, permissions etc. of the contents would be lost. What if you want to retain them along with the data? metastore is another useful tool than can be added to our list of filesystem metadata backup utilities. Continue reading metastore: backup filesystem metadata

Snapper: snapshot utility from SUSE

Speaking of filesystem snapshots, Linux already has utilities like Timeshift in its arsenal. However, we couldn’t ignore Snapper, a fresh and powerful snapshot manager from SUSE. Non-root users can also use Snapper to view older versions of files and revert changes (if they have permission). Snapper is available for multiple distributions. Continue reading Snapper: snapshot utility from SUSE

Extended attributes & filesystems

hacker_compEvery filesystem provide for commonplace attributes like read, write, execute, access and modification time etc. However, when if comes to a filesystem, every measure should be taken so that it can be extended in future. Filesystems like ext2, ext3, ext4, XFS, JFS and reiserfs allow extended attributes which can be used to add tags to files as name-value pairs. This is by design and different from tagging in TMSU. Probably Tracker takes the benefit of this feature. Continue reading Extended attributes & filesystems

gitfs: version controlled filesystem

You have a server and you want to rollback the directory with your website files anytime you want. You can keep a backup of the files on a separate media and copy them back. What if you made some changes to the theme and want to keep both the original version and the modified one? Redundancy increases and it’s too difficult to trackback. Continue reading gitfs: version controlled filesystem

mhddfs: combine filesystems

diskThink of a situation where you have multiple disks. Each time you want to store large files on any of them (or you have a growing collection) you may need to check which disk has enough space. It’s a question of keeping your stuff organized too. You may want to use different volumes for Classical, Pop and Rock. What if the volume with Classical music doesn’t have any space for the next Beethoven collection you received? Continue reading mhddfs: combine filesystems

TMSU: tag your files

terminalYou have a collection of files which you want to classify based on a certain criteria to find them easily. Wouldn’t it be easier if the filesystem provided a way to tag the files to group them? Unfortunately, none of the popular filesystems of today support this. One solution is to create separate directories and store the files. Another option is to use a collection manager.

TMSU is a new tool that solves the problem with a unique approach. It allows you to tag files on the fly and maintains its own database to handle the tags.


Get the latest release for your architecture from the releases page. Currently TMSU is distributed as an executable which you can copy in your $PATH.

Note that TMSU needs FUSE and Sqlite3 to work.


Common example scenarios:

  • Tag files
    $ tmsu tag movie1.mkv movie action-movie genre=5 yr2014
    tmsu: New tag 'movie'
    tmsu: New tag 'action movie'
    tmsu: New tag 'genre=5'
    tmsu: New tag 'yr2014'

    TMSU shows the new tags it creates. You can also specify the value of a tag as we have done in genre=5.

  • Add tag to multiple files
    $ tmsu tag --tags "movie yr2014" *.mkv
  • Change mis-spelt tag to correct tag
    $ tmsu merge movei movie
  • Show tags applied to a file (or set of files)
    $ tmsu tags *.mkv
  • Search files by tag
    $ tmsu files movie yr2014

    and is the implicit operator.

  • Combining operators and parenthesis (and, or, not supported)
    $ tmsu files "(movie or tvseries) and not action-movie"
  • Search files by value of tag (or conditions)
    $ tmsu files genre = 7
    $ tmsu files movie and genre >= 5 and genre < 7
  • Get help
    $ tmsu help

Virtual Filesystem

TMSU supports mounting its database as a virtual filesystem and operating on it. The filesystem has two directories:

  1. tags: stores all user-created tags as directories under it. Inside each tag directory are the symbolic links to the files with the tag.
  2. queries: stores user-created queries as directories under it. Inside each query directory are the files those match the query

Example virtual filesystem usage:

  • Mount to a directory
    $ mkdir /mnt/tmsumnt
    $ tmsu mount /mnt/tmsumnt
    $ ls /mnt/tmsumnt
    queries    tags
  • List tags and files within
    $ ls /mnt/tmsumnt/tags
    action-movie    movie    yr2014
    $ ls /mnt/tmsumnt/tags/movie
    action-movie    movie1.1.mkv    yr2014

    The additional ‘1’ between movie1. and .mkv is the file id. You can pass the symbolic link movie1.1.mkv to a player to play it.

  • List queries and create new ones
    $ ls /mnt/tmsummnt/queries
    $ mkdir /mnt/tmsummnt/queries/"movie and not drama"
    $ ls "/mnt/tmsummnt/queries/movie and not drama"
  • mkdir is the above example is redundant as running ls within queries directory automatically creates the directory with the query name
    $ ls /mnt/tmsummnt/queries
    movie and not drama
    $ ls "/mnt/tmsummnt/queries/movie and not thriller"
    $ ls /mnt/tmsummnt/queries
    movie and not drama    movie and not thriller

On GitHub: TMSU

Force fsck on next boot

diskThere are times when you want to do a filesystem health check. However, it’s not safe to run fsck on a mounted volume. The best option is to run it on next boot. To do that on Ubuntu (applies to many other Linux favours as well), run the following command:

$ echo y | sudo tee /forcefsck

The y written to the file ensures that fsck doesn’t wait for user input. This is useful for remote connections.
The reverse (to skip fsck) is the following:

$ sudo touch /fastboot