In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to partition, format and mount the hard disk on the VPS of the Linux system". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
This is my experience in setting up my VPS these days, my VPS system for the Ubuntu,VPS server given your initial server on a disk is divided into good zones, is the system disk, so we use the df-hl command to check the hard disk when we found that the hard disk is smaller, in fact, there is an additional virtual disk without partitions, this needs to be formatted and mounted on its own partition.
We mainly use several main commands: fdisk (partition command), mke2fs (format command), mount (mount command).
Step 1: partition
First check the condition of the hard drive and use the command:
The code is as follows:
Fdisk-l
Disk / dev/xvda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/ dev/xvda1 * 1 13 104391 83 Linux
/ dev/xvda2 14 1044 8281507 + 8e Linux LVM
Disk / dev/xvdb: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
We can see that the capacity of / dev/xvdb is 23.6G and there are no partitions. Next we partition and mount it.
OK, now let's type the command directly to partition the xvdb:
The code is as follows:
Fdisk / dev/xvdb
Enter fdisk command mode and type m to view all command explanations. We are going to use the main n command to create a partition:
The code is as follows:
Command (m for help): n
A prompt appears:
Command action
E extended
P primary partition (1-4)
P
There are two commands to choose: e (create extended partition) and p (create primary partition)
I chose P directly.
The first partition in / dev/xvdb
The code is as follows:
Partition number (1-4): 1
First cylinder (1-2871, default 1): (enter: enter)
Using default value 1
Last cylinder or + size or + sizeM or + sizeK (1-2871, default 2871): (enter: enter)
Using default value 2871
Enter W to save exit
The code is as follows:
Command (m for help): W
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
We have completed the / dev/xvdb partition through the above steps, so let's format and mount the partition
Step 2: format
I used mke2fs (command), which supports a lot of parameters; of course, you can also use the mkfs command to make it easier.
If it's a mkfs command, that's what it looks like:
The code is as follows:
Mkfs-t ext4 / dev/xvdb1
Using the mke2fs command, you can add a parameter to see the formatting process (see if there is an error)
The code is as follows:
Mke2fs-c-t ext4 / dev/xvdb1
Step 3: mount the partition. We can use this partition only if we mount it.
The command is simple: mount.
The code is as follows:
Mount / dev/xvdb1 / mnt
It means to mount the partition to the mnt directory, of course, you can choose other directories, but if your directory is a non-empty directory, you can mount it, but the files in the original directory cannot be used.
When finished, we can see through df-hal that the new partition has been mounted to the directory / home1
One more step. If you want to boot and mount automatically, you need to edit / etc/fstab to automatically mount the partition to the directory of your choice when you boot.
The code is as follows:
Vi / etc/fstab
Add after the last line:
The partition that needs to be mounted mounts the partition format parameter of the directory (default). The next two parameters are set to 0.
The code is as follows:
/ dev/xvdb1 / mnt ext4 defaults 0 0
Finally, reboot restarts
This is the end of the content of "how to partition, format and mount the hard disk on the VPS of the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.