If I format the hard drive, will my OS code get lost?

  • Many OS will not allow to format the disk on which they are located. If unix allows such formatting and OI is on this disk, then yes (the code on the disk will be erased). - nick_n_a
  • one
    If there, where you format, OS lies, then will be jammed. If it does not lie, it will not get stuck. * stopped waiting for the boat * - andmal
  • one
    Formatting destroys all data on the formatted partition / drive. So if the OS files are on the same partition, then yes, it will get lost. But what has already been loaded into RAM will remain intact. - ߊߚߤߘ
  • very interesting. And if I formatted hard, then the OS code that was in the RAM will remain on the hard back? (Sounds like something crazy)) - Semerkin
  • Theoretically, this does not interfere with anything :) But most modern OSs with such perversions do not bother, as far as I know, and simply continue to live on the remnants of the RAM until the reboot - andreymal

1 answer 1

  1. depending on what the term “formatting a hard disk” means (more correctly - “block device”, hereinafter - “used):

    • re-creation of the file system (hereinafter - f.s.) on the existing section B.u. (A breakdown into so-called sections is an opportunity to create several “logical” second-hand on one single “physical” second-hand) will lead to the formation of new empty file allocation tables. Physically, most of the information about existing files, directories, and other objects of f.s. will remain “in place”, but access to this information by “standard” means will be impossible.
    • re-creation of the section on B. at. with exactly the same parameters (start / end / signature) will not affect the fs located in this section.
    • deleting a partition will result in the inability to access the fs "Regular" means (although all the information will remain "in place").
    • deleting a partition and creating a new one, starting from the same place on the second-hand, but with a smaller size, will result in damage to the PS located on the remote partition (exceptions are possible, depending on the PS itself).
    • deleting a section and creating a new one, starting from the same place on a used one, but with a larger size usually does not affect the fs in any way.
    • re-creation of table of contents B. at. will delete the partition information (equivalent to “deleting a section” above)
  2. and depending on what the term "code of my OS".
    1. the files mapped into RAM will remain accessible, just like the entire contents of the RAM.
    2. Can working processes "get" to the objects of f.s. in case of its damage (see above) depends on many circumstances: both on the nature of the damage, and on the type of fs, and on the implementation of support for this fs. in the kernel code of your OS.
  • "My OS code" can still be the contents of the folder C: \ Users \ Vasya \ Desktop \ MyOS - nörbörnën
  • @norbornen, metac unix kind of hints that this is not about dos-like operating systems. - aleksandr barakin
  • of course, the contents of the /usr/src/myos ... this is just a typo =) ... By the way, when the FS is re- mkfs.ntfs , mkfs.ntfs will erase all data by default. - Fat-Zer
  • By the way, the first (and so far the only) plus for this answer has exceeded my reputation for 50 thousand (this is a memo for myself) - aleksandr barakin