Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 C1-UD 6-6 BASIC LINUX FILE MANAGEMENT. Part IV. File System Administration Academic Year 08-09 DAI. Credit 1 (Single and Multiuser Operating Systems)

Similar presentations


Presentation on theme: "1 C1-UD 6-6 BASIC LINUX FILE MANAGEMENT. Part IV. File System Administration Academic Year 08-09 DAI. Credit 1 (Single and Multiuser Operating Systems)"— Presentation transcript:

1 1 C1-UD 6-6 BASIC LINUX FILE MANAGEMENT. Part IV. File System Administration Academic Year 08-09 DAI. Credit 1 (Single and Multiuser Operating Systems) Ferran Chic PELE-08/09 (Pla Experimental Llengües Estrangeres).Potenciació de la llengua Anglesa a la FP) © Ferran Chic. DAI-1er- C1 (SO)

2 2 6-6 INDEX 1. What should we know now ? 2. Before starting … 3. File System Structure 4. Creating partitions 5. Creating file systems 1. Formatting 2. Mounting 1. Manually 2. Automatically 3. Recovering data 6. Creating swap space 7. Managing disk quotas

3 3 6.6.1 What should we know ? How to manage and organize disk space to users Which file systems do I need ? Which is the appropriate fs size? Where and how do I mount the fs ? How do I check fs integrity and how do I recover fs integrity from an eventual data loss ? How do I format a partition ? How do I partition a disk ? TO SUM UP WE SHOULD KNOW ADMINISTRATIVE DISK MANAGEMENT TASKS

4 4 6.6.2 Before starting We must be able to identify possible storage devices located in /dev directory First floppy disk IDE HD or CD/DVD configured as secondary master within an IDE channel IDE HD or CD/DVD configured as primary slave within an IDE channel IDE HD or CD/DVD configured as primary master within an IDE channel First primary partition of primary master HD First logical partition of primary master HD First serial ata or pendrive device (pluggable devices) /dev/fd0 /dev/hda /dev/hdb /dev/hdc /dev/hda1 /dev/hda5 /dev/sda ?????? /dev/cdrom

5 5 6.6.2 Before starting 4 primary partitions x disk From the fifth until the last one are extended and logical partitions Some devices are considered completely CD’s, DVD’s, pendrives Other devices are subdivided into partitions: hard disks basically

6 6 6.6.3 FS STRUCTURE : SYSTEM V

7 7 Each CG contains super block backup Block bitmap. Inode bitmap. A subset of the inode table Data blocks 6.6.3 FS STRUCTURE : BSD

8 8 6.6.3 SYSTEM V / BSD comparison Write down the structure, performance and security differences between SYSTEM V and BSD fs. D1(STRUCTURE) : D2 (PERFORMANCE): D3 (SECURITY):

9 9 6.6.4 Creating partitions fdisk fdisk /dev/hda cfdisk cfdisk /dev/hda Once inside the specific partitioning tool, whe must move around the menus to set specific parameters. If our exit from fdisk, cfdisk includes a modification of MBD, is compulsory to reboot the system straightaway.

10 10 6.6.5.1 Formatting When we format a partition, the file system is created (all the structures shown in 6.6.3) The statement needed depends on the specific file system we want to create (ext2,ext3,reiser, fat )

11 11 Floppy disk format (low level) fdformat /dev/fd0 High level ext2 floppy disk format mkfs -c -v -t ext2 /dev/fd0 1440 Commands to format specific file system types mkfs.ext2, (alias to mke2fs) mkfs.ext3, mkfs.vfat, mkfs.minix, mkfs.msdos, mkfs.xfs 6.6.5.1 Formatting

12 12 ext3 format is the same as ext2 but with journaling added. mke2fs with -j is the same as a mkfs.ext3 mke2fs -c -j /dev/hda5 We can migrate ext2 to ext3 with tunefs command For reiser fs we must use mkreiserfs It is highly recommended to redirect the output of a format statement to a file, to have information about what had happened mke2fs –c /dev/hda5 > fitxer 6.6.5.1 Formatting

