The Superuser: Root
Disks and Partitions
Making New Partitions
Mounting Filesystems
Mounting a Filesystem: mount
Mounting Other Filesystems
Unmounting a Filesystem: umount
Sample /etc/fstab
Filesystem Types
2. TOPICS
The Superuser: Root
Disks and Partitions
Making New Partitions
Mounting Filesystems
Mounting a Filesystem: mount
Mounting Other Filesystems
Unmounting a Filesystem: umount
Sample /etc/fstab
Filesystem Types
3. The Superuser: Root
Every Linux system has a user called ‘root’
The root user is all-powerful
Can access any files
The root user account should only be used for system administration, such as installing
software
When logged in as root, the shell prompt usually ends in #
Usually best to use su for working as root:
$ whoami
fred
$ su -
Password:
# whoami
root
4. Concepts: Disks and Partitions
A hard disk provides a single large storage space
Usually split into partitions
Information about partitions is stored in the partition table
Linux defaults to using partition tables compatible with Microsoft Windows
For compatibility with Windows, at most four primary partitions can be made
But they can be extended partitions, which can themselves be split into
smaller logical partitions
Extended partitions have their own partition table to store information about
logical
partitions
5. Making New Partitions
Create new partitions with the n command
Choose whether to make a primary, extended or logical partition
Choose which number to assign it
fdisk asks where to put the start and end of the partition
The default values make the partition as big as possible
The desired size can be specified in megabytes, e.g., +250M
Changes to the partition table are only written when the w command is
given
6. Filesystems
Some confusion surrounds the use of the term ‘filesystem’
Commonly used to refer to two distinct concepts
1. The hierarchy of directories and files which humans use
to organise data on a system
(‘unified filesystem’)
2. The formatting system which the kernel uses to store
blocks of data on physical media
such as disks (‘filesystem types’)
7. Disk Naming
The device files for IDE hard drives are /dev/hda to /dev/hdd
hda and hdb are the drives on the first IDE channel, hdc and hdd the ones
on the second channel
The first drive on each channel is the IDE ‘master’, and the second is the
IDE ‘slave’
Primary partitions are numbered from 1–4
Logical partitions are numbered from 5
The devices /dev/hda, etc., refer to whole hard disks, not partitions
Add the partition number to refer to a specific partition
8. Changing Partition Types
Each partition has a type code, which is a number
The fdisk command shows a list of known types
The command t changes the type of an existing Partition
Enter the type code at the prompt
Linux partitions are usually of type ‘Linux native’ (type 83)
Other operating systems might use other types of partition,
many of which can be understood by Linux
9. Mounting Other Filesystems
mount /dev/sdb3 /mnt/extra mounts the filesystem stored in
the /dev/sdb3 device on the
mount point /mnt/extra
You may occasionally need to specify the filesystem type
explicitly:
# mount -t vfat /dev/hdd1 /mnt/windows
Allowable filesystem types are listed in the mount(8)
manpage
To see a list of the filesystems currently mounted, run mount
without any options
10. Configuring mount: /etc/fstab
The /etc/fstab file contains information about filesystems
that are known to the system administrator
Specifying a filesystem in /etc/fstab makes it possible to use
its mount point as the only argument to mount
/etc/fstab also configures which filesystems should be
mounted at boot-up
Each line in /etc/fstab describes one filesystem
Six columns on each line
12. Filesystem Types
The most common filesystem types are:
ext2 The standard Linux filesystem
iso9660 The filesystem used on CD-ROMs
proc Not a real filesystem, so uses none as the device. Used as a way
for the kernel to report system information to user processes vfat The
filesystem used by Windows 95
auto Not a real filesystem type. Used as a way of asking the mount
Networked filesystems include nfs (Unix-specific) and smbfs (Windows
or Samba)
Other, less common types exist; see mount(8)