In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to analyze the disk and file system management of 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.
1. Zoning
MBR (Master Boot Recorder) primary boot partition only provides a maximum of 4 partitions, while primary partition (Primary,P) and extended partition (Extended,E), such as 3P+1E, can only have up to 1 partition.
2. File system
Ext2: standard file system
Ext3: added log function, which is the upgraded version of ext2
Know the file systems supported by linux: ls-1 / lib/module/'uname-r'/kernel/fs
To know which file system is currently enabled on the system: cat / proc/filesystems
Minimum storage unit of hard disk: sector (1 sector = 512byte)
Logical block (Block): the "minimum unit of storage" set by a partition when formatting the file system.
1 block can only hold 1 file at most
When partitioning, each partition is a file system, and the block at the beginning of each file system is called superblock (super block). When accessing data, the first pass is superblock, so if the superblock is broken, the disk will not work.
3. EXT2 file system (inode)
1) Ext2 plans out the inode table and block area.
Inode: stores file attributes and the block in which the file contents are placed (pointer), 1 inode:128byte
Block: storing file contents
2) the information recorded in the inode table is:
File owner and user group (owner/group)
File access mode (read/write/excute)
File type (type)
File creation or state change time (ctime), last read time (atime), last modified time (mtime)
File size
Flags that define file attributes (flag)
Pointer to the true content of the file (pointer)
* * the default time of Ls command is mtime (ex:ls-la-time=atime PATH)
3) how does Linux read the contents of the file?
(1) Directory: when ext2 sets up a directory, ext2 will assign an inode and at least one block to that directory
Inode: record the attributes of the directory and point to the block assigned to it
Block: record the relevance of files or directories in this directory
(2) File: when ext2 creates a file, ext2 is assigned to at least one inode and the number of block relative to the file size
Inode: record the relevant attributes of the file, not the file name
Block: record the file name, the related connection to the file
4) how to read the information of the file system
Dumpe2fs / dev/hda1
4. Loading point
The mount point is the entrance to the file system, which must be a directory rather than a file
5. Capacity of disk and directory
View current disk * * allowed capacity, used capacity, used capacity of current directory: df and du
/ dev/hda one partition
/ dev/hda1, / dev/hda2, / dev/hda3 primary partition, / dev/hda5+/dev/hda6+... = / dev/hda4 is an extended partition
Du is similar to a resource manager in windows
6. Connection file: ln (similar to shortcuts in windows)
Multiple link file may point to the same source file. The connection file is divided into hard connection and symbolic connection.
1) hard connection (actual connection): add an associated data to the file in a directory without consuming inode and disk space
2) symbolic links (shortcuts): create a separate file so that the reading of the data points to the contents of the file to which it is connected. (frequently used), the connection file cannot be opened after source file is deleted
Rebuild connection file: ln
7. Disk Partition
1) Partition: fdisk [- l] device name (mainly used to view and modify partition tables)
2) Delete the partition:
Fdisk [- l] device name enters fdisk screen
P take a look at the partition information first
D delete the partition and ask you to select a partition, select l
W save to disk data table and leave fdisk
3) New Partition
Fdisk [- l] device name enters fdisk screen
N New Partition
4) disk formatting
Mke2fs [- bicLJ] device name
5) disk inspection
Fsck [- AtCary] device name (check the hard drive for bad tracks)
Directory lost+found, which will put error files into this directory after fsck processing
Badblocks [- svw] device name (similar to windows disk scan)
Sync (writes data that is temporarily in memory directly to disk)
6) disk loading
Mount [- tonL] device name code loading point
Mount / dev/cdrom (load CD)
Mount-a (loads all the data recorded in the file system and the mount point in the entire system)
7) disk uninstall
Unmount device number or loading point
8) modify disk parameters
Mknod device name [bcp] [Major] [Minor]
E2label device name New label name
Tune2fs [- jlL] device number
Hdparm [- icdmXTt] device name
8. Set up boot loading
1) load floppy disk
Mount-t ext2 / dev/fd0 / media/floppy (ext2 format)
Mount-t vfat / dev/fd0 / media/floppy (windows format)
Umount / media/floppy (floppy disk can not be removed until uninstalled)
2) load windows disk
Mkdir / mnt/win98
Mount-t vfat / dev/hda1 / mnt/win98
Mount-t vfat-o iocharset=cp950 / dev/hda1 / mnt/win98 (add Chinese code)
3) load USB flash drive
Mkdir / mnt/usb
Mount-t vfat / dev/sda1 / mnt/usb
4) start loading / etc/fstab and / etc/mtab
/ etc/fstab is the command content that needs to be executed to load a device into a load point of the system using mount
Load point: it is the directory
9. Set up virtual memory
Virtual memory can be expanded by establishing virtual memory devices or creating virtual memory files.
After reading the above, do you have any further understanding of how to analyze Linux system disk and file system management? 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.