13 13 6.6.5.2 MOUNTING FILESYSTEMS mount command mount –t -o dispositiu directori tipus = fat,iso9660,ext2,ext3 -o = ro,... Mounting automatically: /etc/fstab file We should add 1 record (line) for each fs to be mounted automatically To mount all the automatic fs included in /etc/fstab we must execute mount –a mount –a is executed during the linux startup process as well, therefore, all the known fs (/ /var /usr /opt /boot ) are available after linux boot process

14 14 6.6.5.2 /etc/fstab file format Field 1) Device Field 2) Mount point Field 3) fs type auto,vfat,ntfs,ext2,iso9600,ext3,reiser Field 4)Mount options auto, noauto, defaults, noexec, user, nouser... Field 5) Just for dump pourposes. 0 by default Field 6) Mount and check order of the fs /dev/hdc /mnt/cdrom auto nouauto,user 0 0 /dev/sda / ext3 defaults 0 1

15 15 /dev/hdc /mnt/cdrom auto nouauto,user 0 0 /dev/sda / ext3 defaults 0 1 6.6.5.2 /etc/fstab file format examples Entry 1 : Will be mounted with mount –a defaults parameter includes : nouser auto rw Entry 2: Will not be mounted with mount –a allow users to easily mount using an easier version of mount mount /mnt/cdrom Or mount /dev/hdc

16 16 6.6.5.2 Other commands mount mount –a umount –a umount device umount folder_mount_point

17 17 6.6.5.3 Fs repair Fsck command fsck -t ext2 /dev/hda2 This command must be executed under the following conditions Single User init 1 Root fs in read only mode mount -o remount,ro / Important options in fsck : -c check bad blocks. -v verbose. -r ask for confirmation always -y always answer yes -f check forced (if not, just checks the dirty bit of the fs) Also works e2fsck (for ext2 and ext3) and reiserfsck for reiser fs What does e2fsck -c -f -b 8193 means ?

18 18 6.6.6 Managing Swap area Do you remember what is the reason why we need this swap area ? Do you remember where is it located ? Swap area configuration procedure Step 1 ) Create a new swap partition with fdisk Step 2) init 6 Step 3) “FORMAT” swap are with mkswap command : mkswap Step 4 ) Activate swap partition manually with swapon command : swapon Step 5) Activate automatically the swap area by adding a new entry on /etc/fstab file

19 19 6.6.7 Managing disk quotas It consists in setting the maximum growing space within a filesystem for every user or group Quotas can be established At block level (limit space ocupation) At i-node level (limit number of files creation) Quotas are established to control the occupied space of a filesystem, therefore quotas affect all the filesystem instead of specific folders.

20 20 We can set quotas to users or groups Two sort of quotas Soft limit : If a user or group reach the sort limit, a grace period begins. The user has the grace period to decrease his/her disk usage. If the time period is exceeded and the user keeps run out of quota, user account will be disabled until root user enables the account with usermod command Hard limit : If a user or group exceeds the hard limit of the fs, they will not be able to write more data there. Grace period : It’s a common parameter of the fs that affects equally to all users who exceed the soft limit 6.6.7 Managing disk quotas

21 21 Configuring disk quotas Step 0: Verify that your kernel supports quotas Step 1) Alter fstab file: Modify every entry that requires quota Examples: /dev/hda5 /home ext3 defaults,usrquota /dev/hda5 /home ext3 defaults,grpquota 6.6.7 Managing disk quotas

22 22 Step 2 )Prepare a quota database within the mount point of the f.s. cd /home touch quota.user touch quota.group chmod 600 quota.user chmod 600 quota.group Step 3) Create the database and check integrity quotacheck /home Step 4) Umount and mount /home to activate usrquota or grpquota param. 6.6.7 Managing disk quotas Step 5) Activate quotas quotaon

23 23 Root quota reports repquota User quota reports quota quota –v quota -g Quota edition (only root) : edquota –u usuari edquota –g grup edquota –u usuari –p usuari2 edquota –t 6.6.7 Managing disk quotas


Download ppt "1 C1-UD 6-6 BASIC LINUX FILE MANAGEMENT. Part IV. File System Administration Academic Year 08-09 DAI. Credit 1 (Single and Multiuser Operating Systems)"

Similar presentations


Ads by Google