Filesystem Maintenance Xavier Martorell-Bofill 1 Ren Serral-Graci 1 - - PowerPoint PPT Presentation

filesystem maintenance
SMART_READER_LITE
LIVE PREVIEW

Filesystem Maintenance Xavier Martorell-Bofill 1 Ren Serral-Graci 1 - - PowerPoint PPT Presentation

Filesystem Maintenance Xavier Martorell-Bofill 1 Ren Serral-Graci 1 Universitat Politcnica de Catalunya (UPC) May 26, 2014 Introduction Filesystems Disk verification LVM Backups Lectures System administration introduction 1


slide-1
SLIDE 1

Filesystem Maintenance

René Serral-Gracià Xavier Martorell-Bofill1

1Universitat Politècnica de Catalunya (UPC)

May 26, 2014

slide-2
SLIDE 2

Introduction Filesystems Disk verification LVM Backups

Lectures

1

System administration introduction

2

Operating System installation

3

User management

4

Application management

5

System monitoring

6

Filesystem Maintenance

7

Local services

8

Network services

9

Security and Protection

10 Virtualization

  • R. Serral-Gracià, et. al

Filesystem 2

slide-3
SLIDE 3

Introduction Filesystems Disk verification LVM Backups

Outline

1

Introduction Goals

2

Filesystems

3

Disk verification

4

Logical Volume Manager (LVM)

5

Backups

  • R. Serral-Gracià, et. al

Filesystem 3

slide-4
SLIDE 4

Introduction Filesystems Disk verification LVM Backups

Goals

Knowledge Filesystems Backup tools Backup media Abilities Filesystem ampliation Filesystem verification Perform and restore backups

  • R. Serral-Gracià, et. al

Filesystem 4

slide-5
SLIDE 5

Introduction Filesystems Disk verification LVM Backups

Outline

1

Introduction

2

Filesystems

3

Disk verification

4

Logical Volume Manager (LVM)

5

Backups

  • R. Serral-Gracià, et. al

Filesystem 5

slide-6
SLIDE 6

Introduction Filesystems Disk verification LVM Backups

Filesystems (I)

FAT (FAT16) –> DOS

Small disks (< 4GB) File names 8+3

FAT32 (VFAT) –> Win95

Larger disks Long filenames Partial definition of soft-links No owner or file access privileges

exFAT

FAT32 Extension Theoretical maximum capacity of 64ZiB (512TiB real)

NTFS –> WinNT, XP , Vista, Windows 7

Integrates ownership and privileges (create, modify, access...) Maps to Windows NT security model

  • R. Serral-Gracià, et. al

Filesystem 6

slide-7
SLIDE 7

Introduction Filesystems Disk verification LVM Backups

Filesystems (II)

ext2

UNIX Filesystem Soft/hard links Access privileges Long filenames

ext3

Adds journaling (eases error recovery)

reiserfs

Files and directories organized similarly to a database Features journaling Very efficient in small files No internal block fragmentation

  • R. Serral-Gracià, et. al

Filesystem 7

slide-8
SLIDE 8

Introduction Filesystems Disk verification LVM Backups

Filesystems (III)

xfs

journaling Dynamic i-node management ACLs Very large disk sizes Filesystem activity log

jfs

journaling Dynamic i-node management ACLs and MAC (Mandatory Acess Control) Very large disk sizes

  • R. Serral-Gracià, et. al

Filesystem 8

slide-9
SLIDE 9

Introduction Filesystems Disk verification LVM Backups

Filesystems (i IV)

ext4

64 bits addressing, improvements in journaling Delayed allocation Extents 1 exbibyte (EiB) maximum size

btrfs

Extents Online resizing Online balancing Online filesystem check

  • R. Serral-Gracià, et. al

Filesystem 9

slide-10
SLIDE 10

Introduction Filesystems Disk verification LVM Backups

Journal filesystems

Journal: disk operation registry

Eases the recovery of the FS in case of crash or error Slightly decrease in disk operations performance

Journal outside the buffer cache

Journal can be stored in another disk or partition

Ext3/4, reiserfs, JFS, XFS, NTFS, BTRFS have journal

  • R. Serral-Gracià, et. al

Filesystem 10

slide-11
SLIDE 11

Introduction Filesystems Disk verification LVM Backups

Outline

1

Introduction

2

Filesystems

3

