Disk Management In Linux

0 comments

Disk Management will contribute more topics than any other in RHCE 133 paper, its a vast subject to discuess. From today up to some days I will be posting topics on disk management, so stay tuned you linux learners.

Linux OS will consider every thing as files even hardware too, for example if there is one hard disk in a Linux system then it is represented as hda(harddisk "A") under /dev folder

For example if we have 2 Hard disks then the representation is like below
/dev/hda
/dev/hdb
Where /dev/hda is primary master HDD and /dev/hdb is primary slave HDD

If we want to represent floppy drive then the representation is as below
/dev/fd0

If we want to represent second floppy drive then the representation is
/dev/fd1

If we want to represent cdrom
/dev/cdrom

If we want to represent DVD-writer
/dev/dvdwriter

If we want to represent special devices such as SATA,USB-mass storage etc then the representations are as below
/dev/sda
/dev/sdb
/dev/sdc till up to /dev/sdz

Suppose if we ant to represent partitions on HDD it goes as below
/dev/hda0 for first partition in primary master HDD
/dev/hda1 for second partition in primary slave HDD
/dev/sdd5 for forth partition in special device 4

For more number of devices see this http://docs.google.com/Doc?id=dggtw8pr_1604gz89zmg4

Before creating any partitions we should remember the following things.
a.
Check for what purpose we want to create the partitions(for example for creating swap)
b. Check weather any free space left by using fdisk -l command

So if there is any free space then we can directly create partitions

step1 : Check there is any free space or not
#fdisk -l
Disk /dev/hda: 20.0 GB, 20060651520 bytes255 heads, 63 sectors/track, 2438 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/hda1 1 1024 8225248+ b W95 FAT32/dev/hda2 * 1025 2438 11357955 c W95 FAT32 (LBA)Disk /dev/hdb: 80.0 GB, 80060424192 bytes255 heads, 63 sectors/track, 9733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/hdb1 * 1 2432 19535008+ 83 Linux/dev/hdb2 2433 2554 979965 82 Linux swap / Solaris/dev/hdb3 2555 6202 29302560 83 Linux/dev/hdb4 6203 9733 28362757+ 5 Extended/dev/hdb5 6203 9733 28362726 83 Linux

fdisk is a command which will show all the disks present in the system weather it is partition or free space. From the above out put we can clearly know that the system is having 2 harddisks one with 20GB and the other with 80GB(with red mark). This is an interview question how to find Harddisk size in linux.

Step2 : Use fdisk command on the disk in order to create the partitions
#fdisk /dev/hda

Here it will show full details of /dev/hda Disk /dev/hdb: 80.0 GB, 80060424192 bytes255 heads, 63 sectors/track, 9733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/hdb1 * 1 2432 19535008+ 83 Linux/dev/hdb2 2433 2554 979965 82 Linux swap / Solaris/dev/hdb3 2555 6202 29302560 83 Linux/dev/hdb4 6203 9733 28362757+ 5 Extended/dev/hdb5 6203 9733 28362726 83 Linuxcommand (m for help):

So press m to explore your self .

Step3 : Creating new partition.

Press n with out quote to create new partition. So specify your size in prbytes/kb/mb with + preseeding to the value suppose if you want to create a new partition of 23mb you have to say +23MB then press enter

One more example create a new partion of 538kb? thinking????????? still thinking?????? yes you are right it is +538KB

Step4 : So what next? Suppose you donot want to create this partition so delete it. At this point the partition table changes are not updated to partition table to do this one just type q.

Step5 : Updating the created partition to partition table just press w with out quotes thats it you are almost done.

Step6 : So you have updated the changes to partition table then you have to say this change to Kernel so for doing that there are two ways

A. Just restart the system(so you are thinking this is easiest way ha? never do this on live servers because you have to give 99.999% uptime to your servers. so always do second way.

B. Just execute partprob command this will update the partition table changes to kernel #partprob /dev/hda

  • Like the post? Please Subscribe to free RSS feed to get updates
  • TFTP Implementaion In Linux

    0 comments

    TFTP server is an important service for Network engineers, because they will be using this TFTP server for coping big IOS(Inter networking Operating System)files to routers, So as a Linux administrators we have to install and configure tftp server.

    So why these network guys uses TFTP server for coping IOS images? why not ftp, scp, rcp etc?
    Ans : Because TFTP user use UDP protocal for sending data, so its bit faster due to its unrelaiable way of sending data. So in early days one a serial port is connected between router and server so the data transmission is very slow, so they started using TFTP server as file server to copy images.

    Here are the steps to configure TFTP server

    Step1 :
    Install TFTP server

    #yum install tftp-server
    or
    #rpm -ivh tftp-server*

    Here we have to make a note that TFTP, telnet, rsync, talk services are run under one single service Xinted.

    Step2 : Configuring tfpt server

    #cd /etc/xinetd.d
    #vi tftp

    Edit the tftp configuration file as follows, save it and exit.
    [root@test xinetd.d]# vi tftp
    # default: off
    # description: The tftp server serves files using the trivial file transfer \
    # protocol. The tftp protocol is often used to boot diskless \
    # workstations, download configuration files to network-aware printers, \
    # and to start the installation process for some operating systems.
    service tftp
    {
    socket_type = dgram
    protocol = udp
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -s /tftpboot
    disable = no
    per_source = 11
    cps = 100 2
    flags = IPv4
    }

    In the above file what we have specified was please use protocol as UDP and server command, then tftp dump location(/tftpboot), its like ftp server dump(/var/ftp/pub)location then disable=no means TFTP service should be enabled other things no need to edit.

    Step3 : Give full permissions to
    /tftpboot

    #chmod 777 /tftpboot

    Step4 : Restart the xinetd serive, so that the tftp server configs will be updated

    #service xinetd restart

    Step5 : Permanently on Xinetd service

    #chkconfig xinetd on

  • Like the post? Please Subscribe to free RSS feed to get updates
  • RPM Package Management-II (Checkinstall)

    0 comments

    Part2 :

    So coming to advanced RPM management here I am going to discuss how to convert .tar.gz/.tar.bz2 files,src.rpm files to rpm packages? So that its very much easy to install the packages by using rpm command.

    New releases of Linux programs are generally released in the tar.gz format consisting of source code of the application. Normally you will compile these programs but at times they throw some compiler errors on your screen which just seem gibberish to a novice. A much easier way to install programs is when they are in the RPM package format. Here’s a simple guide that will help you convert those source code files (tar.gz) into RPM packages.

    To do this, first of all install the package checkinstall from your Linux dvd. If it doesn’t exist then you can Google for it and download it. Then unpack your source package diand cd to the directory. Where you unpacked the tar.gz file.

    Step1 : Run the following two commands:

    ./configure make But now instead of running make install you run checkinstall. Answer the questions, edit some values if they are not appropriate and let the program run. When finished, you’ll find your RPM package in /usr/src/packages/RPMS/i686 your .rpm file is ready for future use.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page

     

    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here