Given the Linux initramfs targets a block device as a file that then gets mounted as the persistent root filesystem, I don’t think it would really be possible to unmount / and replace the location with a file. Root isn’t represented as a file or directory in any filesystem structure and is a construct of many Unix and Unix-like kernels.
Yeah, I’m actually kinda curious to see what it would do, since the command is pretty nonsensical. Probably just an immediate failure along the lines of “/ is a directory”?
Certainly a failure but at least it wouldn’t actually be as harmful as it reads, given / is a directory and the assumption you’re not root.
Can it not be a directory? How?
Given the Linux initramfs targets a block device as a file that then gets mounted as the persistent root filesystem, I don’t think it would really be possible to unmount / and replace the location with a file. Root isn’t represented as a file or directory in any filesystem structure and is a construct of many Unix and Unix-like kernels.
Yeah, I’m actually kinda curious to see what it would do, since the command is pretty nonsensical. Probably just an immediate failure along the lines of “/ is a directory”?
Yep, on my machine it just says
bash: /: Is a directory
.It’s brave individuals like yourself who are doing the lord’s work 🫡