Hacker News new | ask | show | jobs
by NetTechM 3643 days ago
The --no-preserve-root is the safety net of sorts. If you deliberately type it, you obviously know what you are asking for.
1 comments

But does the Linux subsystem actually understand that /mnt/c is the root of the drive, or can you omit the option?
According to the article, removing / didn't touch the stuff in /mnt/c. Therefore, I would assume (but obviously not test myself!) that this just stops as soon as it sees another mount point.
`rm` is probably hardcoded to not touch `/` without the flag and that's it, so most likely it's not necessary.
I just checked the `rm` source code for the GNU coreutils, and it actually checks for `/` by checking for identical device and inode numbers to `/`. I admittedly don't want to test if the feature works, but in theory if you remount `/` at a different location `rm` will still require the `--no-preserve-root` flag to delete it.

That said, the above only saves you if `/` and `/mnt/c` are the same device mounted at two different places - I haven't used the system to know.