Preface
Write an article to share with you a command that must be learned under Linux: fidsk
If you don’t have a Linux environment at hand, you can refer to my previous article: Oops, I suddenly want to get a Linux centos8 system to play with, what should I do?
Introduction
Linuxfdisk is a program that creates and maintains partition tables. It is compatible with DOS-type partition tables, BSD or SUN-type c drive lists.
Usually we use it to manage Linux c drive, partition View Linux 64-bit system, low format and other operations.
is one of the must-learn commands for contacting Linux.
Sentence pattern
fdisk [必要参数][选择参数]
Required parameters:
Select parameters:
Menu operation instructions
Running environment
Before demonstrating the example, let me explain that the environment I am running this time is CentOS864
Example demonstration
1. Display the current partition situation
The most commonly used one here is fdisk-l, as follows:
As you can see from the picture, I only have a c drive /dev/sdaView linux 64-bit system, the size is 20G. There are two partitions in this disk, namely /dev/sda1 and /dev/sda2, with sizes of 1G and 19G respectively, as well as other information such as starting point and sector.
The two /dev/mappers below the picture are logical volume devices. We will not discuss them in this chapter, just know that there is such a thing.
In addition, if there are multiple c drives, you can also use fdisk-l/dev/sda followed by the c drive name to view them individually.
Simply put, that’s all for viewing fdisk. In other words, it meets daily needs.
Let’s talk specifically about how to use fdisk to build a new partition and mount it to the directory.
fdisk build new partition
need:
Add a new hard drive and require building a new partition and mounting it to /root/study_video
accomplish:
1. Add c drive
If it is a cloud server, just go to the background and lower the c drive.
If it is a chemical server, shut down the server and power off, open the chassis, and lower the c drive.
I am using VMware here and it crashes first. Let me teach you a little method, you can use the command: shutdown-hnow to crash
After returning to VMware, you can see that it is also frozen here.
We double-click the c drive (SCSI) location in the picture on the right.
Click below to add a button
Select the c drive in the new panel that opens and click Next
Default, next step
Here you can choose to create the c drive mode, such as directly loading it using the one created before, or recreating it.
If not necessary, just continue with the default and next step.
Adjust the size, set other defaults, and continue to the next step (I have too few learning materials, so the capacity is set to 5G, you can use it as you like [silly laugh])
If there is no need to rename, just default and click Finish
Looking at the settings panel now, is there an extra hard drive?
ok, click OK to close the panel.
2. Create partition
Turn on the computer and connect to Xshell (if you don’t know how to connect, you can refer to my article: Let’s talk about the collision between VMware16’s centos8 and Win10’s Xshell).
Afterwards, fdisk-l is used again to view the c drive information. The results are as follows:
It is obvious that the new c drive has been downloaded successfully, and the partition operation is carried out below.
①After fdisk command + c drive device name
You can see the software prompts, pay attention to red hat linux, this is a high-risk operation. Be careful, careful, careful!
Enter m at this time to see the help information:
If you forget the specific command during temporary operation, you can check it at any time through this function.
Here we enter n to build a new partition:
Default directly and create a primary partition.
This is usually the direct default.
If you are interested in partitioning, you can refer to this article of mine: Briefly talk about the relationship and number restrictions between primary partitions/expanded partitions/logical partitions in Linux
After that comes the track settings. Here you will be asked to start and end, that is, select the capacity of the current partition. We directly default here, and the system will allocate all the capacity of the c drive to this partition.
Look, as shown in the picture above, the new partition has already been constructed.
Use the p command to query the newly built partition:
As you can see, /dev/sdb1 already exists. And you can't use it to check the disk space in Linux yet. At least before we mount it, we have to low-level it.
Enter w first to save changes:
After saving, you will find a prompt message, and then manually exit the operation command interactive mode.
After that, we use the mkfs command to low-format it, here it is formatted into an ext4 partition.
ok, partition construction and low formatting are completed. Next, mount to the directory.
Mount partition to directory
As mentioned in it, we need to mount this partition to the study material folder in the /home directory. Here we need to create the /home/study_video directory first, and then use the mount command to mount it.
Specific examples are as follows:
Get it done and call it a day!
Summarize
There are two functions of fdisk:
1. View the C drive overview
2. Operate the c drive, such as partition
Although it seems like a lot, it is not difficult after all. When you need to operate, just follow my steps one by one.
The above is the detailed content of Master Linux must-learn commands: how to use fidsk and practical examples. For more information, please follow other related articles on the PHP Chinese website!

Bun is a modern JavaScript runtime designed to simplify and accelerate the development of JavaScript and TypeScript applications. Unlike traditional runtimes, Bun combines multiple tools into a single, cohesive package, including a bundler, test runn

If you’re looking for a free, open-source way to manage and stream your media files on Linux, Jellyfin is the answer, which is an open-source media server that lets you organize your movies, TV shows, music, and photos in one place and stream them to

Markdown (.MD) files are a favorite among developers, writers, and content creators due to their simplicity and flexibility, but what happens when you need to share your beautifully formatted Markdown file with someone who prefers a more universally

In Linux, groups play a central role in managing user permissions and access control. Whether you're an experienced system administrator or a curious new user, understanding how to list and analyze group information is a fund

Linuxoffersextensiveopen-sourcesoftwareandcustomization,butlackssomecommercialapplications;Windowsexcelsincommercialsoftwareandgaming,buthaslesscustomization.Linuxusespackagemanagersforeasysoftwareinstallationandprovidescommunity-drivenrepositories,w

The main differences in architecture between Linux and Windows include: 1) Design philosophy and kernel structure: Linux uses a modular kernel, Windows uses a single kernel; 2) File system: Linux supports multiple file systems, Windows mainly uses NTFS; 3) Security: Linux is known for its permission management and open source features. Windows has a unique security mechanism but lags in repair; 4) Usage experience: Linux command line operation is more efficient, and Windows graphical interface is more intuitive.

Linux and Windows systems face different security threats. Common Linux threats include Rootkit, DDoS attacks, exploits, and permission escalation; common Windows threats include malware, ransomware, phishing attacks, and zero-day attacks.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
