0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
22 Ansichten4 Seiten
The document discusses disk management and partitioning in Linux. It explains that a system can have up to 4 primary partitions, and one extended partition which can be further divided into logical partitions. It provides details on creating, deleting, and formatting different types of partitions including primary, extended, logical and swap partitions using fdisk and mkfs utilities. Commands to mount and edit fstab file for various partitions are also demonstrated.
The document discusses disk management and partitioning in Linux. It explains that a system can have up to 4 primary partitions, and one extended partition which can be further divided into logical partitions. It provides details on creating, deleting, and formatting different types of partitions including primary, extended, logical and swap partitions using fdisk and mkfs utilities. Commands to mount and edit fstab file for various partitions are also demonstrated.
The document discusses disk management and partitioning in Linux. It explains that a system can have up to 4 primary partitions, and one extended partition which can be further divided into logical partitions. It provides details on creating, deleting, and formatting different types of partitions including primary, extended, logical and swap partitions using fdisk and mkfs utilities. Commands to mount and edit fstab file for various partitions are also demonstrated.
We can create maximum 4 physical partitions on the system. Types of physical partition: - 1. Primary partition (we can create maximum 4 primary partitions) 2. Extended partition (we can create maximum 1 extended partition)
NOTE: - If we have 4 Primary partitions = in this case we cant create any extended partition.
If we have 3 Primary partitions = in this case we can create an extended partition.
If we have 2 Primary partitions = in this case we can create an extended partition.
If we have 1 Primary partitions = in this case we can create an extended partition.
Hard Disk Drives are shown using different file names such as;
IDE/PATA Hard Disk is shown as /dev/hda IDE Hard Disk 0 = /dev/hda IDE Hard Disk 1 = /dev/hdb
SATA Hard Disk is shown as /dev/sda SATA Hard Disk 0 = /dev/sda SATA Hard Disk 1 = /dev/sdb
NOTE: - USB storage is also shown as /dev/sda or /dev/sdb How to create primary partitions: -
#Fdisk l [to display available partitions] #Fdisk /dev/sda [to create or delete partitions]
Press n to create a new partition Press d to delete a partition Press p to print partition table Press t to change partition id Press q to quit without saving Press w to save and quit.
Press n to create a new partition
Select e for extended partition Select p for primary partition Press p to create a primary partition Type partion no (1-4): press 3
First cylinder size :( end value of available partition or skip using enter key) Last cylinder size: +5G Press w for save and quit [reboot the system to update the Kernel partition table] 2 DISK MANAGEMENT BY DIPAK SINGH
How to create extended partitions: -
#Fdisk l [to display available partitions] #Fdisk /dev/sda [to create or delete partitions] Press n to create a new partition Press d to delete a partition Press p to print partition table Press t to change partition id Press q to quit without saving Press w to save and quit.
Press n to create a new partition
Select e for extended partition Select p for primary partition Press e to create an extended partition Type partion no (1-4): press 4
First cylinder size :( end value of available partition or skip using enter key) Last cylinder size: +5G Press w for save and quit [reboot the system to update the Kernel partition table]
How to delete primary/extended partitions: -
#Fdisk l [to display available partitions] #Fdisk /dev/sda [to create or delete partitions] Press d to delete a partition Type partion no (1-4): press 4 Press w for save and quit, you must reboot the machine
How to create logical partitions: -
#Fdisk l #Fdisk /dev/sda
Press n for new partition
Select l for logical partition Select p for primary partition
Press l to create a logical partition
First cylinder size :( end value of available last partition or skip using enter key) Last cylinder size: +1G 3 DISK MANAGEMENT BY DIPAK SINGH
Press w for save and quit [reboot the system to update the Kernel partition table]
#mkfs.ext4 /dev/sda5 [to format the current partition] #mkdir /data #mount /dev/sda5 /data [to mount the partition over any particular directory
#Vim /etc/fstab [to edit into partition table] /dev/sda5 /data ext4 defaults 0 0 :wq! #mount a #df -hT /dev/sda5 [to display information about any particular partition free space etc]
How to delete logical partitions: -
#umount /data #vim /etc/fstab /dev/sda5 /data ext4 defaults 0 0 [delete this entry] Remove the entry of partition from /etc/fstab which you want to delete. :wq (saveand quit) :#rm -rf /data #Fdisk l [to display available partitions] #Fdisk /dev/sda [to create or delete partitions] Press d to delete a partition Type partion no (1-5): press 5 Press w for save and quit [reboot the system to update the Kernel partition table]
How to create swap partition: -
#Fdisk l #Fdisk /dev/sda Press n for new partition Press l for logical partition First cylinder size :( end value of available partition or skip using enter key) Last cylinder size: +512M Press t for change type Type partition no: (1-6) = 6 Hexa-code: 82 Press w for save and you must reboot the machine
#mkswap /dev/sda6 #swapon /dev/sda6 #vim /etc/fstab /dev/sda6 swap swap default s 0 0 :wq! #free m or #swapon -s [to display swap partitions]
4 DISK MANAGEMENT BY DIPAK SINGH
How to create swap in GUI Environment: - #yum install gnome-disk-utility* Application System-Tools Disk-Utility Select free space [Create partition] Specify size #mkswap /dev/sda7 #swapon /dev/sda7 #vim /etc/fstab /dev/sda7 swap swap default s 0 0 :wq! #free m or #swapon -s [to display swap partitions]
How to delete swap partition: -
#vim /etc/fstab /dev/sda6 swap swap defaults 0 0 [delete this entry] Remove the entry of partition from /etc/fstab which you want to delete. :wq (saveand quit)
#Fdisk l [to display available partitions] #Fdisk /dev/sda [to create or delete partitions] Press d to delete a partition Type partion no (1-6): press 6 Press w for save and quit [reboot the system to update the Kernel partition table]