0% found this document useful (0 votes)
2 views19 pages

Disk Partitioning

This document provides an overview of disk partitioning, including the use of utilities like fdisk and parted for managing disk partitions. It outlines the steps for creating partitions, verifying them, and using Logical Volume Manager (LVM) for advanced partition management. Additionally, it details commands for LVM operations and installation procedures.

Uploaded by

emanrajput871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views19 pages

Disk Partitioning

This document provides an overview of disk partitioning, including the use of utilities like fdisk and parted for managing disk partitions. It outlines the steps for creating partitions, verifying them, and using Logical Volume Manager (LVM) for advanced partition management. Additionally, it details commands for LVM operations and installation procedures.

Uploaded by

emanrajput871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

CHAPTER

3 – DISK
PARTITIO
1

NING
BASIC PARTITIONING
 Working with disks is an important part of maintaining storage
space
 Partitions determine how your storage space is carved out for
use later by the system and its users.

 Two different utilities when partitioning disks:


 fdisk Disk-partitioning utility
 parted Another disk-partitioning utility

2
BASIC PARTITIONING
 The /proc file system is created by the kernel when the system boots and
holds current information about the system.
 To view information about the current partition layout, use the following
command:
 # cat /proc/partitions | grep sd

The first two letters represent whether the disk is a SCSI (sd) or
IDE (hd) disk.
The third letter represents which disk it actually is.
If there is a number after the three letters, it is the number of
the partition.
3
FDISK COMMAND
 Syntax: fdisk [options] [device]
 Options
 -b Specifies the sector size of the disk
 -h Specifies the number of heads on the disk
 -l Lists current partition tables

4
PARTED COMMANDS
 Syntax: parted [options] [device [command]]
 Options
 -l Lists all partition tables detected
 -s Never prompts for interaction (useful for scripting)

5
CREATING A PARTITION
 Step 1. Choose the disk:
 # fdisk /dev/sdb
 Step 2. View all the options available to you:
 Command (m for help): m

 Step 3. Use the p command to print out the current


partition table (this shouldn’t exist, but just verify):
 Command (m for help): p

6
CREATING A PARTITION
 Step 4: Create a new partition:
 Command (m for help): n
 Command action
 e extended
 p primary partition (1-4)
p
 Partition number (1-4): 1
 First cylinder (1-1044, default 1):
 Using default value 1
 Last cylinder or +size or +sizeM or +sizeK (1-1044, default
1044): +4294M
7
CREATING SECOND
PARTITION
 Step 5: Create a new partition:
 Command (m for help): n
 Command action
 e extended
 p primary partition (1-4)
p
 Partition number (1-4): 2
 First cylinder (1-1044, default 1):
 Using default value 1
 Last cylinder or +size or +sizeM or +sizeK (1-1044, default
1044): +4294M
8
CREATING A PARTITION
 Step 6. Verify your newly created partitions:
 Command (m for help): p

 Step 7. Write the changes to disk:


 Command (m for help): w
 The partition table has been altered!
 Calling ioctl() to re-read partition table.
 Syncing disks.

9
INFORMATION TO KERNEL
 To make sure that it recognizes all disks and partitions correctly.
To do this, you use the partprobe command.
 Syntax: partprobe [OPTIONS] [DEVICE]
 Options:
 -d Does not actually inform the operating system
 -s Prints a summary of contents
 Step 8. Call the partprobe command:
# partprobe /dev/sdb
This command has no output to it.
 Step 9. Verify the partition creation one last time:
 # fdisk -l
10
PARTED COMMAND
 Step 1. Start the parted utility the same way you used fdisk:
 # parted /dev/sdc

 Step 2. Use parted, like fdisk, through a menu interface using


subcommands:
 (parted) help

 Step 3. Create your first partition in a similar manner to fdisk:


 (parted) mkpart
 Partition type? primary/extended? primary
 File system type? [ext2]? ext4
 Start? 0
 End? 4294m
11
LVM is a form of advanced partition
management

The benefit to using LVM is ease of


management due to the way disks
LOGICAL are set up
VOLUME
MANAGER
Working with LVM, however, is one
of the more complex topics to
understand the first time you deal
with it
12
LVM STRUCTURE

13
LVM COMMANDS
 pvs Displays physical volumes
 vgs Displays volume groups
 lvs Displays logical volumes
 pvdisplay Displays detailed information on physical volumes
 vgdisplay Displays detailed information on volume groups
 lvdisplay Displays detailed information on logical volumes
 pvcreate Creates a new physical volume
 vgcreate Creates a new volume group
 lvcreate Creates a new logical volume
 vgextend Extends an existing volume group
14
LVM COMMANDS
 lvextend Extends a logical volume
 lvresize Resizes a logical volume
 lvreduce Reduces a logical volume
 lvrename Renames a logical volume
 pvmove Moves/migrates data from one physical volume to
another
 vgreduce Reduces a volume group
 pvremove Removes a physical volume
 vgremove Removes a volume group
 lvremove Removes a logical volume
15
LVM INSTALLATION
 Step 1. Install the required packages:
 # yum install -y lvm2

 Step 2. Verify that it is installed:


 # rpm -qa | grep lvm

 lvm2-libs-2.02.72-8.el6.x86_64
 lvm2-2.02.72-8.el6.x86_64

16
LVM LAYERS
 /etc/lvm (directory)
 contains all the information about each layer of the LVM
structure

Physical extents
Dealing with volume groups
Logical extents
Dealing with logical volumes. The logical
extents always map back to a physical extent
17
CREATING AN LVM
PARTITION
 Step 1. To initialize the disk, use the pvcreate command:
 # pvcreate /dev/sdb

Physical volume “/dev/sdb” successfully created


 Step 2. Verify that the physical volume was created successfully:
 # pvdisplay /dev/sdb

 Step 3. To create the volume group, use the vgcreate command:


 # vgcreate vg_group01 /dev/sdb
Volume group “vg_group01” successfully created

 Step 4. Verify that the volume group was created successfully:


 # vgdisplay -v VolGroup01

18
 Badblock -ws /dev/sda

 MBR
 GPT (GUI Partition Tabel ) up to 128 partition
partprob command
 Cat proc/partition

19

You might also like