Saturday, December 19, 2009

File System

File System is a format, how information is stored as files and directories

Different Partition Types
  1. ext2   The standard Linux file system 
  2. ext3   The standard Linux file system with journaling added 
  3. vfat   Microsoft's Fat32 file system 
  4. LVM   Logical Volume Manager
  5. Swap Partition  Virtual Memory (Twice size of RAM)
Note
5 or f –extended partition
82 – Linux swap
83 – Linux
8e – Linux LVM

Steps to add new filesystems
Identify device -> partition device -> make filesytem -> label filesytem -> entry in fstabl -> mount it

Commands for managing partitions
# fdisk
To save partition table
# partprobe
To create filesytem
# mkfs.ext2 
# mkfs.ext3 
an alternate way to refer to devices (e.g. e2label /dev/hda3 dbdisk)
# e2label
Mount the filesystem
# mount LABEL=dbdisk /mnt/data
To set filesytem paramenters like acl, reserved blocks, fsck frequency 
# tune2fs
check and repair filesystem
# fsck filesystem

Steps to create filesystem
  • fdisk device_name - to create a partition
  • mke2fs –j partition – to create a filesystem
  • fsck –f partition – to verify any errors in filesystem
  • mount device_name mount_point – mount the created filesystem to a directory
  • Add a entry in /etc/fstab file to mount after reboot

fstab
/etc/fstab contains all mount points and contains
Device, mount_point, fs_type, options(ACL, quota), dump_freq, fsck_order

Mount
mount –a – mount all filesystem
mount –t vfstype
options like rw, suid, exec, acl

Unmount
umount [options] device|mount_point
remount option to change mounted filesytem options like readonly
fuser file|filesystem displays pid of process using filesystem

Label a Linux Partition
Display current label
# e2label /dev/sda1

Display the labels of all mounted filesystems
# mount -l

Set a new label
# e2label /dev/sdb2 usbstroage
or
# tune2fs -L usbstroage /dev/sdb2

No comments:

Post a Comment