Session5 Theory

Embed Size (px)

Citation preview

  • 8/11/2019 Session5 Theory

    1/42

    ADVANTAGE PROChennais Premier Networking Training Centre

  • 8/11/2019 Session5 Theory

    2/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Partitioning

    In Linux, partitions can be created by either of the following three

    utilities

    fdisksfdisk

    disk druid (only available during installation)

    GNU parted

  • 8/11/2019 Session5 Theory

    3/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    fdisk

    fdisk

    - Fixed Disk

    - Menu driven programs to create and delete partitions

    Before starting fdisk, identify the hard disk type that is whether

    primary master or slave and secondary master or slave by using

    command fdisk -l.

  • 8/11/2019 Session5 Theory

    4/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Red Hat Linux Filesystems

    Red Hat supports following filesystems.

    - ext2

    - ext3

    - minux

    - reiserFS (under research)

  • 8/11/2019 Session5 Theory

    5/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    ext filesystems

    ext : Extended filesystem.

    ext2 : Older standard Linux file system supporting for filenames

    and large file sizes.

    ext3 : Standard Red Hat Linux file system, used for all hard disk

    volumes under Red Hat Linux by default.

    It is the extension of ext2 with the feature of journaling (aware ofunexpected power outages and disk errors)

  • 8/11/2019 Session5 Theory

    6/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    minux & reiserFS

    Minux : This file system is small , simple and mostly used for

    floppy disk .It support filenames up to 30 characters.

    ReiserFS : It is advanced journaling filesystem still under

    development for Linux.

    Its main difference between ext3 and reiserFS .Its use disk

    resource efficiently and is particularly effective with file system

    containing many small files and large directories

  • 8/11/2019 Session5 Theory

    7/42ADVANTAGE PROChennais Premier Networking Training Centre

    Creating file system

    Once you create a partition, you have to create a file system on it.

    To do this, use the mkfs command. To build the Linux file system

    and pass the name of the harddisk partition as a parameter.

    Syntax:

    mkfs -t

  • 8/11/2019 Session5 Theory

    8/42ADVANTAGE PROChennais Premier Networking Training Centre

    Creation of file system

    Current partitions are

    displayed here

  • 8/11/2019 Session5 Theory

    9/42ADVANTAGE PROChennais Premier Networking Training Centre

    `

    Hdb6,7and 8 are

    newly created

    partitions.

  • 8/11/2019 Session5 Theory

    10/42

  • 8/11/2019 Session5 Theory

    11/42ADVANTAGE PROChennais Premier Networking Training Centre

    To view the file system type

    Dumpe2fs : this command is used to view which file system we are

    using.

    Syntax :

    dumpe2fs

    Example:

    dumpe2fs /dev/hda1

  • 8/11/2019 Session5 Theory

    12/42ADVANTAGE PROChennais Premier Networking Training Centre

    To view the file system type

    It displays the file

    system

    information's.

    Sparse_superrepresents the

    ext2 file system.

  • 8/11/2019 Session5 Theory

    13/42

  • 8/11/2019 Session5 Theory

    14/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Tune2fs command

    tune2fs : It is a command used to converting from ext2 to ext3

    file system without un mounting..

    Syntax :

    tune2fs j

    Example

    tune2fs -j /dev/hda1

  • 8/11/2019 Session5 Theory

    15/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    View the file system type.

    Ext2 is the current file

    system for the device

    hdb6.

  • 8/11/2019 Session5 Theory

    16/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Repair Filesystem

    e2fsck : This command checks the consistency of the file system and

    repair it if it is damaged, you can use file system checking tools.

    Example : e2fsck /dev/hda1fsck : This command checks and repair a Linux file system.

    Example : fsck /dev/hda1

    The main difference is e2fsck it will work in ext2 and ext3 filesystem

    and fsck will work only in ext3 file system.

  • 8/11/2019 Session5 Theory

    17/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Repair Filesystem

    fsck and e2fsck are

    the command used to

    check and repair the

    file system.

  • 8/11/2019 Session5 Theory

    18/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Disk usage

    df and du are used to check the disk usage.

    df : It reports the amount of space used and available on a

    mount file system as reported.

    du : It displays directories entries and the number of data block

    assigned to them.

  • 8/11/2019 Session5 Theory

    19/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Performance tools

    free command lists the free ram memory and as well as what is used for

    buffers and swap memory.

    top command lists the most CPU intensive processes.

    Vmstat shows the performance of system components.

  • 8/11/2019 Session5 Theory

    20/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Some process start at boot time and continue running until thesystem is shutdown. Such process are known as daemon processes.

    Two types of daemon process:

    standalone daemon

    Transient daemon

    Daemon Process

  • 8/11/2019 Session5 Theory

    21/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Standalone daemon are a program that run all the time and are

    started up either directly by init or by a startup script under /etc/rc.d.

    Transient daemon are only started up when they are needed, and are

    controlled by a standalone daemon called xinetd.

    Daemon Process

  • 8/11/2019 Session5 Theory

    22/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    chkconfig command

    The chkconfig command can also be used to activate and deactivate

    services.

    The chkconfig --list command displays a list of system services and

    whether they are started (on) or stopped (off) in runlevels 0-6.

    At the end of the list is a section for the services managed by

    xinetd.

  • 8/11/2019 Session5 Theory

    23/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    chkconfig can also be used to configure a service to be started (or

    not) in a specific run level. For example, to turn httpd off inrunlevels 3, 4, and 5, use the following command:

    chkconfig --level 345 httpd off

    chkconfig command

  • 8/11/2019 Session5 Theory

    24/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Mount command

    Mount

    -Used to mount a file system

    -It takes two argument : the storage device and the

    mounting point.

    -The device is a special device file that connects the system

    to the hardware device.

    - Mounting point is directory on which the storage device is

    to be mounted.

  • 8/11/2019 Session5 Theory

    25/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Syntax:

    mount [options]

    Options:

    -w mount the file system with read/write permission.

    -r mount the file system with read permission.

    -t to specify the type of file system to be mounted.

    -a mounts all the file systems listed in /etc/fstab.

    Mount command

  • 8/11/2019 Session5 Theory

    26/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    umount command

    It un mounts the mounted file system.

    The removable media like floppy disk, and cd are un mounted

    after use, by using umount command.

    Syntax:

    umount

  • 8/11/2019 Session5 Theory

    27/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Mounting CD-ROM

    To mount the

    CDROM on the

    mounting point/mnt/cdrom

  • 8/11/2019 Session5 Theory

    28/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Mounting CD-ROM

    Now we can access the

    CDROM contents from

    the mounting point.

  • 8/11/2019 Session5 Theory

    29/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Unmounting cd-rom

    Unmount the

    CDROM after

    access

  • 8/11/2019 Session5 Theory

    30/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Unmounting cd-ROM

    To eject the

    CD from the

    CD Drive.

  • 8/11/2019 Session5 Theory

    31/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Mount /unmount floppy

    To mount the

    floppy on the

    mounting point/mnt/floppy.

    Unmount the

    floppy after

    access.

  • 8/11/2019 Session5 Theory

    32/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    File Compressions

    Several compression utilities are available for use on Linux and

    Unix system.

    But most software for Linux system use three compression

    utilities.

    1 - compress

    2 - GNU gzip

    3 - bzip2.

  • 8/11/2019 Session5 Theory

    33/42

  • 8/11/2019 Session5 Theory

    34/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Compression command

    This

    compresses

    the file a.

    The actual

    size of file is

    107 bytes.

    Thus the file size is

    compressed to 39

    bytes.

    The compressed file is

    indicated by the .z

    extension.

    This

    uncompressthe file a.

  • 8/11/2019 Session5 Theory

    35/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Compression with gzip

    gzip utility compresses file .

    gunzip decompresses them.

    To compress a file, enter the command gzip and the filename.this

    replace the file with compressed version of it,with the extension .gz.

    To decompresses a gzip file use command gunzip.

    Syntax:

    gzip filename (compression)

    gunzip filename.gz (decompression)

  • 8/11/2019 Session5 Theory

    36/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Compression with gzip

    The actual

    size of file is

    107 bytes.gzip command

    compresses the

    file a.

    The compressed file is

    indicated by the .gz

    extension.

    Thus the file size is

    compressed to 38bytes.

    Thisuncompress

    the file a.

    C i ith b i 2

  • 8/11/2019 Session5 Theory

    37/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    It compresses files using the burrows-wheeler block-sorting text

    compression algorithm and huffman coding.You compresses files using the bzip2 command and decompresses

    with bunzip2.

    The bzip2 command create a file with the extension .bz2

    Syntax:

    bzip2 filename (compression)

    bunzip2 filename.bz2 (decompression)

    Compression with bzip2

  • 8/11/2019 Session5 Theory

    38/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Compression with bzip2

    This

    uncompressthe file a .

    The actual

    size of file is

    107 bytes.bzip2 command

    compresses the file

    a.

    The compressed file is

    indicated by the .bz2

    extension.

    Thus the file size is

    compressed to 51

    bytes.

    i hi

  • 8/11/2019 Session5 Theory

    39/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Creating Archives

    Tar:

    tar command is used to create archives on device or files.

    Originally, tar was used to create archives on tape devices, hence

    its name stands for tape archive.When creating a file for a tar archive, the filename is usually

    given the extension .tar.

    While tar is seldom used to back up entire file system.

    S f d

  • 8/11/2019 Session5 Theory

    40/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    Syntax for tar command

    Syntax for tar command:

    tar [option] archivename.tar filenames- and-directories

    Options:

    c - create new archive.

    v - produce verbose message.

    f - archivename,a name of new file.

    x - archive will be extracted in the current directory.

    t - displays a list of file in the archive

    d

  • 8/11/2019 Session5 Theory

    41/42

    ADVANTAGE PROChennais Premier Networking Training Centre

    tar command

    tf options

    display all the

    file in backup .

    tvf options

    displays along

    with the userand group

    names.

  • 8/11/2019 Session5 Theory

    42/42