Tuesday, January 17, 2017

Add new disk to RHEL/CentOS computers



Now we are going to see how to create the new partitions in Linux.



Below are the steps to configure the new hard disk on Linux

Step 1) Take a physical disk (PD)

Step 2) Physical Partition (PP) the PD using fdisk for MBR partitioning or gdisk for GPT partitioning.
Step 3) Format the partition (example: vfat, ext3, ext4, xfs). This also can be done while physical partitioning the disk.
Step 4) Create a mount point. This is a directory where the above formatted volume is supposed to point.
Step 5) mount the volume to the mount point.





Create ext4 type of file system using fdisk partitioning

Step1) find the unused hard disks





Step 2) For MBR partition type fdisk /dev/sdb



Step 3) Enter n for new partition.

Step 4) Enter p for primary partition. -> Give partition number or leave for default -> enter first sector or leave default -> enter last sector or leave default


Now the physical partition is created.

Step 5) Enter w to save and quit the partition method.


Step 6) Create a file system type to ext4.



Step 7) Create a mount point (directory).


Step 8) Mount the file system to mount point.



Step 9) List the block device IDs using blkid.




Step 10) Make the mount point persistent by adding entries to /etc/fstab.








 





Create XFS type of file system using fdisk partitioning.

Step 1) Create a GPT partition.


Step 2) Create a new partition and select the first and last sectors.



Step 3) Save the partition information.







Step 4) Make the file system of type xfs.



Step 5) create mount point and mount the file system.





Step 6) Make the file system persistent by adding an entry in /etc/fstab file

 








 Create a swap file system.

Step 1)  Create a partition using fdisk.










Step 2) Follow the below steps.


dd if=/dev/sdd1 of=/mnt/swapdir/stdswap bs=1024 count=2097152  =>  Here bs is the block size and count = ((bs)*(file size in MB)). This command will dedicate the size to file.

mkswap /mnt/swapdir/stdswap => create the swap file
swapon /mnt/swapdir/stdswap => on the swap file
swapoff /mnt/swapdir/stdswap => off the swap file




Step 3) make swap file persistent by adding an entry in /etc/fstab.







No comments:

Post a Comment