– General Linux 1 – Design Hard Disk Layout [2]

(Linux Professional Institute Certification)

a

   .~.
   /V\      by: geoffrey robertson
  // \\         geoffrey@zip.com.au
  @._.@
$Id: gl1.102.1.slides.tex,v 1.2 2003/05/30 05:00:47 waratah Exp $

aCopyright \begin{matrix}c \\ ◯ \end{matrix} 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version.

(2.2) 102 Installation & Package Mgt. [24]

1.102.1

Design hard disk layout [2] 1.102.2 Install a boot manager [3] 1.102.3 Make and install programs from source [5] 1.102.4 Manage shared libraries [3] 1.102.5 Use Debian package management [5] 1.102.6 Use Red Hat Package Manager (RPM) [6]

Design hard disk layout [2]

Objective

Candidates should be able to design a disk partitioning scheme for a Linux system. This objective includes allocating filesystems or swap space to separate partitions or disks, and tailoring the design to the intended use of the system. It also includes placing /boot on a partition that conforms with the BIOS’ requirements for booting.

Design hard disk layout [2]

Key files, terms, and utilities

/ (root) filesystem
/var filesystem
/home filesystem
swap space
mount points
partitions
cylinder 1024

Resources of interest

Linux Partitioning Mini-FAQ

http://pw1.netcom.com/~kmself/Linux/FAQs/partition.html

IA32 Disk Partitions

Primary Partitions

On i386 systems disks may be sliced up into to 15 partitions.

(It may be possible to have 63 or more partitions in IDE disk drives)

• The disk must have at least 1 primary partition.

/dev/hda1

• There may be up to 4 primary partitions.

/dev/hda1  (primary)
/dev/hda2  (primary)
/dev/hda3  (primary)
/dev/hda4  (primary)

IA32 Disk Partitions

Logical Partitions

On i386 systems disks may be sliced up into to 15 partitions.

• One of the 4 primary partitions may be made into an extended partition.

• The one extended partition must hold between 1 and 12 logical partitions.

/dev/hda1  (primary)
/dev/hda2  (extended)
/dev/hda5  (logical)
/dev/hda6  (logical)
...
/dev/hda16 (logical)

Linux Partitioning mini-FAQ

Basic Recommendation

/                      50 - 100 MB
/tmp                  50 - 100 MB
/var                  200 - 500 MB
/usr                  1 - 2+  GB
/usr/local           1 - 2+  GB
/home                 remainder

Linux Partitioning mini-FAQ

Swap

• Linux currently has a maximum of 2GB

• VA Linux configures its servers with 1x physical RAM

• Traditional recommendation is 2x physical RAM

• Karsten M. Self uses 3x physical RAM

• Large amounts of swap should be divided across several partitions and preferably across several spindles.

Linux Partitioning mini-FAQ

Swap

• Linux currently has a maximum of 2GB

• VA Linux configures its servers with 1x physical RAM

• Traditional recommendation is 2x physical RAM

• Karsten M. Self uses 3x physical RAM

• Large amounts of swap should be divided across several partitions and preferably across several spindles.

8-a

Linux Partitioning mini-FAQ

Swap

• Linux currently has a maximum of 2GB

• VA Linux configures its servers with 1x physical RAM

• Traditional recommendation is 2x physical RAM

• Karsten M. Self uses 3x physical RAM

• Large amounts of swap should be divided across several partitions and preferably across several spindles.

8-b

Linux Partitioning mini-FAQ

Swap

• Linux currently has a maximum of 2GB

• VA Linux configures its servers with 1x physical RAM

• Traditional recommendation is 2x physical RAM

• Karsten M. Self uses 3x physical RAM

• Large amounts of swap should be divided across several partitions and preferably across several spindles.

8-c

Linux Partitioning mini-FAQ

Swap

• Linux currently has a maximum of 2GB

• VA Linux configures its servers with 1x physical RAM

• Traditional recommendation is 2x physical RAM

• Karsten M. Self uses 3x physical RAM

• Large amounts of swap should be divided across several partitions and preferably across several spindles.

8-d

Linux Partitioning mini-FAQ

Root partition

The root partition must have:

• /bin
• /dev
• /etc
• /initrd
• /lib
• /root
• /sbin

Other directory trees may be distributed on other partitions/spindles.

Directories on separate partitions

/tmp highly variable. Don’t risk your root partition, isolate this content. Mount noexec and/or nosuid for added protection.

/var likewise, highly variable. Mount noexec and/or nosuid for added protection.

/usr Largely stable. Can be mounted read-only except for package upgrades.

/usr/local Largely stable, and not part of the packaging system. Can be mounted read-only, possibly nosuid.

/home Variable content, usually most sensitive data both in terms of security and integrity. Can be mounted nosuid.

Directories on separate partitions

/tmp highly variable. Don’t risk your root partition, isolate this content. Mount noexec and/or nosuid for added protection.

/var likewise, highly variable. Mount noexec and/or nosuid for added protection.

/usr Largely stable. Can be mounted read-only except for package upgrades.

