Search code examples
linuxrenameoverlaymount

Renaming a file without copying it; any alternative to OverlayFS?


I want to have a "virtual" filesystem like OverlayFS where I can rename the files and folders, but without copying the whole file. I have an archive with over 800TB of Data and the files need to be renamed, but I want to keep the original folder structure and the filenames.

For instance:

  • I have the 800tb mount on /mnt/archive.
  • I want an "overlay" mount on /mnt/archive_renamed.

So that a file, for example Data001.bin on /mnt/archive can be renamed on the overlaymount and look something like this /mnt/archive_renamed/Data_from_2014/Data_from_Cats.bin but belongs still to Data001.bin and never touches the underlying mount.

OverlayFS would be perfect if it doesn't need to copy the whole file when renaming it.

Any clue?


Solution

  • In /mnt/archive_renamed, you can use hardlinks to the original files. Just do "cp -al /mnt/archive /mnt/archive_renamed" and you'll have to folders pointing to the same files.