Does debugfs with set_inode_field for timestamps work?
by maybeJosiah from LinuxQuestions.org on (#6HSPM)
For created at:
sudo debugfs -w -R 'set_inode_field <'$inode'> crtime '$formatted_time'' "$device"
Also like this for changed at time:
sudo debugfs -w -R 'set_inode_field <'$inode'> ctime '$formatted_time'' "$device"
Like my source is man debugfs and zzzcode.ai. Latter was unsure whether to include <> but man debugfs clears that up. These are Ubuntu commands. Use on a bootable USB for main drive if ever on main drive. From what I remember stat may be used for $inode. What I am trying for is if, for record, this actually works.
I saw a thing on Linux and Unix Stack Exchange someone did in fact set crtime with a hi and lo. https://unix.stackexchange.com/quest...4fs-filesystem
What I try for is a program that uses a file to set all timestamps that can be set like originals from a backup. I already have a recorder and a reader that maybe sets timestamps. I would be using Bash. All I need to know is if I can set created at time and changed at time with debugfs. If there is a way I may accept that answer. Test it before saying there is a way. I do not have a full backup yet so I can't do it like myself. Maybe a blank computer with Ubuntu freshly installed would be a good thing for testing. Try to lose nothing and be careful. From what I can tell format for time is Seconds.nanos like some big number of seconds, a ., nanos. This can mess up your system so be careful. Maybe read "man debugfs" for details before testing this.
From what I underatand -w means use in read write mode, -R means execute one command and exit (needed for in Bash) that in quotes is command, set_inode_field is like it states, filespec, either <inode> or file path, comes next, which field, ctime for changed at or crtime for created at, is next, next is to set it to formatted, out of quotes, next is device that is with files to set, like /dev/sda1 but should not be that with safer usage. Just can debugfs set created at and changed at and maybe some how to answer. I already saw another question that could use an answer to this.
https://www.linuxquestions.org/quest...t4-4175625229/
X E.
sudo debugfs -w -R 'set_inode_field <'$inode'> crtime '$formatted_time'' "$device"
Also like this for changed at time:
sudo debugfs -w -R 'set_inode_field <'$inode'> ctime '$formatted_time'' "$device"
Like my source is man debugfs and zzzcode.ai. Latter was unsure whether to include <> but man debugfs clears that up. These are Ubuntu commands. Use on a bootable USB for main drive if ever on main drive. From what I remember stat may be used for $inode. What I am trying for is if, for record, this actually works.
I saw a thing on Linux and Unix Stack Exchange someone did in fact set crtime with a hi and lo. https://unix.stackexchange.com/quest...4fs-filesystem
What I try for is a program that uses a file to set all timestamps that can be set like originals from a backup. I already have a recorder and a reader that maybe sets timestamps. I would be using Bash. All I need to know is if I can set created at time and changed at time with debugfs. If there is a way I may accept that answer. Test it before saying there is a way. I do not have a full backup yet so I can't do it like myself. Maybe a blank computer with Ubuntu freshly installed would be a good thing for testing. Try to lose nothing and be careful. From what I can tell format for time is Seconds.nanos like some big number of seconds, a ., nanos. This can mess up your system so be careful. Maybe read "man debugfs" for details before testing this.
From what I underatand -w means use in read write mode, -R means execute one command and exit (needed for in Bash) that in quotes is command, set_inode_field is like it states, filespec, either <inode> or file path, comes next, which field, ctime for changed at or crtime for created at, is next, next is to set it to formatted, out of quotes, next is device that is with files to set, like /dev/sda1 but should not be that with safer usage. Just can debugfs set created at and changed at and maybe some how to answer. I already saw another question that could use an answer to this.
https://www.linuxquestions.org/quest...t4-4175625229/
X E.