In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to add a new disk to an existing Linux system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
As a system administrator, we have some requirements: as part of upgrading the server capacity, or sometimes replacing the disk in the event of a disk failure, we need to configure the new hard drive to the existing server.
In this article, I'll walk you through the steps to add a new hard drive to an existing RHEL/CentOS or Debian/Ubuntu Linux system.
Important: please note that the purpose of this article is only to tell you how to create a new partition, without including partition extension or other options.
I use the fdisk tool to complete these configurations.
I have added a hard drive with 20GB capacity and mounted it to the / data partition.
Fdisk is a command line tool for displaying and managing hard drives and partitions on Linux systems.
# fdisk-l
This command lists the current partition and configuration.
View Linux partition details
After adding the hard drive with 20GB capacity, the output of fdisk-l looks like this.
# fdisk-l
View new partition details
The newly added disk is displayed as / dev/xvdc. If we add a physical disk, it will appear similar to / dev/sda based on the disk type. I'm using a virtual disk here.
To partition on a specific hard drive, for example, / dev/xvdc.
# fdisk / dev/xvdc
Commonly used fdisk commands.
N-create partition
P-print partition table
D-Delete a partition
Q-exit without saving changes
W-Save changes and exit
Since we are creating a partition here, we will use the n option.
Create a new partition on Linux
Create a primary partition or an extended partition. By default, we can have up to 4 primary partitions.
Create a primary partition
Enter the partition number as required. The default value of 1 is recommended.
Assign a partition number
Enter the size of * sectors. If it is a new disk, usually choose the default value. If you are creating a second partition on the same disk, we need to add 1 to the sector of the previous partition.
Assign sectors to a partition
Enter a value for a sector or partition size. It is generally recommended to enter the size of the partition. Always add a prefix + to prevent the value from going out of range.
Assign partition size
Save your changes and exit.
Save partition changes
Now use the mkfs command to format the disk.
# mkfs.ext4 / dev/xvdc1
Format the new partition
When the formatting is complete, mount the partition according to the following command.
# mount / dev/xvdc1 / data
Add an entry to the / etc/fstab file for automatic mount when * starts.
/ dev/xvdc1 / data ext4 defaults 0 0 Thank you for your reading! This is the end of the article on "how to add a new disk to the existing Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.