Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How will format newly added disk into linux? Explain with command

user-image
Question ajoutée par Muhammad Anzar , DevOps/DevSecOps Architect , Confidential
Date de publication: 2015/04/02
Abu Nur Muhammad Hasanul Karim
par Abu Nur Muhammad Hasanul Karim , Manager-System Administration , Dhaka Stock Exchange Ltd.

 

 

 

First find your new disk by using this command

fdisk -cul /dev/sd* (if RHEL6 then -cul or if7 then -l)

 

if disk is IDE then fdisk -cul /dev/hd*

 

it may be like sdc , sdb , hda etc

 

Now you have to partition it by using this command

 

fdisk /dev/sdX (x=b/c/d )

 

 

partprobe /dev/sdX  (if RHEL6 then reboot it if7 then just partprobe)

 

 

Do file system

mkfs.ext4 /dev/sdXn (for ext4 filesystem)

 

Amr Mohamed Abdo Eissa
par Amr Mohamed Abdo Eissa , Senior AIX System Engineer , Data & Transaction Services

#fdisk -l      to list all available hard disks

#fdisk -cu /dev/sd?   to start the process and display the warning message

#portprob /dev/sd?   to reload the new partition table

#mkfa.ex4 /dev/sd?  to create a file system ex4

then you can mount it using

# mount -t ext4 /dev/sd? /<the directory >

or

you can add it in fstab file

#vim /etc/fstab

/dev/sd?   /<directory>      ext4      default 11

or by using UUID 

UUID=??????????????   /<directory>   ext default11

:wq

use this command to get UUID

#blkid

after you edited the fstab file use this command to check if it mounted correctly

#mount -a

Rajesh Pant
par Rajesh Pant , System Engineer , Tech Mahindra Limited

Go through below steps by usingcfdisk method :1.) Identifiy New disk (s) #fdisk -l /dev/sd* Note : Gererally fresh added disk doesn't have any partition number only carry flat name (e.g. sdc or ssd).2.) Make partition (Primary or logical) and write it also you can choose type lvm here. #fdisk /dev/sdX3.) Initialize kernel #partprobe /dev/sdX14.) Now, need to create filesystem as per your need. ( In case of lvm, logical volume path will be used for formating) e.g. #mk2fs -j /dev/sdX1 (for ext3 filesystem) Or #mkfs.ext4 /dev/sdX1 (for ext4 filesystem)

More Questions Like This