Friday, January 1, 2021

HOW TO CREATE PARTITION AND MOUNT

 [root@dev ~]# fdisk /dev/sdb 

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended

Partition number (1-4, default 1): 1
First sector (2048-16777215, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215): +2048M   
Partition 1 of type Linux and of size 2 GiB is set

Command (m for help): w
The partition table has been altered!

[root@dev ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)

Temporary mount
[root@dev ~]# mount /dev/sdb1 linux
[root@dev ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   60G  0 disk
├─sda1            8:1    0    1G  0 part
└─sda2            8:2    0   59G  0 part
  ├─centos-root 253:0    0   37G  0 lvm  /
  ├─centos-swap 253:1    0  3.9G  0 lvm  [SWAP]
  └─centos-home 253:2    0 18.1G  0 lvm  
sdb               8:16   0    8G  0 disk
└─sdb1            8:17   0    2G  0 part /root/linux


No comments:

Post a Comment