We can divide a single hard drive into many logical drives (like Partition 1, Partition 2 etc.) that is called partition.
It
is logical blocks on a drive you can treated as an independent disk. A
partition table is an index that relates sections of the hard drive to
partitions.
Disk Partitioning Criteria:
MBR = MASTER BOOT RECORD
P= PRIMARY PARTITION
EXTENDED= EXTENDED PARTITION
L= LOGICAL PARTITION
FREE= FREE SPACE
P= PRIMARY PARTITION
EXTENDED= EXTENDED PARTITION
L= LOGICAL PARTITION
FREE= FREE SPACE
We can divided disk into only 3 Primary Partitions.Primary Partition is a usually holds the operating system.
Extended Partition is a special type of primary partition We can be divided into multiple logical partitions. We have only 3 primary partitions per disk, and if the user is required to make further partitions there are the space remaining on the disk so user can be allocated to extended partition and user can used it create the logical partitions later.
How Can Disk Identification
Different type of disks in Linux
IDE drive will be shown as /dev/hda
SCSI drive will be shown as /dev/sda
Virtual drive will be shown as /dev/vda
IDE drive will be shown as /dev/hda
SCSI drive will be shown as /dev/sda
Virtual drive will be shown as /dev/vda
Types of file systems used in Linux:
The file systems supported in Linux O.S .We have ext2, ext3, xfs ,ext4, vfat in RHEL etc.Ext file system is the widely used file system in Linux.
vfat is the file system to maintain a common storage windows .
Mounting Point in Linux:
(a) /etc/mtab:- is a file which stores the information of all the currently mounted file. it is dynamic and keeps changing.(b)/etc/fstab is the file which is keeps information about the permanent mount point so that it will be mounted even after reboot .
HOW TO CREATE FILE SYSTEM IN LINUX
Check partition using in linux :
root@server~#fdisk –l or parted –l
Partition using fdisk
root@server~#fdisk <disk name>root@server~#fdisk /dev/sda
Use n to create a new partition using n and show list using p.
root@server~#fdisk /dev/sda (ENTER)
PRESS n
first cylinder select (Primary Partition)
second cylinder pass size +100G (Give Size)
command( m for help) p (Show list)
Deleting a partition:-
Use d to delete a partition
Use d to delete a partition
command( m for help) d
partition no : 2 ( you want to delete choose)
Saving the partition changes:-
USE w to save changes
command( m for help) : w
Lab Task :-
# fdisk -l
root@server~# fdisk /dev/sda
Command (m for help) : n
(type n for new partition)
(p - primary) or e - extended) : p
(type p for primary partition or type e for extended partition)
First cylinder : (press Enter for default first cylinder n Last cylinder : + <size in KB/MB/GB/TB>
Command (m for help) : t
(type t to change the partition id)
(for example: 8e for Linux LVM, 82 for Linux Swap and 83 for Linux normal partition)
Command (m for help) : w
(type w tosave the changes into the disk)
root@server~# partprobe /partx -a/dir1 /dev/sda1
(to update the partitioning information in partition table)
root@server~# fdisk /dev/sda
Command (m for help) : n
(type n for new partition)
(p - primary) or e - extended) : p
(type p for primary partition or type e for extended partition)
First cylinder : (press Enter for default first cylinder n Last cylinder : + <size in KB/MB/GB/TB>
Command (m for help) : t
(type t to change the partition id)
(for example: 8e for Linux LVM, 82 for Linux Swap and 83 for Linux normal partition)
Command (m for help) : w
(type w tosave the changes into the disk)
root@server~# partprobe /partx -a/dir1 /dev/sda1
(to update the partitioning information in partition table)
Mounting a partition
Mounting is a procedure where we attach a directory to the file system.There are two types of
Temporary Mounting
A temporary mount point we will create a directory and mount it, but this mount point will last only till the system is up, once it is rebooted the mounting will be lost. root@server#mount /dev/sda1 /dir1
Unmount Partition:
root@server#umount <mount point directory>
root@server#umount /dir1
verify it with mount command.
root@server#umount <mount point directory>
root@server#umount /dir1
verify it with mount command.
Permanent Mounting
We can permanent mount the file system,but we have to update all details in this file /etc/fstab , after mounted file system we have to reboot the system.Steps To make a permanent mount point:
root@server~
root@server~
root@server~root@server~
How to see the size of the file or directory?
root@server~# du -h
(to see all the file sizes which are located in the present working directory)
To see the biggest files from current location)
root@server~# du .| sort -nr | head -n10
To see the biggest directoriesroot@server~# du -s * | sort -nr | head -n10
Assigning label to the partition:root@server~# du -h
(to see all the file sizes which are located in the present working directory)To see the biggest files from current location)
root@server~# du .| sort -nr | head -n10
To see the biggest directoriesroot@server~# du -s * | sort -nr | head -n10
Assigning the label is giving some name to the partition. To assign label to the partition e2label
command is used
Syntax
root@server#e2label <partition name> <label>
root@server#e2label /dev/sda7 ktdisk
To check the label
root@server#e2label /dev/sda7
command is used
Syntax
root@server#e2label <partition name> <label>
root@server#e2label /dev/sda7 ktdisk
To check the label
root@server#e2label /dev/sda7
No comments:
Post a Comment