Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a file system using ext2

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use ext2 to create a file system, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

§Why does 0x00 learn ext2

This file system is at the original production level.

It is the easiest to implement.

Disadvantages compared to modern file systems:

No transaction

Do not perceive the solid state drive.

0x01 makes a virtual disk

This is achieved through the dd command.

Dd if=/dev/zero of=ext2.img count=1024000 bs=10240x02 creates a file system

Because we are using virtual disks, we can directly perform file system creation actions on the mirrored files. Mkfs.ext2 comes from the tool set e2fsprogs.

$mkfs.ext2 ext2.imgmke2fs 1.44.1 (24-Mar-2018) / / version of the tool Discarding device blocks: 4096ax 256000 / / number of block discarded.? DoneCreating filesystem with 256000 4k blocks and 64000 inodes / / starts creating the file system and outputs the number of blocks and inode to be generated. Filesystem UUID: e6ae7d79-7cf3-42cc-802d-4158253beb85 / / UUIDSuperblock backups stored on blocks: / / outputs the backup block location of the sb, which is the odd block group of the block group. 32768, 98304, 163840, 229376Allocating group tables: doneWriting inode tables: doneWriting superblocks and filesystem accounting information: done0x03 to view the created file system information

The e2fsprogs toolset provides a dump tool that can be used to view ext file systems that have been created. The content is too complicated, only paste the previous part.

Dumpe2fs ext2.img dumpe2fs 1.44.1 (24-Mar-2018) Filesystem volume name: Last mounted on: Filesystem UUID: e6ae7d79-7cf3-42cc-802d-4158253beb85Filesystem magic number: 0xEF53Filesystem revision #: 1 (dynamic) Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_fileFilesystem flags: signed_directory_hashDefault mount options: User_xattr aclFilesystem state: clean Errors behavior: Continue Filesystem OS type: LinuxInode count: 64000Block count: 256000 Reserved block count: 12800 Free blocks: 251658Free inodes: 63989First block: 0Block size: 409...

This output covers all the information about the ext2 file system. However, the information in this does not explain that at the time of creation, the output contains the output of Discard 4096/xxx blocks. The file system is only reserved, and there is no reason to discard some blocks. Guess that here may just output the block size and the total number of blocks, discard is only to remind the user that the original information on the disk will be discarded. This conjecture is also confirmed by looking at the code.

On how to use ext2 to create a file system to share 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: 300

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report