Connect with us

Hi, what are you looking for?

Linux

Linux Disc Partitioning on CentOS 7

Linux Basic and Advanced Disc Partitioning for CentOS / RHEL 7/6

View Disk Information

To view available free space of a disk
[root@techbrown.com]# hwbrowser &
To view the free space in a partition
[root@techbrown.com]# df –h
To view the total amount of used space in a partition / directory
[root@techbrown.com]# du –sh
To know the block size of a partition
[root@techbrown.com]# blockdev –getbsz <partition>

Label

To assign label to a partition
[root@techbrown.com]# e2label <partition> <label name>
To view the existing labels
[root@techbrown.com]# e2label <partition>
To see a mounted partition with its label
[root@techbrown.com]# mount –l

Swap Partition

Create a new Partition
[root@techbrown.com]# fdisk <device>
Format the partition as swap
[root@techbrown.com]# mkswap <partition>
Turn on Swap
[root@techbrown.com]# swapon <partition>
Check the status of swap used
[root@techbrown.com]# swapon –s <partition>
Turn off swap
[root@techbrown.com]# swapoff <partition>

Mounting a Partition Permanently

To mount a partition Permanently
[root@techbrown.com]# vl /etc/fstab

Mounting Removable Devices

To mount cdrom drive
[root@techbrown.com]# mount /dev/cdrom mnt
To mount a pen drive
[root@techbrown.com]# mount /dev sda1 /mnt

What is Logical Volume Manager (LVM)?

  • LVM is a method of allocating hard drive space into logical volumes that can be easily resized.
  • With LVM, the hard drive or set of hard drives is allocated to one or more physical volumes.
  • The physical volumes are then combined into volumes groups.
  • Each volumes group is divided into logical volumes, which are formatted with a file system like ext3 and are then mounted.

Creating Partitions

Make Multiple Partitions
[root@techbrown.com]# fdisk <device>
Update the partition table
[root@techbrown.com]# partprobe <device>

Physical Volume

Create a physical volume from the previously created partitions
[root@techbrown.com]# pvcreate <partition1> <partition2> <partition3>
To see the physical volume details
[root@techbrown.com]# pvdisplay |less

Volume Group

Create a volume group
[root@techbrown.com]# vgcreate <volume group name> <physical volume 1> <physical volume 2>
To see the volume group details
[root@techbrown.com]# vgdisplay <volume group name>

Logical volume

Create logical volume
[root@techbrown.com]# lvcreate –L <size> <volume group name> -n <volume name>
Format the logical volume
[root@techbrown.com]# mkfs.ext3 < volume name>
Create a mount point
[root@techbrown.com]# mkdir <directory name>
Mounting a logical volume
[root@techbrown.com]# mount <volume name > <mount point>
Re-sizing a logical volume
[root@techbrown.com]# lvresize –L <+sizeM> <logical volume name>
To update the re-sized logical volume
[root@techbrown.com]# resize2fs <logical volume name>
Removing logical volume
[root@techbrown.com]# lvremove <logical volume name>
Extending the size of a volume group
[root@techbrown.com]#vgextend <volume group name ><physical volume name>

Congratulations now you have created and managed the basic and advanced partitioning.

Comments
Advertisement
Advertisement

Linux

DNF stands Dandified YUM and this is the default package manager for RHEL 8 / CentOS 8.  This tutorial explains you how to create...

Linux

If you forget a root password of your RHEL 8 and CentOS 8 and want to reset the password so that the RHEL 8...

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Linux

How to Upgrade WordPress Server from Ubuntu 16.04 to Ubuntu 18.04. Right now, Ubuntu 18.04 has been released with tons of new features. Upgrading...

Linux

How to Enable TLS 1.3 on Nginx Web Server. Nginx is a ultra fast web server optimized for modern web applications and servers. TLS...

Advertisement

You May Also Like

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Windows

How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...

Windows

Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...

Windows

How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...