In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to parse formatted disks, mounts and swap partitions. In view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
4.5 Table4.6 disk formatting
Commands: mke2fs, mkfs.ext2, mkfs.ext3, mkfs.ext4
When you use man to query the help documentation for these four commands, you will find that we see the same help document, which means that the four commands are the same. Common options for mke2fs are:
The space occupied by each data block is set when partitioning. Currently, 1024, 2048 and 4096 bytes are supported per block.
'- i' sets the size of the inode and sets how many bytes correspond to an inode.
'- N' set the number of inode, sometimes it is not enough to use the default number of inode, so customize the number of inode.
Check if there is something wrong with the disk before formatting, and it will be very slow if you add this option
'- L' presets the label label for the partition
'j' create a partition in ext3 format. If you use mkfs.ext3, you don't need to add this option.
'- t' is used to specify what type of file system, which can be ext2, ext3 or ext4.
'- f' forced formatting
'- m' specifies the reserved space
Mke2fs does not support mke2fs-t xfs;mkfs.ext4 and mke2fs support the same options
-L "reserved to change the partition label
-t: specify the file system type (ext2/ext3/ext4)
Just add-f.
/ etc/fstab configuration file:
This file shows the partitions that need to be mounted when the system boots
It can also be understood that you can put the commands you need to allow in this file and turn on the opportunity to run it automatically (such as disk auto-mount).
View the file system format cat / etc/filesystems
Create a file system before formatting
To see the size of the file document, use the du-sh file name, or use the ls-lh file name.
Format / dev/sdb1 into a xfx file system and specify the size of the block.
Format / dev/sdb1 into the ext4 file system, and after formatting, you can continue to format it again. Format command: mke2fs-t ext4 / dev/sdb1 or mkfs.ext4 / dev/sdb1, force format plus "- f" command
How do I view commands that are not mounted? Using the blkid command, the blkid command does not support the xfs format.
Set the reserved space for the disk, using the-m command.
Set the size of the block, the original block 4k, set to block and byte 1:2, set to 8kMage8192 is equivalent to the role of 4k.-i is to specify how many bytes correspond to an inode. If you want more inode, use-I to reduce the byte number, with the lowest inode corresponding to a block.
Note: because you can save at most one file per block. Mke2fs / dev/sdb1 can be directly executed without specifying-t to format into xfs, and the default is that xfs is not specified.
In most cases, the number of inode must be sufficient. Because when formatted by default, what does an increase in inode,inode equivalent to 4 blocks (16k) have to do with improving disk space utilization?
It should be that when the disk usage scene is a lot of small files (less than 4k), setting the block 1k or 2k can improve the space utilization.
Mkfs.xfs does not need to add-f to format for the first time. The mkfs.xfs+ file system name is formatted directly into the xfs file system format.
The system can be formatted with or without partitions, and the file system can be mounted only after formatting.
4.7Accord 4.8 disk mount
Before mounting a partition, you need to establish a mount point, which appears in the form of a directory. Once a partition is mounted to the mount point (directory), then writing data to the directory will be written to the partition. This requires your attention that before mounting the partition, the mount point (directory) must be an empty directory. In fact, the fact that the directory is not empty does not affect the use of the mounted partition, but once mounted, the previous things under the directory cannot be seen. It can only be seen after the partition has been uninstalled.
Syntax mount (options) (parameters) option-V: show program versions;-l: display a list of loaded file systems;-h: display help and exit;-v: verbose mode, output instruction execution details;-n: load file systems that are not written to the file "/ etc/mtab";-r: load file systems in read-only mode -a: loads all file systems described in the file "/ etc/fstab". Parameters.
Device file name: specifies the device name for the file system to be loaded
Load point: specify the load point directory.
The mount-t auto / dev/cdrom / mnt/cdrommount: mount point / mnt/cdrom does not exist / mnt/cdrom directory does not exist and needs to be created first. Cd / mnt-bash: cd: / mnt: No such file or directorymkdir-p / mnt/cdrom create / mnt/cdrom directory lsbin dev home lib media mnt proc sbin srv tmp varboot etc initrd lost+found misc opt root selinux sys usrmount-t auto / dev/cdrom / mnt/cdrom mount cdrommount: block device / dev/cdrom is write-protected, mounting read-only mounted successfully
Command: mount view partition file system
You can view all the partitions that have been mounted on the current system, as well as the type of partition file system, mount point and some options.
From left to right are disk partitions, mount points, partition types, and mount options in parentheses.
Delete partition 1/dev/sdb1
Use fdisk-l to see if the partition has been deleted.
Use df-h to view the mount of the file system
Mount / dev/sdb to / mnt, and after mounting, you can write data at the mount point. Mount looks at the mounted / mnt directory.
Uninstall the mount point / mnt/ directory
Because the target is busy when uninstalling in the mnt directory, the mnt mount point cannot be uninstalled. The first uninstall method: use the cd command to exit the mnt directory, then use umount / dev/sdb to uninstall the mnt directory, and the second: use the umount-l / uninstall command to uninstall.
4.9 manually increase swap space
The dd command is used to copy the file and convert and format the contents of the original file. Dd command is very powerful, for some low-level problems, if you need to back up oracle bare devices, you can use rman backup, or use third-party software backup, use dd, then it is not very convenient to manage.
Option bs=: sets ibs (input) and Obasan (output) to the specified number of bytes; cbs=: converts only the specified number of bytes at a time; conv=: specifies how the file is converted; count=: reads only the specified number of chunks; ibs=: reads bytes per read; obs=: outputs bytes per output; of=: outputs to the file; seek=: skips the specified number of chunks at the beginning of output When skip=: starts reading, it skips the specified number of chunks;-- help: help;-- version: displays version information.
This command creates a 100m file, tmp/newdisk, in which the parameters are interpreted
If stands for input file. If you do not specify if, the input is read from stdin by default.
Of stands for output file. If you do not specify of, stdout is used as the default output by default.
Bs represents the block size in bytes.
Count represents the number of blocks copied.
/ dev/zero is a character device that constantly returns 0 value bytes (\ 0).
Use the du-sh filename to view the file size created.
Table of units of measurement that can be used for block size
Unit size code byte (1B) c byte (2B) w block (512B) b kilobyte (1024B) k megabyte (1024KB) M gigabyte (1024MB) G
Format the file you just created with the mkswap command and add a secure permission.
How to delete formatted files? Use the swapoff command, and then delete the formatted directory name.
This is the answer to the question about how to parse the formatted disk, mount and swap partition. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.