JAVA SCRIPT

RH133. 6. FILE SYSTEM ADMINISTRATION



        CREATE A PARTITION
   
1.fdisk -l  -->identify harddisk identity
2.fdisk /dev/sda   -->open to create partiton
   m   display help   
   n   add a new partition  ->first give enter, then +500M OR 1G
   d   delete a partition
   l   list known partition types
   p   print the partition table
   q   quit without saving changes
   t   change a partition's system id
   w   write table to disk and exit

3.partprobe         ->update kernel about newly created partition

4. mkfs /dev/sda8         ->format partition using default(ext2)
5. mkdir /songs            -->create a dir to mount the partition
6. mount /dev/sda8 /songs  -->mount partiton on dir (temporary)
7. cd /songs               -->once mounted you can get into dir
8. touch aaa bbbb ccc ddd  -->create files under tht dir

9. vim /etc/fstab (without label)
/dev/sda8     /songs       ext2    defaults        1 2

10. mount -a  --> To check syntax of fstab
11. e2label /dev/sda8  -->check label of sda8 partition
12. e2label /dev/sda8 songs -->set label of sda8 partition

13  vim /etc/fstab (entries with label)
LABEL=/songs    /songs       ext2    defaults        1 2

14. mount -a

COMMANDS SHOWING INFO ABT HARDDISK

1.mount    ->shows dir where partitions are mounted + filesystype
2.df -h    ->shows use of partition
3.fdisk -l ->shows cylinders,id,partition
4.blkid    ->shows filesystem type and some more info
5.dumpe2fs  /dev/sdaX ->shows detailed info abt a partition
                        where X is a partition number

      TO CONVERT EXT2 TO EXT3

1. blkid  /dev/sda8
2.tune2fs -j /dev/sda8  -->add journal to ext2
3. blkid  /dev/sda8

       TO CONVERT EXT3 TO EXT2

1. umount /dev/sda8
2. tune2fs -O ^has_journal /dev/sda8  -->remove journal
3. mount /dev/sda8 /songs/
4. blkid /dev/sda8

        EXT3 =ext2 + journal
journal =When file system is checked using e2fsck program,
instead of checking entire file system checks only for latest
files/dir been added aftr the last e2fsck check.



    TO CREATE SWAP
a> Using Partiton

1.fdisk /dev/sda  -->create a partition and label as 82
2.partprobe       -->update kernel about newly created partition
3.mkswap /dev/sda9  -->create swap on /dev/sda9
4.free -m           -->size of swap
5.swapon /dev/sda9  -->enable swap
6.free -m           -->size of swap
7.swapoff /dev/sda9 -->disable swap
8.free -m           -->check size of swap

b> Using a Big file created by dd command
1. dd if=/dev/zero of=/var/swapfile bs=1 count=1G
   if ->input file of->output file bs->blocksize
2. df -h /var
3. free -m
4. mkswap /var/swapfile
5. swapon  /var/swapfile
6. free -m
/swapfile1 swap swap defaults 0 0

       

        NFS CLIENT
showmount -e 192.168.0.38  -->shows dir shared by remote/server

1. TEMPORARY MOUNTING
mount 192.168.0.38:/songs /media
cd /media/
ls
mount
cd
umount /media

2. PERMANENT MOUNTING

->vim /etc/fstab
  192.168.0.38:/songs   /media     nfs    defaults       1 2
->mount -a
->mount

3. AUTOMOUNTING

a> DIRECT MAPPING

1. vim /etc/auto.master
    /media      /etc/auto.media    -t 30  //umount in 30 sec
2. vim  /etc/auto.media
   abc  -fstype=nfs    192.168.0.37:/share (Put this line in above file
3. service autofs restart
4.  cd /media
5.  ls               Cant see the dir
6.  cd abc           when u directly get into tht dir abc gets created
7.  ls               can see contents of /share dir
8.  mount            can see /media/abc is mounted
If ur no more using the dir After 600 sec it automatically umounts.

b> INDIRECT MAPPING

1. vim /etc/auto.master
    /-      /etc/auto.direct  (put ths line in above file)
2. vim /etc/auto.direct
    /456 -fstype=nfs 192.168.0.37:/share  (put this line in above file)
3. service autofs restart
4. ls /
5. ls /456
6. mount

If you found this post useful, I would really love it, if you can Like the Page, or share it with your Facebook/Google+/Twitter Friends... It will keep me motivated. Thank you!

No comments:

Post a Comment