So, back to dd, and let’s assume you’re doing dd if=/dev/zero of=/dev/sda (the block size and other parameters are somewhat irrelevant here), and sda is the disk you booted from and where dd resides. Running processes can continue running, at their own peril. Sure, it’s an unrecoverable error (it’s on the active root filesystem), but it’s not critical enough to stop the whole system. But, more importantly, that is not fatal to the kernel itself. Again, you may not be able to re-launch it, but that’d be a different execution/process, which is completely independent of the first one.Īnd what about from the point of view of the operating system? The kernel will actually notice, because it does check that what’s on disk when doing certain operations (and it won’t find what it’s expected) and will error that file system out. It won’t try, so it won’t get an error, and nothing of relevance will happen to that program until it’s run it’s course and terminated. We’ve already established that the program doesn’t need it’s own executable, does it need anything else from the file system? Any other files or meta-data? If the answer is no, then it’s no problem for it at all. Then, what happens if you remove the underlying file system entirely (from the point of view of a running program)? Well, quite similar to the above, really. It would run until it terminates, and then it won’t be available to run again next time. It very likely won’t result in an error, either, unless the executable is actively looking for it’s file contents on disk (which most wouldn’t). By the way, this is a key difference from windows: windows will not let you delete the executable belonging to a running process, while Linux has no problem with it. Next, when the kernel finishes loading, it mounts file systems: / at the very least, maybe swap (we’ll get back to this one!) and others, and starts up init, which nowadays is systemd, and in turn that starts a multitude of daemons, like cron, sshd, etc.Įvery one of these processes being started, is likewise copied to and executed straight from memory. You can delete the kernel from disk, replace it, and it’s not a problem until the next time it’s booted. ![]() ![]() Now, Linux itself, the kernel, from the moment you boot it, will be copied and run entirely from memory. There’s a reason any sets of instructions telling you to run dd to do something are ALWAYS accompanied by a warning to make sure you’re pointing of= to the right disk. TL DR: if works if you prepare accordingly, though it may be easier to use a recovery system, or issue a low-level format secure erase command to your hard drive.įirst of all, dd (or any other utility that works the same way) has no problem writing to the very own disk it’s running from, much to the dismay (and disgrace) of some. Right, so, you CAN get it to work, without much trouble really, if you prepare for it accordingly.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |