0% found this document useful (0 votes)
49 views6 pages

Disk Management Updated

The document provides a comprehensive guide on disk management in Linux, covering key concepts such as partitioning, formatting, and mounting. It details the use of commands like fdisk, mkfs, and LVM for managing disk partitions and logical volumes, including steps for creating, modifying, and deleting partitions. Additionally, it explains the creation and management of swap space and the process for permanent mounting of file systems.

Uploaded by

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

Disk Management Updated

The document provides a comprehensive guide on disk management in Linux, covering key concepts such as partitioning, formatting, and mounting. It details the use of commands like fdisk, mkfs, and LVM for managing disk partitions and logical volumes, including steps for creating, modifying, and deleting partitions. Additionally, it explains the creation and management of swap space and the process for permanent mounting of file systems.

Uploaded by

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

Disk Management

In Linux, disk management involves organizing and maintaining data on storage


devices, typically hard drives or SSDs. It's crucial for efficient space
utilization and data integrity. Key aspects include partitioning, formatting,
mounting, and checking disk space.

Q.What is Partition ?
--> Partition is a process of logically division of Block device for the purpouse
of fast performance and data Security

Q.What is Partition Schema ?


--> Partition Scema is a method, use to create partition on Block device for
example MBR,GPT, without partition we can't access Disk

Fdisk :- is a a command line tool, used to create,delete, modify Disk Partition,


fdisk only support MBR (legacy Bios)

step 1:- add hardisk in linux

#lsblk ----> for list block device,Example hardisk,pendrive

#fdisk /dev/sda ---> for select hardisk


m ---> for help
n ---> for create new partation
p ---> for select primary, if you want Extended you can select e the main
difference is in primary partation you can store OS and normal data but in extended
partation type you can't store os
partation number : 1 ---> set number
first sector : Enter ---->
last sector : +3G ----> for set 3 gib
p ----> for check partation
w ----> for save and exit
#lsblk

update kernal for add new partation Table

Q.What is kernal ?
---> kernal is a software available in every OS, main responsibility of kernal is
establish comunnication between hardware and software

#uname -r ----> for check kernal version or #hostnamectl

_____________________________________________________
update partation table for add new entry in kernal

#partprobe

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Step 2 :-
Q.What is File System ?
--> filesystem is a program or software helps to store, arrange and retrive data
from block device like pendrive,hardisk
step 2 :-
how to apply filesystem
#mkfs.ext4 /dev/sdb1 ----> for apply filesystem on partraion

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Step 3 :- How To permanent mount

#vim /etc/fstab

[Paratation Name] [folder name with location] [filesystem]


Backup Priority
/dev/sdc1 /root/sky ext4
defaults 0 0

:wq! ----> use to save and exit

#mount -a --> used to update entry of /etc/fstab file

#df -Th ----> used to check utilization of disk [ T use for check filesystem, h
use for human readable]

_____________________________________________________________________________

=============================

Q.What is Virtual Memory ?


___________________________________________________________

Q.what is SWAP (virtual Memory)?


--> if your ram is full and not able to store any files so the processor use
reserve location of hardisk for store data so that user can perform operation
without error , this reserve location is also called as a virtual memory or swap
memory.
__________________________________________________________

How to create swap partation


__________________________________________________________

Step 1:- create a partation

#lsblk ----> for check hard disk


#fdisk /dev/sdc ----> for select hard disk
m ---> for help
n ---> for create new partation
p ---> for select primary, if you want Extended you can select e the main
difference is in primary partation you can store OS and normal data but in extended
partation type you can't store os
partation number : 1 ---> set number
first sector : Enter ---->
last sector : +3G ----> for set 3 gib
p ----> for check partation
t ----> for apply type
hex code :- 82 -----> for swap
w ----> for save and exit
#lsblk ----> for verify partation
#partprobe
____________________________________________________________
format
#mkswap /dev/sdc1
_______________________________________________________________

for permanent mount

#vim /etc/fstab

[Paratation Name] [folder name with location] [filesystem]


Backup Priority
/dev/sdc1 swap swap
defaults 0 0
:Wq! ----> for save and exit

#mount -a ----> for update entry

#swapon or swapon -a ----> for on swap space

#swapon --show ----> for check swap space

#lsblk ----> for verify swap paratation


++++++++++++++++++++++++++++++++++++++++++++

How to Delete created Partition

+++++++++++++++++++++++++++++++++++++++++++++

step 1 :- unmount disk (disconnect partition and folder)

#vim /etc/fstab ----> remove entry


#mount -a ----> update file after remove entry of partition
#umount /dev/sda1 foldername ---> used to disconnect parttition and disk
#lsblk ---> for verify

step 2 :- fdisk /dev/sda -------> used to select disk


d ----> for delete partition
1 ----> select number
w ----> for save

#partprtobe ----> used to update , partition table

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

LVM (Logical Volume Management)


by using this feature user can combine multiple disk or volume and create a new
volume by using free space of disk or volume.

add new hardisk and create two partation [note :- for LVM lab minimum 2 partation
is mandatory]

******************************************************************
Step 1 :- add new 2 disk size of 3gb and 2gb

step 2 :- create a Physical Volume


[note :- physical volume means you can select volumes or disk for utilize free
space

#pvcreate /dev/sda /dev/sdb -----> for select disk


#pvdisplay ---->
for check created physical volume
#pvs ----> stands for physical volume show
__________________________________________________________________________________
step 3 :- create a Volume Group, means selected volumes add in group so that the
both partation combined and user can utilize fress space from both partaion
#vgcreate india /dev/sda /dev/sdb ----> for create volume group
#vgdisplay
-----> both commands are use for check created volume
group
#vgs
___________________________________
********************************************
Step 4 :- create logical Volume, this is very important step in lvm because in this
step create a new logical volume by using free space of volume or disks

#lvcreate -n mydisk -L +4G /dev/india ----> for create a logical


volume , -n means name, -L for define size
#lvdisplay [ note :- copy path of LV]
----------------> for check logical volume
#lvs
_______________________________________________________________________

Step 5:- apply file system


******************************
#mkfs.xfs /dev/india/mydisk
_________________________________________________________________________
step 6 :- mount/connect disk with folder

#mkdir sky
#mount /dev/india/mydisk sky ----> for connect sdb1 partation to sky foldr but
by using this command paration will temporary mount it means after reboot your
system disconnect folder and partaion

#umount /dev/india/mydisk sky ----> for unmount(Dissconnect) partation with


folder
________________________________________________________________
How To permanent mount
#vim /etc/fstab

[Paratation Name] [folder name with location] [filesystem] Backup


Priority
/dev/india/mydisk /root/sky xfs
defaults 0 0

#mount -a ----> for update entry of fstab file

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to extend size of LVM

syntax :- #lvextend <LV path> -L +<size>


Example : #lvextend /dev/groupname/lvname -L +2G

#xfs_growfs /dev/groupname/lvname ---> used to format extended part , this


command support only xfs file system

#resize2fs /dev/groupname/lvname ---> note :- if you format disk using another


file system like fat32,ext4 so this command use
____________________________________________________________________________

How to remove LVM

step 1 :- unmount disk (disconnect partition and folder)

#vim /etc/fstab ----> remove entry


#mount -a ----> update file after remove entry of partition
#umount /dev/group/lvmname foldername ---> used to disconnect parttition and
disk

#lsblk ---> for verify

step 2 :- Remove logical volume

#lvremove /dev/groupname/lvname

step 3 :- Remove Volume Group

#vgremove groupname

step 4 :- remove physical volume


#pvremove /dev/sdb /dev/sdc

step 5 :- lsblk ----> verify disk useing this command

You might also like