Transcript UNIX

Lecture 3: Filesystem Partitions
Free Unix versions
Asoc. Prof. Guntis Barzdins
Asist. Girts Folkmanis
University of Latvia
Oct 1, 2004
Hard Drive Construction
Master Boot Record (MBR):
Track 0, Sector 1
• Number of partitions and their
location (max 4 primary partitions or
3 primary + 1 Extended + 12 Logical)
• Pointer to partition with bootloader
HD Track arrangement
Constant Sector Tracks
Commonly found on early hard disks
and still on floppy disks.
Every track has the same number of
sectors.
Zone Bit Recording
In this arrangement, tracks are grouped into zones.
From the innermost part to the outer edge,
successive zones contain more sectors per track.
This is more efficient than the earlier arrangement.
HD identification
 IDE drives



Partition identification:
dev/hda
dev/hdb
...
 SCSI



dev/sda
dev/sdb
...
Note that /dev is not a real directory for
accessing the contents of disks –
it is rather a naming space for all hardware
devices (and their drivers) present in the
system, including keyboard, screen etc.
The contents of disks is made
available in other part of root / hierarchy.
File System Layout
Bootloader can be installed in different locations
(if bootloader not in MBR, the BIOS interprets MBR to find boot partition)
Boot Block
The system’s primary disk unit contains a boot block that contains the
bootstrapping program that loads the OS to memory. This program is invoked by
the computer’s minimal bootstrap program in ROM.
This boot block is often called the Master Boot Record (MBR).
Different operating systems treat the MBR in very different ways. Some are flexible
enough to install a boot loader in the MBR, so that the disk can contain different
OS in different disk partitions. The loader for each OS is then stored at the
beginning of its own partition. Examples: Windows NT/2000/xp boot loader,
Linux lilo and grub.
A “bootable” disk is one on which a boot block has been installed.
Mandatory partitions
 root


/dev/hda1 (recommended)
This is partition for the actual root / of the UNIX filesystem
 swap





/dev/hda2 (recommended)
4GB (max with 32bit x86 CPU)
RAM SIZE * 2 (recommended)
This partition is not visible in root / and is used only by kernel for
virtual memory page swapping (“raw” sectors, no structure)
Theoretically swap partition is optional, if enough RAM
Optional partitions or separate HD
 Typically on separate partitions

/home, /boot, /tmp, /var, /usr
 Reasons for separate partitions





logical or physical damage
reinstallation (affects only some partitions)
limit overflow effects
better performance
shared via network
Creating Partitions: GNU Parted
Notes:
1.
2.
3.
4.
5.
6.
For ext2, ext3 and reiserfs: the start of the partition must stay fixed.
For ext2, ext3: the partition you copy to must be bigger or exactly the same size as the partition you copy from.
For ext2 and ext3: the checking is limited to ensuring the resize and copy commands will be ok.
For fat: the size of the new partition after resizing or copying is restricted by the cluster size. Parted can shrink
the cluster size, so you can always shrink your partition. However, if you can't use FAT32 for some reason, you
may not be able to grow your partition.
Parted supports both FAT16 and FAT32. Parted can convert file systems between FAT16 and FAT32, if
necessary.
Reiserfs support is enabled if you install libreiserfs, available at http://reiserfs.osdn.org.ua. (It is likely to be
available soon from http://www.namesys.com)
File System Types

















VFS
UFS / FFS
NFS
RFS
S5FS
VxFS
JFS
CFS
EXT2/EXT3
GFS
ReiserFS
XFS
CXFS
QFS
HFS
NTFS
FAT16/ FAT32
Virtual File System
UNIX File System – used interchangeably with FFS (Fast File System)
Network File System – developed by Sun
Remote File System – developed by AT&T
Original System V file system
Veritas Journaling File System
Journaled File System – AIX
Cluster file system – Tru64
2nd/3rd Extended File System – Linux systems
Global File System – Linux
Journaling file system – Linux
Extended File System – SGI and others
Clustered Extended File System – SGI
64-bit very large file system – Sun Solaris
Hierarchical File System – S/390 UNIX, OS/2, MacOS X
Windows NT/2000/2003
Windows – several versions
File System Support
 Linux can interpret many
file system types,
including;






EXT2, EXT3,
UFS/FFS,
FAT16, FAT32
NTFS (read-only),
HPFS
ISO9660, UDF, UFS, etc.
 Win32 can interpret a few
file system types,
including;


FAT16, FAT32
NTFS
Linux Virtual File System (VFS)
Unix File System (UFS) Structure
EXT3 File System
 A journaling filesystem
 Goal : use EXT2 and complete backwards and forwards
compatibility between EXT2 and EXT3
 batch (journal) all updates(handles) off into very large
transactions and just send them all out at once
 Why?



Availability – reduce long time fsck
Data Integrity – data consistency
Speed – optimizes hard drive head motion
BSD Versions
 FreeBSD - Focusing on features and ease of use
 Darwin (OS X) - Focusing on the desktop and multimedia
with use of the Apple's Aqua Interface
 NetBSD - Focusing on portability
 OpenBSD - Focusing on security
 PicoBSD - Focusing on size (extremely small)
 DragonflyBSD - Focusing on new computing paradigms
Linux Distributions
 Debian GNU/Linux (Xandros, Knopix,...)

a free operating system that provides almost 4000 software packages for six
architectures (Intel, Motorola, Alpha, SPARC, PowerPC, ARM) and is developed
entirely by volunteers over the Internet
 Fedora/RedHat

a Red-Hat-sponsored and community-supported open source project. The goal of
The Fedora Project is to work with the Linux community to build a complete, general
purpose operating system exclusively from free software. Development will be done
in a public forum
 Mandrake Linux

a friendly Linux Operating System which specializes in ease-of-use for both servers
and the home/office. It is freely available in many languages throughout the world
 Slackware

a long running Linux distribution that descends from the SLS Distribution
 SuSE Linux

an extremely popular distro that features excellent documentation, thousands of
applications on a DVD/CD-ROM set
 Gentoo Linux

an optimized GNU/Linux distribution featuring 5 different pgcc-optimized builds,
including Intel Pentium, Pentium Pro/II/III and AMD K6 optimized
SunOS
 Solaris x86
Mājas darbs: pētījums
 Katrai darba grupai instalēt atšķirīgu Unix paveidu
 Pētījumā (aptuveni 5-10 lpp) detalizēti aprakstīt
gūto pieredzi, ieskaitot:



Ar ko šī Unix versija atšķiras no citām (filozofija)
Unix instalācijas process (ari screenshots etc.)
Aplikāciju instalācijas process
nokompilet un izpildit “hello world” C programmu
 Gatavu aplikāciju rekomendējamais instalācijas
process

“Hello World” palaišana
unix% cat > hello.c
#include <stdio.h>
int main() {
printf("Hello World!\n");
return 0;
}
Ctrl/D
unix%gcc hello.c
unix%./a.out
Hello World!
unix%
Unix Instalacija