In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the linux system partition formatting and mounting data disk example analysis, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Use the Management Terminal, or the remote connection tool, and enter the user name root and password to log in to the linux system.
1. Run the fdisk-l command to view the data disk. Before the data disk is partitioned and formatted, the data disk cannot be seen using the "df-h" command, and can be viewed using the "fdisk-l" command.
After executing the command, if / dev/vdb does not exist, it means that there is no data disk. Confirm that the data disk is mounted.
2. Execute the following command to create a single partition data disk:
(1) run fdisk-u / dev/vdb: partition data disk.
(2) enter p: view the partition of the data disk. In this example, the data disk is not partitioned.
(3) enter n: create a new partition.
(4) enter p: select the partition type as the primary partition.
Explain that in this example, you create a single-partition data disk, so you only need to create a primary partition. If you want to create more than four partitions, you should create at least one extended partition, that is, select e (extended).
(5) enter the partition number and press enter. In this example, only one partition is created, enter 1.
(6) enter the first available sector number: press enter to adopt the default value of 2048.
(7) enter the last sector number: in this example, only one partition is created, press enter to use the default value.
(8) enter p: view the planned partition of the data disk.
(9) enter w: to start the partition and exit after the partition.
[root@ecshost~] # fdisk-u / dev/vdbWelcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Device does not contain a recognized partition tableBuilding a new DOS disklabel with disk identifier 0x3e60020e. Command (m for help): pDisk / dev/vdb: 21.5GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x3e60020eDevice Boot Start End Blocks Id System Command (m for help): nPartition type:p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): pPartition number (1-4, default 1): 1First sector (2048-41943039, default 2048): Using default value 2048Last sector + sectors or + size {Kjogren G} (2048-41943039, default 41943039): Using default value 41943039Partition 1 of type Linux and of size 20 GiB is set Command (m for help): P Disk / dev/vdb: 21.5GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x3e60020eDevice Boot Start End Blocks Id System/dev/vdb1 204841943039 20970496 Linux Command (m for help): wThe partition table has been altered! Calling ioctl () to re-read partition table.Syncing disks.
Run the command fdisk-lu / dev/vdb to view the new partition.
If the following message appears, the new partition / dev/vdb1 was created successfully.
[root@ecshost~] # fdisk-lu / dev/vdb Disk / dev/vdb: 21.5GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x3e60020e Device Boot Start End Blocks Id System/dev/vdb1 2048 41943039 20970496 83 Linux
4. Run the command mkfs.ext4 / dev/vdb1 to create a file system on the new partition.
In this example, an ext4 file system is created. You can also choose to create other file systems according to your needs, for example, if you need to share files between Linux, Windows, and Mac systems, you can use mkfs.vfat to create VFAT file systems.
Indicates that the time required to create a file system depends on the size of the data disk.
[root@ecshost~] # mkfs.ext4 / dev/vdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label=OS type: LinuxBlock size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks1310720 inodes, 5242624 blocks262131 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=2153775104160 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:32768, 98304,163840,229376,294912,819200,884736,1605632,2654208 4096000 Allocating group tables: doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done
5. (recommended) run the command cp / etc/fstab / etc/fstab.bak to back up the etc/fstab file.
6. Run the command echo / dev/vdb1 / data0 ext4 defaults 00 > > / etc/fstab to write new partition information to / etc/fstab.
Ubuntu 12.04 system does not support barrier, you need to run the command echo'/ dev/vdb1 / data0 ext4 barrier=0 0'> > / etc/fstab.
If you want to mount the data disk to a separate folder, for example, to store web pages separately, replace / data0 in the command with the desired mount point path.
Run the command cat / etc/fstab to view the new partition information in / etc/fstab.
[root@ecshost~] # cat / etc/fstab## / etc/fstab# Created by anaconda on Wed Dec 12 07:53:08 2018 September # Accessible filesystems, by reference, are maintained under'/ dev/disk'# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info#UUID=d67c3b17-255b-4687-be04-f29190d37396 / ext4 defaults 1 1/dev/vdb1 / mnt ext4 defaults 0 0
8. Run the command mount / dev/vdb1 / data0 to mount the file system.
9. Run the command df-h to see the current disk space and usage.
The message of creating a new file system appears, indicating that the mount is successful.
[root@ecshost~] # df-hFilesystem Size Used Avail Use% Mounted on/dev/vda1 40G 1.6G 36G 5% / devtmpfs 234M 0234M 0% / devtmpfs 244M 0244M 0% / dev/shmtmpfs 244M 484K 244M 0% / runtmpfs 244M 0244M 0% / sys/fs/cgrouptmpfs 49M 049m 0% / run/user/0/dev/vdb1 20G 45M 19G 1% / mnt12345678910 [root@ecshost~] # df-hFilesystem Size Used Avail Use% Mounted on/dev/vda1 40G 1.6G 36G 5% / devtmpfs 234M 0 234M 0% / devtmpfs 244M 0 244M 0% / dev/shmtmpfs 244M 484K 244M 1% / runtmpfs 244M 0244M 0% / sys/fs/cgrouptmpfs 49M 049m 0% / run/user/0/dev/vdb1 20G 45M 19G 1% / mnt
10. Finally, reboot, restart the server.
On the linux system partition formatting and mounting data disk example analysis is shared here, I hope the above content can be of some help to 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.