Disk verification Disk fragmentation Filesystem ampliation Disk quota management

4

Logical Volume Manager (LVM)

5

Backups

  • R. Serral-Gracià, et. al

Filesystem 11

slide-12
SLIDE 12

Introduction Filesystems Disk verification LVM Backups

Disk verification (I)

Reason for errors Hardware errors Power shortage Operating system bugs Administration errors

Incorrect machine shutdown

Never verify a filesystem while mounted High probability of disk corruption Verification access skips the buffer cache and acts directlu

  • n the device
  • R. Serral-Gracià, et. al

Filesystem 12

slide-13
SLIDE 13

Introduction Filesystems Disk verification LVM Backups

Disk verification (II)

Logical verification Filesystem metadata Directory structure Lost data recovery

Directory lost+found

Physical recovery Disk blocks with Input/output errors Command: badblocks

  • R. Serral-Gracià, et. al

Filesystem 13

slide-14
SLIDE 14

Introduction Filesystems Disk verification LVM Backups

Disk fragmentation

Faster access to consecutive disk blocks Faster access to closer files within the disk Faster access Depending on the disk region

Zona mitja vs. extrems del disc

  • R. Serral-Gracià, et. al

Filesystem 14

slide-15
SLIDE 15

Introduction Filesystems Disk verification LVM Backups

Filesystem ampliation

Install and configure the new disk

Partition

  • r recycle existing ones. . .

Create filesystem Decide mountpoints Transfer the required data to the new partition Mount the partition

Update /etc/fstab

Maybe you have to reorganize existing directories

/home → /homeA + /homeB /home → /home/students + /home/professors

  • R. Serral-Gracià, et. al

Filesystem 15

slide-16
SLIDE 16

Introduction Filesystems Disk verification LVM Backups

Exercise

Planificar i definir possibles ampliacions dels segÃ1

4ents

directoris /home /usr/local /var

  • R. Serral-Gracià, et. al

Filesystem 16

slide-17
SLIDE 17

Introduction Filesystems Disk verification LVM Backups

Disk quota (I)

Quota Ability to limit the amount of data a user (or user group) is able to use in a filesystem (partition) Requires Support from the filesystem Support from the kernel

  • R. Serral-Gracià, et. al

Filesystem 17

slide-18
SLIDE 18

Introduction Filesystems Disk verification LVM Backups

Quota management (II)

Partition preparation Mounted using options ’usrquota’ and/or ’grpquota’ It can be done from /etc/fstab

/dev/sda9 /home ext4 defaults,usrquota,grpquota 1 1

quotacheck command to create the quota files

quotacheck -v

  • a
  • g
  • u
  • m

verbose all group user no-remount

Creates

/aquota.user /aquota.group

  • R. Serral-Gracià, et. al

Filesystem 18

slide-19
SLIDE 19

Introduction Filesystems Disk verification LVM Backups

Quota management (III)

Quota enabling

quotaon -v

  • a
  • g
  • u

verbose all group user

Activates quota mechanisms, usually from /etc/init.d/

Quota disabling

/sbin/quotaoff

Quota editing (edquota)

Disk quotas for user xavim (uid 500): Filesystem blocks soft hard inodes soft hard /dev/sdb1 3 16 32 2

Data blocs and i-nodes quota It is not possible to edit the used blocks/inodes, but the limits of the quota can be changed

  • R. Serral-Gracià, et. al

Filesystem 19

slide-20
SLIDE 20

Introduction Filesystems Disk verification LVM Backups

Quota management (and IV)

Visualize quotas: quota -v

Disk quotas for user xavim (uid 500): Filesystem blocks quota limit grace files quota limit grace /dev/sdb1 32* 16 32 6days 2

  • ∗ We are above the quotas, within the "hard" limit!!

"Grace period"

Grace time where the user can reach the hard limit, it only raises warnings If the grace period expires, then the system does not allow to go above the soft limit

  • R. Serral-Gracià, et. al

Filesystem 20

slide-21
SLIDE 21

Introduction Filesystems Disk verification LVM Backups

Other maintenance tasks

Monitoring Free space (df)

Most systems reserve a (5%) of the space to be exclusively used by root

Occupied space (du) Synchronization Write to disk the modified buffers

sync Update daemon

  • R. Serral-Gracià, et. al

Filesystem 21

slide-22
SLIDE 22

