You are not logged in.

#1 2024-09-28 17:56:29

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

[SOLVED] What is chroot directory in my $HOME and is it safe to delete

I noticed there's "chroot" folder in my $HOME directory, likely from some old installation operation.
Is it safe to delete it? It's about 1.9 Gb and it has files

root
root.lock
root/.arch-chroot
root/bin (symlink)
root/boot
root/dev

and so on.

Last edited by chang-zhao (2024-09-29 19:27:25)

Offline

#2 2024-09-28 19:07:16

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

Move it first just in case you're using it without realising:

mv "$HOME"/chroot{,.bak}

Then do normal stuff for a while and see if anything breaks.


Jin, Jîyan, Azadî

Offline

#3 2024-09-28 20:08:31

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

Head_on_a_Stick wrote:

Move it first just in case you're using it without realizing

Is it possible to just check the directory's "file properties" when it was accessed last?
(If it was not accessed then it was not used?)

Offline

#4 2024-09-28 20:23:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,808

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

Depends on whether you're mounting noatime or relatime.
What's the output of

mount

Offline

#5 2024-09-28 20:44:51

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

chang-zhao wrote:

Is it possible to just check the directory's "file properties" when it was accessed last?

We ain't got time to check! tongue

But seriously: good thinking, batman. You too, seth smile


Jin, Jîyan, Azadî

Offline

#6 2024-09-29 12:33:18

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

seth wrote:

Depends on whether you're mounting noatime or relatime.
What's the output of

mount

It's relatime everywhere.

Offline

#7 2024-09-29 18:00:43

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,808

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

https://man.archlinux.org/man/core/man- … S_RELATIME
This limits the usefulness of atime for your purposes - the directory itself also isn't mounted from somewhere else? (the other question implicitly answered by the mount output)

Offline

#8 2024-09-29 18:50:06

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

seth wrote:

https://man.archlinux.org/man/core/man- … S_RELATIME
This limits the usefulness of atime for your purposes - the directory itself also isn't mounted from somewhere else? (the other question implicitly answered by the mount output)

No, it's not mounted from somewhere else. But I totally don't understand the description:

PS. Scratch that. They obviously mean "current value of atime" to be "the previous value of atime".

"MS_RELATIME (since Linux 2.6.20)
When a file on this filesystem is accessed, update the file's last access time (atime) only if the current value of atime is less than or equal to the file's last modification time (mtime) or last status change time (ctime)."

So it says atime is updated only if it's EARLIER than mtime or ctime?

Then it says:

"This option is useful for programs, such as mutt(1), that need to know when a file has been read since it was last modified."

That's quite the opposite, right?

Or does "current value of atime" mean "how much time passed since"?

(I would expect it to be a timestamp instead...)

Then it says another puzzling thing:

"Since Linux 2.6.30, the kernel defaults to the behavior provided by this flag (unless MS_NOATIME was specified), and the MS_STRICTATIME flag is required to obtain traditional semantics. In addition, since Linux 2.6.30, the file's last access time is always updated if it is more than 1 day old."

How can it be updated, if for example the computer restarted? If the file access time was not saved (as atime), then where the system will get it to update the info?

o_0

PS. ...if the previous access time "is more than 1 day old." Right?

Then atime must be good for the purpose of checking if "chroot" directory was used, right?

Last edited by chang-zhao (2024-09-29 19:04:05)

Offline

#9 2024-09-29 19:02:05

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,808

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

relatime makes sure that atime stays ahead of mtime (if appropriate) but not more, so if you access a file today and it's mtime was a week ago, the atime will be updated to today if any only if the last atime wa before a week ago (eg. a month ago) but not if the current atime is ahead of mtime already (eg. yesterday)

Offline

#10 2024-09-29 19:09:46

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

seth wrote:

relatime makes sure that atime stays ahead of mtime (if appropriate) but not more, so if you access a file today and it's mtime was a week ago, the atime will be updated to today if any only if the last atime wa before a week ago (eg. a month ago) but not if the current atime is ahead of mtime already (eg. yesterday)

But this here says:
"In addition, since Linux 2.6.30, the file's last access time is always updated if it is more than 1 day old."

Meaning if mtime was a week ago, and atime was 2 days ago, and the file was accessed now, then atime must be updated.

Because it was "more than 1 day old."

Right?

That means if the last access was yesterday (over 24 hours ago), the next access should be reflected?

Offline

#11 2024-09-29 19:14:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,808

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

Yes, true - this has actually escaped me ever since lol
So yeah, you can search the directory for recently used files: https://bbs.archlinux.org/viewtopic.php … 2#p2196522

Offline

#12 2024-09-29 19:28:02

chang-zhao
Member
Registered: 2024-01-21
Posts: 28

Re: [SOLVED] What is chroot directory in my $HOME and is it safe to delete

Thank you guys. [SOLVED].

Offline

Board footer

Powered by FluxBB