Wednesday 28 December 2011

FILESYSTEM MANAGEMENT

FILESYSTEM MANAGEMENT
Total maximum number of partitions supported by the kernel:
63 for IDE drives
15 for SCSI drives
PARTITION THE HARDDISK:
Quotas are enabled at the file system
Easy to backup and recovery
Separate partition improve performance of the system
The operating system can be upgraded or reinstalled with out
Having to restore the data from elsewhere.
CREATING A NEW PARTITION:
list known partition types
Creating an new partition type n
To change the partition Type (ID)
fdisk -l (or) sfdisk -l
fdisk /dev/sda
:m
d delete a partition
l
m print this menu
n add a new partition
p print the partition table
q quit without saving changes
t change a partition's system id
w write table to disk and exit
:n
firstcylinder size: < Default value>
last cylinder size: +M
Command (m for help): t
Partition number (1-12): 12
Hex code (type L to list codes):
:w
partprobe - inform the OS of partition table changes
sync - flush file system buffers
Formatting the file system
mkfs.ext3 /dev/sdaX
or
mke2fs -j /dev/sdaX
X is the partition number
Mount filesystem temporary
mount /dev/sdaX
Mount filesystem permanently
vi /etc/fstab
:wq
mount -a  Mount the filesystem just created and check for errors
mount
/dev/sdaX
/dir
ext3
defaults
00
TO REMOVE A PARTITION:
step 1: Remove entries in /etc/fstab
step 2: umount the file system
step 3: fdisk /dev/sda
umount /dev/sdX or < mount point>
:d
number of partition:X
:w
MOUNT and UMOUNT
Mount:
mount [-t fstype] [option] device mount_point
-t filesystem type
-o options
Ex: mount -t ext3 -o rw,acl /home
mount -o remount,rw /dev/sda6
Umount:
umount [options] device | mount_point
Ex: umount /dev/sda5 (or) /opt
MOUNT POINTS and /etc/fstab

/etc/fstab is referred each time the system boots to create the desired filesystem hierarchy.

During the system initialization, /etc/fstab is used to create the filesystem hierarchy.

It consists of six fields per line for each filesystem.
Syntax:
device
Ex:
Label=/new /new
device
mount_point  The path used to access the filesystem
FS_type
options
dump_freq
mount_point
FS_type
ext3
options
defaults
dump_freq
0
 The special device file name, or filesystem label of the device to mount
fsck_order
 The filesystem type
 A comma-seperated list of options
 Level 0 dump frequency:
0=never dump,
1=daily,
2=every other day.

0=ignore,
1=first (the root filesystem should have this value)
2-9=second, third, etc..

Filesystems that have the same number greater than 1 are checked in parallel

Network filesystems and CD-ROMs should be ignored.
mount -a  Used to mount all the filesystems listed in /etc/fstab
E2LABEL
e2label – Change or View the label on an ext2/ext3 filesystem
To view the label
To change or create label
For a partition:
e2label /dev/sdaX
For all the partitions:
blkid
e2label /dev/sdaX
MOUNTING NFS RESOURCES

To check which directory is exported
showmount -e

Mount the shared directory to your local file system temporary
Syntax:
mount :
Ex:
mount server1.example.com:/var/ftp/pub /mnt

Mount the shared directory to your local file system permanently
Enter the following in /etc/fstab
Ex:
192.168.0.254:/var/ftp/pub
/opt
nfs
defaults
0
MOUNTING SMB RESOURCES
From Linux
smbclient //192.168.0.x/sharename -U Admin
mount -t cifs //192.168.0.x/sharename /opt -o username=john
From Directories shared in Windows
mount -t cifs //192.168.0.x/sharename /opt -o username=Administrator
CREATING A SWAP PARTITION:
create a partition with partition id 82
partprobe | sync
mkswap /dev/sdaX
swapon /dev/sdaX
cat /proc/swaps
or
swapon -s
 to format swap partition
 to enable swap
 to view swap status
To enable swap permanently
vim /etc/fstab
/dev/sdaX
swap
swap
defaults
00
CREATING A SWAP FILE:
dd if=/dev/zero of=/swapfile bs=1024k count=X
where X is the count that is depends on the size of RAM used. Usually 1.5 to 2 times of RAM size is
allocated to swap partition.
To enable swap permanently
vim /etc/fstab
/swapfile
swap
swap
defaults
00
FILE SYSTEM MAINTENANCE
tune2fs - adjust tunable file system parameters on ext2/ext3 file systems
- it is used to convert the ext2 file system to ext3 with out data loss
dumpe2fs - dump ext2/ext3 file system information
dumpe2fs /dev/sdaX
==> displays file system info

No comments:

Post a Comment