Introduction Filesystems Disk verification LVM Backups

Outline

1

Introduction

2

Filesystems

3

Disk verification

4

Logical Volume Manager (LVM)

5

Backups

  • R. Serral-Gracià, et. al

Filesystem 22

slide-23
SLIDE 23

Introduction Filesystems Disk verification LVM Backups

Logical Volume Manager (LVM) (I)

Physical Volumes (PV)

/dev/sda1 /dev/sdb1 /dev/sdb2

Volume Group

home ext3 swap / (root) ext4 usr btrfs

Logical Volumes (LV)

  • R. Serral-Gracià, et. al

Filesystem 23

slide-24
SLIDE 24

Introduction Filesystems Disk verification LVM Backups

Logical Volume Manager (and II)

High level abstraction of the disk space Aggregates multiple physical partitions/disks

Allows to add more partitions to the volume

It allows logical partitions within the volume

They can be assigned logical names Customized distribution among the physical volumes

Resizing Move

Example: /etc/fstab

/boot /dev/sda1 ... swap /dev/vg00/swap ... / /dev/vg00/root ... /home /dev/vg00/home ... /usr /dev/vg00/usr ...

  • R. Serral-Gracià, et. al

Filesystem 24

slide-25
SLIDE 25

Introduction Filesystems Disk verification LVM Backups

Outline

1

Introduction

2

Filesystems

3

Disk verification

4

Logical Volume Manager (LVM)

5

Backups Full Backup Incremental Backup Reverse Incremental Backup

  • R. Serral-Gracià, et. al

Filesystem 25

slide-26
SLIDE 26

Introduction Filesystems Disk verification LVM Backups

Backups

Data to copy

User data (home, mail, ... ) Program data (BBDDs, CVS, web, ...) System configuration Binary?

Backup frequency

Data confidence Data importance

Backup types

Full Backup (all) Incremental Backup (only changes) Reverse Incremental Backup (only changes)

  • R. Serral-Gracià, et. al

Filesystem 26

slide-27
SLIDE 27

Introduction Filesystems Disk verification LVM Backups

Full Backup

Always copy all the data

Fast to restore Large size

Sistema backup backup backup Temps

  • R. Serral-Gracià, et. al

Filesystem 27

slide-28
SLIDE 28

Introduction Filesystems Disk verification LVM Backups

Incremental Backup

Only backup the changed files Advantages Small size It can be done in any media Inconveniences Slower to restore The first one is equal to a full backup Do not create a large backup sequence

Sistema backup total backup Restauració backup Temps

  • R. Serral-Gracià, et. al

Filesystem 28

slide-29
SLIDE 29

Introduction Filesystems Disk verification LVM Backups

Reverse Incremental Backup

Everything is copied but in the former backup only the changes are kept

Advantages Fast to restore Little space Inconveniences Only possible in random access media

Sistema

=

backup backup backup

=

Temps Restauració

  • R. Serral-Gracià, et. al

Filesystem 29

slide-30
SLIDE 30

Introduction Filesystems Disk verification LVM Backups

Backups

Physical support Floppy, disc, CD, tape,

  • network. . .

To consider:

Cost size ratio Reliability Availability Usability Speed

Copy location Accident protection Fireproof boxes Keep some backups outside the company premises Stealing protection

  • R. Serral-Gracià, et. al

Filesystem 30

slide-31
SLIDE 31

Introduction Filesystems Disk verification LVM Backups

Exercise

Define a backup policy (data to backup, backup type, frequency, device, compression, . . . ) for a multi-user server within a company with: 500 Gb. disk and 80 users Mail

50Mb per user

Web pages

20 Mb per user 100 Mb company web

Code repository

10 GB distributed among 20 projects Only 5 active projects

  • R. Serral-Gracià, et. al

Filesystem 31

slide-32
SLIDE 32

Introduction Filesystems Disk verification LVM Backups

Other considerations

When having different servers it is recommended to

Define specific backup machines

cheaper easy to administer

Tools: tar+rsync/ssh, amanda, bacula

  • R. Serral-Gracià, et. al

Filesystem 32

slide-33
SLIDE 33

Introduction Filesystems Disk verification LVM Backups

Personal Homework

Task automation

Programming language: bash, perl Information search: find, grep. . .

  • R. Serral-Gracià, et. al

Filesystem 33