The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sys::Filesystem::ID

DESCRIPTION

Will read and write an id from a filesystem for data identification purposes.

HOW IT WORKS

We create a text file at the root of the mounted filesystem in question- an id file.

MOTIVATION

This can be used to identify hard drives as they move across computers on a network. If you want to store information about a usb drive in a centralized database. Then you can move the hard drive (with partitions inside) around and you can track them.

fsid

A cli (command line interface) application is provided, called fsid, with this distribtution.

SUBS

None exported by default. This is not an OO interface.

get_id()

Argument is a device, a mount point, or a file path. Returns id string or undef if not found. Dies if it can't resolve.

   get_id('/dev/hda1');
   get_id('/mnt/usbdisk');
   get_id('home/myself/Desktop/file1.pdf');

create_id()

Argument is a device, a mount point, or a file path. Returns id string or undef if not found. Dies if it can't resolve, or if the id file already exists.

   create_id('/dev/hda1');
   create_id('/mnt/usbdisk');
   create_id('home/myself/Desktop/file1.pdf');

OVERRIDING ID GENERATION

The ide generated is a random buncha numbers 32 digits. If you want to make your own.. Override _suggest_id_string() in this package.

   sub Sys::Filesystem::ID::_suggest_id_string {}

The rule is it must return a string.

CAVEATS

You must have write access to create a partition id, and read access to see it. This works on posix only.

REQUIREMENTS

Sys::Filesystem

SEE ALSO

Sys::Filesystem fsid fsidgen

AUTHOR

Leo Charre leocharre at cpan dot org