(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

16. Appendix: More on partitioning

After several questions on what partitioning really is, I'll just quote an answer I gave in a mail once.

Okay, here goes:

In an operating system you need several different filesystems for several different applications. For example, you need a swap filesystem because your main memory can't hold all information the operating system needs, so some of it has to be temporary written to disk. You may also need some special filesystem from which the machine reads the operating system when you switch it on. Finally, you need of course one or more filesystems to store the operating system program files and your user files. It may be a good idea to put these in different places (ie. on different filesystems) in case you have to reinstall the operating system, but don't want to scratch all your work.

The best thing is maybe to have all these filesystems on different disks. But one has seldom more than one or two disks in a computer. So what we do is to slice up the disk(s) in several slices (partitions) and use the slices for several filesystems. Then the operating system mounts the filesystems together to one single file tree, so it is easy to access the files.

(Other operating systems, like MS-DOS and NT use some other technology: They do not bind the slices together to one file tree, but keeps them separate as "stations". What is the best scheme? You figure!)

Here a thought example with one 2GB disk on a 7248: The mount point shows where in the file tree a filesystem is mounted.

    Partition   Size   Type             Mountpoint          Bootable
    ----------------------------------------------------------------
    /dev/sda1     10MB  41 (PReP Boot)     (Not mounted)    yes
    /dev/sda2    150MB  82 (Linux Swap)    (Not mounted)     -
    /dev/sda3   1840MB  83 (Linux ext2)  / (Root partition)  -
    
This would give a bootprompt command like this:
    root=/dev/sda3
    

If you want, you could add own partitions for important directories like /home, /boot, /var, /usr/local and so on. Here is an other example with two disks, actually my own configuration with two disks:

      Partition   Size   Type             Mountpoint          Bootable
      ----------------------------------------------------------------
      /dev/sda1     20MB  43 (PReP Boot)     (Not mounted)    yes
      /dev/sda2    133MB  82 (Linux Swap)    (Not mounted)     -
      /dev/sda5    930MB  83 (Linux ext2)  / (Root partition)  -
      /dev/sdb1    315MB  83 (Linux ext2)  /home               -
      /dev/sdb2    770MB  83 (Linux ext2)  /usr/local          -
      
This would give a bootprompt command like this:
      root=/dev/sda5
      
Before you ask:

  • ext2 is Linux' standard filesystem

  • Linux uses the old partition scheme from MSDOS. This means that if there are more than 3 partitions on one disk, one uses an extended partition (sda3) that may hold several logical partitions (sda5, sda6, sda7, ...)

  • Yes, my partition scheme is a bad one. My root partition was filled up in a couple of weeks or so. Don't use it. It is an example only.

Hope this clears up some things.