In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to use fdisk and gdisk in the Linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
The simplest difference between fdisk and gdisk is that fdisk can only be used for MBR partitions, and gdisk can be used for GPT partitions.
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.
The command # fdisk-l 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 commands commonly used in fdisk / dev/xvdc
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 the first sector. 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 last sector of the previous partition.
Assign sectors to a partition
Enter a value for the last 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 adds an entry in the / etc/fstab file for automatic mount on permanent startup.
/ dev/xvdc1 / data ext4 defaults 00 after reading the above, do you have any further understanding of how to use fdisk and gdisk in the Linux system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.