Manage partition system and how to handle the some serious scenario’s

How to create a partition in Linux

Step 1

First,  We need to check Disk available , Run the below command

~lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 9G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 8G 0 part
├─cl-root 253:0 0 7.1G 0 lvm /
└─cl-swap 253:1 0 924M 0 lvm [SWAP]
vdb 252:16 0 20G 0 disk
vdc 252:32 0 10G 0 disk
└─vdc1 252:33 0 4.7G 0 part
└─vg002-002 253:2 0 8G 0 lvm /home/chirag/moun
vdd 252:48 0 10G 0 disk
└─vdd1 252:49 0 7.5G 0 part
└─vg002-002 253:2 0 8G 0 lvm /home/chirag/moun

Step 2

To select and start working on partition (vdb)

parted /dev/vdb

Step 3

Now we need to create MBR table to start working on disk ( Parition table)

What is MBR Master Boot Record (MBR) - CLICK HERE
mklabel
print free

It will look like this

GNU Parted 3.1
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
32.3kB 21.5GB 21.5GB Free Space



Step 4

Create primary partition

(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext4
Start? 32.2kb
End? 4gb

quit

[root@localhost techouse]# mkfs.ext4 /dev/vdb1

mount -t ext4 /dev/vdb1 /test
Edit fstab file
vim /etc/fstab
/dev/sdax /media/user/label ext4 defaults 0 0

lsblk

Manage partition system and how to handle the some serious scenario's 1

techouse

I love helping beautiful people like you. I love hanging out with my dogs.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

× How can I help you?