Network File System: NFS (1) distribute file system example: /home ...
Network File System: NFS (1) distribute file system example: /home ...
Network File System: NFS (1) distribute file system example: /home ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
5. User Identities 252<br />
<strong>distribute</strong> <strong>file</strong> <strong>system</strong><br />
<strong>example</strong>: /<strong>home</strong><br />
implementation: RPC<br />
handbook section 27.3<br />
<strong>Network</strong> <strong>File</strong> <strong>System</strong>: <strong>NFS</strong> (1)<br />
5. User Identities 253<br />
server host<br />
• needs servers<br />
<strong>Network</strong> <strong>File</strong> <strong>System</strong>: <strong>NFS</strong> (2)<br />
– mountd handles mount requests (exports <strong>file</strong>)<br />
– nfsd handles data requests at port 2049/udp<br />
– portmap or rpcbind to handle RPC<br />
• needs configuration<br />
– services above must be started at boot time<br />
– which <strong>file</strong><strong>system</strong>s are exported to other hosts<br />
/etc/exports<br />
<strong>example</strong> entry<br />
/<strong>home</strong> -maproot=bin: 134.96.216.81<br />
5. User Identities 254<br />
NIS/<strong>NFS</strong> security<br />
no security issues since several years<br />
summary of configuration issues<br />
• NIS: separate NIS passwd map from local /etc/passwd<br />
• NIS: control client access to NIS server<br />
• <strong>NFS</strong>: no exports to the world<br />
• <strong>NFS</strong>: map root to a non–root account<br />
• <strong>NFS</strong>: firewalling the <strong>NFS</strong>–port<br />
more details<br />
http://www.securityfocus.com/infocus/1387<br />
5. User Identities 255<br />
OpenAFS (Andrew <strong>File</strong> <strong>System</strong>)<br />
http://www.openafs.org/<br />
influenced <strong>NFS</strong>v4<br />
CIFS / SMB<br />
http://www.samba.org/<br />
Alternatives
5. User Identities 256<br />
Automount Daemon<br />
Special Feature: amd<br />
can mount the network device, whenever a <strong>file</strong> is accessed<br />
for <strong>example</strong>, if the user logs in<br />
❀no permanent connection to <strong>NFS</strong> server needed<br />
5. User Identities 257<br />
Limiting Users: Per-Process Limits (1)<br />
$ ulimit -a<br />
core <strong>file</strong> size (blocks, -c) unlimited<br />
data seg size (kbytes, -d) 524288<br />
<strong>file</strong> size (blocks, -f) unlimited<br />
max locked memory (kbytes, -l) unlimited<br />
max memory size (kbytes, -m) unlimited<br />
open <strong>file</strong>s (-n) 3117<br />
pipe size (512 bytes, -p) 1<br />
stack size (kbytes, -s) 65536<br />
cpu time (seconds, -t) unlimited<br />
max user processes (-u) 1558<br />
virtual memory (kbytes, -v) unlimited<br />
5. User Identities 258<br />
there are three limits:<br />
Limiting Users: Per-Process Limits (2)<br />
• soft limit (may be lowered/raised by user), ≤ hard limit<br />
(use ulimit -S)<br />
• hard limit (may only be lowered by user), set by<br />
– <strong>system</strong> admin in global login script /etc/pro<strong>file</strong>, or<br />
– sysctl kernel variable, or<br />
– <strong>system</strong>–specific <strong>file</strong>s (FreeBSD: /etc/login.conf)<br />
• kernel limit (=absolute <strong>system</strong> limit)<br />
5. User Identities 259<br />
Limiting Users: Disk Quotas<br />
• cannot be enforced on process level<br />
• is a <strong>file</strong><strong>system</strong> property<br />
• must be enabled in kernel<br />
• must be set when mounting a <strong>file</strong><strong>system</strong> (see below)<br />
• command quota -v lists disk usage<br />
• command edquota -u user sets user limit<br />
Note: quotas slow down writing to disk
6. <strong>File</strong> <strong>System</strong> 260<br />
6. <strong>File</strong> <strong>System</strong><br />
6. <strong>File</strong> <strong>System</strong> 261<br />
as of 2013<br />
Drives and Capacity<br />
Drive Bandwidth (read) Capacity EUR/GB<br />
hard disk drive 1.6 GB/s 60 GB...4 TB 0.06...0.20<br />
solid state drive 2.7 GB/s 120 GB...256 GB 0.70...0.85<br />
secure digital memory card 4 GB...64 GB 0.68...0.85<br />
USB memory stick 60 to 90 MB/s 4 GB...64 GB 0.69...2.00<br />
digital versatile disk 10.5 MB/s (1x) 4.7 GB (1s, 1l) 0.69...2.00<br />
6. <strong>File</strong> <strong>System</strong> 262<br />
Partition Mess on Intel <strong>System</strong>s<br />
• first ,,OS” for Intel-based <strong>system</strong> was MS-DOS<br />
• fundamental design error: four partitions on a hard disk<br />
named C:, D:, E:, F: (restriction 32 MB in MS-DOS 3.3 in 1987)<br />
• disks grew bigger ❀more ,,logical” partitions G:, H:...<br />
• disks grew still bigger ❀larger partitions<br />
• MBR: still four primary partitions<br />
• MBR: ,,extended” partition contains logical partitions<br />
• MBR: disk limit 2 TB<br />
• Linux: primary/logical partition = a <strong>file</strong> <strong>system</strong><br />
• BSD: primary partition called slice containing partitions<br />
6. <strong>File</strong> <strong>System</strong> 263<br />
UEFI Unified Extensible Firmware Interface<br />
EFI: Itanium platform 1998<br />
UEFI: April 2011<br />
• GPT: GUID Partition Table<br />
• CPU independence<br />
• pre-OS environment, including network capability<br />
• 8 ZB = 8000 EB<br />
kilo-mega-giga-tera-exa-zetta-yotta-...<br />
Linux / Windows 64-bit / HP-UX / HP-OpenVMS / Apple(Intel) /<br />
FreeBSD(GPT)
6. <strong>File</strong> <strong>System</strong> 264<br />
What is a <strong>File</strong> <strong>System</strong>?<br />
A <strong>file</strong> <strong>system</strong> is a logical unit of (background) memory.<br />
Inodes are local to a <strong>file</strong> <strong>system</strong>.<br />
A <strong>file</strong> <strong>system</strong> can live on<br />
• a hard disk<br />
• a floppy disk<br />
• a CDROM<br />
• a DVD<br />
• a memory stick<br />
• a part of RAM (RAMDISK)<br />
• ...<br />
6. <strong>File</strong> <strong>System</strong> 265<br />
FreeBSD Device Naming<br />
The name determines what type of driver handles the storage device:<br />
device name drive type<br />
ad IDE (ATA, SATA) hard drives<br />
da USB mass storage, SCSI hard drives<br />
acd IDE CDROM drives<br />
cd SCSI CDROM drives<br />
scd,mcd non–standard CDROM drives<br />
sa SCSI tape drives<br />
ast IDE tape drives<br />
fla flash drives<br />
aacd,mlxd,mlyd,idad,twed RAID drives<br />
6. <strong>File</strong> <strong>System</strong> 266<br />
(Linux Devices)<br />
/dev/hda is the first drive on the first IDE controller.<br />
/dev/sda is the first SATA/SCSI drive<br />
Its first partition is /dev/sda1.<br />
Its second partition is /dev/sda2.<br />
/dev/sdb is the 2nd drive<br />
Its first partition is /dev/sdb1.<br />
Its second partition is /dev/sdb2.<br />
It is irrelevant which type of device this is (HDD/CDROM).<br />
6. <strong>File</strong> <strong>System</strong> 267<br />
Look at the boot messages.<br />
If the machine is up you can issue<br />
dmesg<br />
(display <strong>system</strong> message buffer)<br />
Which devices are found?<br />
or have a look into /var/run/dmesg.boot<br />
Example:<br />
ad0: 157066MB at ata0-master UDMA133<br />
ad1: 32253MB at ata0-slave UDMA100<br />
acd0: DVDROM at ata1-master UDMA33<br />
acd1: CDRW at ata1-slave UDMA33
6. <strong>File</strong> <strong>System</strong> 268<br />
MBR:<br />
FreeBSD Device and Slice and Partition Naming<br />
/dev/ad0 is the first drive<br />
Its first slice is /dev/ad0s1.<br />
The first partition on the first slice is /dev/ad0s1a.<br />
/dev/ad1 2nd drive ...<br />
GPT:<br />
/dev/ada0 is the first drive<br />
Its partitions are named /dev/ada0p1, /dev/ada0p2,...<br />
Example: booting different partition<br />
gpart unset -a bootme -i 2 ada0<br />
gpart set -a bootme -i 6 ada0<br />
6. <strong>File</strong> <strong>System</strong> 269<br />
<strong>File</strong> <strong>System</strong><br />
organize inodes and directories, uses a partition<br />
several ways to do that<br />
❀several <strong>file</strong> <strong>system</strong> types<br />
6. <strong>File</strong> <strong>System</strong> 270<br />
see /sbin/mount *<br />
• FreeBSD<br />
<strong>File</strong> <strong>System</strong> Types<br />
– ufs (UNIX <strong>file</strong><strong>system</strong>), FFS (Berkeley Fast <strong>File</strong><strong>system</strong>)<br />
– ext2fs<br />
– cd9660 – CD–ROM <strong>file</strong> <strong>system</strong><br />
– new: ZFS (Sun Micro<strong>system</strong>s)<br />
– ...<br />
• Linux<br />
– ext2 – standard linux FS<br />
– ext3 – journaling extension of ext2<br />
– ext4 – extension of ext3 (performance/features)<br />
6. <strong>File</strong> <strong>System</strong> 271<br />
– reiserfs – <strong>file</strong> <strong>system</strong> based on balanced trees<br />
– jfs – IBM’s journaled FS<br />
– xfs – journaled FS<br />
– iso9660 – CD–ROM <strong>file</strong> <strong>system</strong><br />
– ...<br />
http://www.tech-analyser.com/2011/10/<br />
understanding-<strong>file</strong>-<strong>system</strong>sntfs-fat.html<br />
http://www.enterprisestorageforum.com/technology/features/<br />
article.php/3849556/10-Reasons-Why-ZFS-Rocks.htm
6. <strong>File</strong> <strong>System</strong> 272<br />
fdisk divides a disk into slices<br />
Partitioning/FS/Mounting<br />
bsdlabel divides a slice into partitions<br />
newfs initializes a partition with the FS<br />
(Linux: mkfs, Solaris: mkfs/newfs)<br />
mount mounts a <strong>file</strong> <strong>system</strong> to a directory tree<br />
command parameters<br />
fdisk/gpart disk (MBR/GPT)<br />
bsdlabel slice<br />
newfs partition, FS type<br />
mount partition, directory<br />
6. <strong>File</strong> <strong>System</strong> 273<br />
fdisk (slices)<br />
******* Working on device /dev/ad0 *******<br />
parameters extracted from in-core disklabel are:<br />
cylinders=319120 heads=16 sectors/track=63 (1008 blks/cyl)<br />
...<br />
The data for partition 1 is:<br />
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br />
start 63, size 41929587 (20473 Meg), flag 80 (active)<br />
beg: cyl 0/ head 1/ sector 1;<br />
end: cyl 1023/ head 254/ sector 63<br />
The data for partition 2 is:<br />
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br />
start 41929650, size 41929650 (20473 Meg), flag 0<br />
beg: cyl 636/ head 14/ sector 1;<br />
end: cyl 249/ head 11/ sector 63<br />
6. <strong>File</strong> <strong>System</strong> 274<br />
The data for partition 3 is:<br />
sysid 131 (0x83),(Linux native)<br />
start 83859300, size 41929650 (20473 Meg), flag 0<br />
beg: cyl 1023/ head 255/ sector 63;<br />
end: cyl 1023/ head 254/ sector 63<br />
The data for partition 4 is:<br />
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br />
start 125788950, size 195880545 (95644 Meg), flag 0<br />
beg: cyl 886/ head 10/ sector 1;<br />
end: cyl 652/ head 8/ sector 63<br />
6. <strong>File</strong> <strong>System</strong> 275<br />
bsdlabel (partitions within slice)<br />
bsdlabel ad0s1<br />
# /dev/ad0s1:<br />
8 partitions:<br />
# size offset fstype [fsize bsize bps/cpg]<br />
a: 1048576 0 4.2BSD 2048 16384 8<br />
b: 1779344 1048576 swap<br />
c: 41929587 0 unused 0 0<br />
d: 2985984 2827920 4.2BSD 2048 16384 28552<br />
e: 1048576 5813904 4.2BSD 2048 16384 8<br />
f: 31457280 6862480 4.2BSD 2048 16384 28552<br />
g: 3609827 38319760 4.2BSD 2048 16384 28552
6. <strong>File</strong> <strong>System</strong> 276<br />
Advantage: separated <strong>file</strong> storage<br />
Partitioning (1)<br />
Disadvantage: max size cannot be exceeded<br />
6. <strong>File</strong> <strong>System</strong> 277<br />
Partitioning (2)<br />
Should be done carefully (fixed sizes).<br />
The <strong>system</strong> core should not be affected by <strong>file</strong> I/O of users.<br />
❀/, /<strong>home</strong>, /var, /tmp should be on different <strong>file</strong> <strong>system</strong>s<br />
swap at least as big as RAM<br />
/var at least as big as RAM