/usr/local Largely stable, and not part of the packaging system. Can be mounted read-only, possibly nosuid.

/home Variable content, usually most sensitive data both in terms of security and integrity. Can be mounted nosuid.

10-a

Directories on separate partitions

/tmp highly variable. Don’t risk your root partition, isolate this content. Mount noexec and/or nosuid for added protection.

/var likewise, highly variable. Mount noexec and/or nosuid for added protection.

/usr Largely stable. Can be mounted read-only except for package upgrades.

/usr/local Largely stable, and not part of the packaging system. Can be mounted read-only, possibly nosuid.

/home Variable content, usually most sensitive data both in terms of security and integrity. Can be mounted nosuid.

10-b

Directories on separate partitions

/tmp highly variable. Don’t risk your root partition, isolate this content. Mount noexec and/or nosuid for added protection.

/var likewise, highly variable. Mount noexec and/or nosuid for added protection.

/usr Largely stable. Can be mounted read-only except for package upgrades.

/usr/local Largely stable, and not part of the packaging system. Can be mounted read-only, possibly nosuid.

/home Variable content, usually most sensitive data both in terms of security and integrity. Can be mounted nosuid.

10-c

Directories on separate partitions

/tmp highly variable. Don’t risk your root partition, isolate this content. Mount noexec and/or nosuid for added protection.

/var likewise, highly variable. Mount noexec and/or nosuid for added protection.

/usr Largely stable. Can be mounted read-only except for package upgrades.

/usr/local Largely stable, and not part of the packaging system. Can be mounted read-only, possibly nosuid.

/home Variable content, usually most sensitive data both in terms of security and integrity. Can be mounted nosuid.

10-d

Typical Desktop

 Filesystem 1k-blocks     Used Available Use% Mounted on
/dev/hda3      152247   33526   110859  24% /
/dev/hda6      249871     2004   234967   1% /tmp
/dev/sda7      585008  457456     97836  83% /var
/dev/hda5      495960   87588   382772  19% /var/spool/news
/dev/sdb2     1929100 1518288   312816  83% /usr
/dev/sda5     1209572  574152   573976  51% /usr/local
/dev/hda7      378711  213496   145662  60% /usr/local/data
/dev/hda2     1007992  584132   372656  62% /home
/dev/hda1      157044  119252     37792  76% /mnt/dos

Typical Desktop fdisk /dev/hda

Disk /dev/hda: 128 heads, 63 sectors, 620 cylinders
Units = cylinders of 8064 * 512 bytes
   Device Boot     Start        End     Blocks   Id  System
/dev/hda1               1         39     157216+   6  FAT16
/dev/hda2              40        293   1024128   83  Linux
/dev/hda3   *        294        332     157248   83  Linux
/dev/hda4             333        620   1161216     5  Extended
/dev/hda5             333        459     512032+  83  Linux
/dev/hda6             460        523     258016+  83  Linux
/dev/hda7             524        620     391072+  83  Linux

Typical Desktop fdisk /dev/sda

Disk /dev/sda: 255 heads, 63 sectors, 261 cylinders
Units = cylinders of 16065 * 512 bytes
   Device Boot     Start        End     Blocks   Id  System
/dev/sda1               1         17     136521   82  Linux swap
/dev/sda2              18        261   1959930     5  Extended
/dev/sda5              18        170   1228941   83  Linux
/dev/sda6             171        187     136521   82  Linux swap
/dev/sda7             188        261     594373+  83  Linux

Typical Desktop fdisk /dev/sdb

Disk /dev/sdb: 255 heads, 63 sectors, 261 cylinders
Units = cylinders of 16065 * 512 bytes
   Device Boot     Start        End     Blocks   Id  System
/dev/sdb1               1         17     136521   82  Linux swap
/dev/sdb2              18        261   1959930   83  Linux

Typical Desktop /etc/fstab

/dev/hda3      /                 ext2 defaults,errors=remount-ro          0 1
proc           /proc             proc defaults                               0 0
/dev/hda6      /tmp              ext2 defaults,nosuid,nodev                0 2
/dev/sda7      /var              ext2 defaults,nosuid,nodev                0 2
/dev/hda5      /var/spool/news ext2 defaults,nosuid,noexec,nodev        0 2
/dev/sdb2      /usr              ext2 defaults,rw,nodev                     0 2
/dev/sda5      /usr/local       ext2 defaults,rw,nosuid,nodev             0 2
/dev/hda7      /usr/local/data ext2 defaults,nosuid,nodev                2 2
/dev/hda2      /home             ext2 defaults,nosuid,nodev                0 2
/dev/hdc       /mnt/cdrom       iso9660 noauto,user,ro,nodev,nosuid      2 2
/dev/fd0       /mnt/floppy      auto noauto,gid=disk,umask=007,rw,user  2 2
/dev/hda1      /mnt/dos     vfat auto,user,nosuid,nodev,gid=6,umask=002 2 2
/dev/sda1      none              swap     sw           0        0
/dev/sdb1      none              swap     sw           0        0
/dev/sda6      none              swap     sw           0        0

The End

16