Ext2,ext3,ext4,gpt of Linux partitions

Source: Internet
Author: User

Ext2,ext3,ext4,gpt of Linux partitions2013-07-10 12:00:24Tags: ext3 GPT original works, allow reprint, when reproduced please be sure to use hyperlinks in the form of the original source of the article, author information and this statement. Otherwise, the legal liability will be investigated. http://wushank.blog.51cto.com/3489095/1244191

First, the sections brief introduction:

1, ext is a disk partition format under the Linux system, equivalent to XP under the Fat/fat16/fat32, we know that Android is based on the development of Linux system mobile phone system, then the same is the format of these partitions, usually we say that the opening A2SD function, is in the SD card to separate a system supported by the disk format, the following is a look at the difference between these formats!
2, EXT2 (second extended file system): Is the Gnu/linux system, the standard file system, which features excellent access to file performance, for small and medium-sized files show advantages, which is the main benefit of its cluster fast layer of good design. Its single file size and the capacity of the file system itself is related to the size of the file system itself, in the general x86 computer system, block maximum of 4KB, the single file size limit is 2048GB, and the file system capacity limit is 16384GB. However, since the core 2.4 can use a single partition maximum of only 2048GB, so can actually use the file system capacity is at most only 2048GB.

3, EXT3 (third extended file system): As the name implies, it is the next generation of ext2, that is, in keeping the current ext2 format, plus the log function.
4. EXT4 (Fourth extended file system): File system is the log file system under Linux system, is a successor of ext3 file system, but EXT4 is an improvement of Linux file system. In many ways, Ext4 's progress relative to EXT3 is far greater than EXT3 's progress relative to Ext2. The improvement of Ext3 relative to Ext2 mainly lies in the log aspect, but the improvement of EXT4 relative to the Ext3 is deeper, is the optimization of the file system data structure, is an efficient, excellent, reliable and very characteristic file system, and EXT3 can be converted to EXT4.

5. XFS

XFS is a high-performance 64-bit file system developed by SGI to replace the existing EFS file system. XFS provides low-latency, high-bandwidth access to file system data by maintaining cache consistency, locating data, and distributing processing disk requests. Currently SGI has ported XFS file systems from Irix to Linux.

The maximum supported file size is 263 = 9 x 1018 = 9 exabytes, and the maximum file system size is exabytes.

6, ReiserFS

ReiserFS is a very good file system, its developers are very bold, the entire file system is completely from the beginning of design. Currently, ReiserFS can easily manage hundreds of g of file systems, which is important in enterprise-class applications. ReiserFS is designed based on object-oriented thinking and consists of a semantic layer (semantic layer) and a storage layer (storage layer). Semantic layer is mainly the management of object namespace and the definition of object interface to determine the function of object. Storage tiers are primarily the management of disk space. The semantic layer and the storage layer are contacted by key.      The semantic layer parses the object name by generating the key, and the storage layer stores the space on disk by key, and the key value is globally unique. Like Ext3, ReiserFS also has three logging modes, namely Journal,ordered,writeback.

Maximum file size 8 TiB
Maximum volume capacity (TiB)

7. JFS

JFS was developed by IBM and initially appeared on the Aix operating system, which provides a log-based byte-level, transaction-oriented, high-performance file system. It is scalable and robust, and its advantage over non-log file systems is its fast restart capability: JFS can restore the file system to a consistent state in seconds or minutes. JFS is a fully 64-bit file system. All JFS file system structured fields are 64-bit size. This allows JFS to support both large files and large partitions.

8. Characteristics and differences of EXT4 and EXT3:
The EXT4 offers better performance and reliability, as well as a richer range of features:
(1). Compatible with EXT3. By executing several commands, you can migrate from Ext3 online to EXT4 without reformatting the disk or reinstalling the system. The original EXT3 data structure is still retained, EXT4 action on new data, of course, the entire file system has thus obtained the EXT4 supported by the larger capacity.

Upgrade from ext3 to EXT4:

# CD/; Umount/dev/sda1

# Tune2fs-o EXTENTS,UNINIT_BG,DIR_INDEX/DEV/SDA1

Remember, you must scan with fsck after converting to EXT4, otherwise you cannot mount,-p the "auto fix" file system with the parameter description:

# FSCK-PF/DEV/SDA1

Mount the Ext4 file system:

# mount-t ext4/dev/sda1/path/to/

(2). Larger file systems and larger files. EXT4 supports 1EB (1,048,576TB, 1EB=1024PB, 1PB=1024TB) file systems and 16TB files, respectively, compared to the maximum 16TB file system and maximum 2TB files currently supported by EXT3.
(3). An unlimited number of subdirectories. EXT3 currently supports only 32,000 subdirectories, and EXT4 supports an unlimited number of subdirectories.
(4). Extents. EXT3 uses indirect block mapping, which is extremely inefficient when working with large files. For example, a 100MB size file, in Ext3 to create 25,600 blocks (each data block size is 4KB) mapping table. The EXT4 introduces the popular extents concept in modern file systems, each extent a contiguous set of data blocks, which is expressed as "the file data is stored in the next 25,600 blocks", which improves a lot of efficiency.
(5). Multi-block allocation. When writing data to the Ext3 file system, the EXT3 data block allocator can only allocate a 4KB block at a time, write a 100MB file will call 25,600 data block allocator, and Ext4 's multi-block allocator "Multiblock Allocator" (Mballoc Supports a single call to allocate multiple blocks of data.
(6). Deferred allocation. EXT3 's block allocation strategy is allocated as quickly as possible, while the EXT4 and other modern file operating system policies are to delay allocations as much as they can, until the file is written in the cache before the data block is allocated and written to disk, which optimizes the data block allocation for the entire file, which, together with the first two features, significantly improves performance.
(7). Fast fsck. The first step in executing fsck is slow, because it checks all the inode, and now EXT4 adds a list of unused inode to each group's inode table, and the fsck EXT4 file system will be able to skip them in the future to check only the inode that is in use.
(8). Log check. Logs are the most common part and are prone to disk hardware failure, and recovering data from corrupted logs can result in more data corruption. EXT4 's log check function makes it easy to tell if the log data is corrupted, and it merges the EXT3 two-stage logging mechanism into one phase, increasing security while improving performance.
(9). "No Log" (no journaling) mode. The log has some overhead, and EXT4 allows logging to be turned off so that some users with special needs can improve performance.
(10). Online defragmentation. Although delayed allocations, multiple allocations, and extents can effectively reduce file system fragmentation, fragmentation is unavoidable. EXT4 supports online defragmentation and will provide e4defrag tools to defragment individual files or the entire file system.
(one). Inode-related features. The EXT4 supports larger inode sizes, compared to the default inode size of Ext3 of 128 bytes, EXT4 in order to accommodate more extended attributes (such as nanosecond timestamp or inode version) in the Inode, the default inode size is 256 bytes. EXT4 also supports fast extended properties (fastextended attributes) and Inode retention (inodes reservation).
(12). Persistent pre-allocation (persistent preallocation). To ensure that the downloaded file has enough space to store, it is often pre-created an empty file with the same size as the downloaded file, so that the download fails due to insufficient disk space in the next few hours or days. The EXT4 implements durable pre-allocation at the filesystem level and provides the appropriate API (Posix_fallocate () in libc), which is more efficient than the application software itself.
(13). Barrier is enabled by default. The disk is equipped with an internal cache to re-adjust the write order of the bulk data, optimizing write performance, so the file system must write the commit record after the log data is written to disk, and if the commit record is written earlier and the log is potentially corrupted, data integrity is affected. EXT4 By default, barrier is enabled, and data after barrier can be written only if the data before barrier is written to disk. (This feature can be disabled by the "mount-o barrier=0" command)

Second, GPT introduction and use:

Let's talk about the disks that are currently widely used Partition TableScheme. of traditional Partitioning Scheme(called MBR partitioning scheme) is the PartitioningInformation is saved to DiskThe first sector (MBR sector) in 64 bytes, each partition entry occupies 16 bytes, which contains the active state flag, the file system ID, the start and end cylinder number, the number of magnetic number, the sector area code, the amount of implied sectors (4 bytes), the total number of partitions (4 bytes), and so on. Because the MBR sector has only 64 bytes for the partitioned table, only 4 partition information can be logged. This is why the number of primary partitions on a hard disk cannot exceed 4. Later, in order to support more partitions, the concept of extended partitioning and logical partitioning was introduced. However, each partition entry is still stored in 16 bytes.

MBR partitioning scheme isn't it good to use? Why should we propose a new scheme? Let's see what's wrong with the MBR partitioning scheme. As mentioned above, the number of primary partitions cannot exceed 4, this is one, many times, 4 primary partitions do not meet the needs. It is also critical that the MBR partitioning scheme cannot support disks that exceed 2TB capacity. Because this scheme uses 4 bytes to store the total number of sectors of the partition, the maximum can represent 2 of the number of 32 sectors, calculated per sector 512 bytes, each partition maximum can not exceed 2TB. When the disk capacity exceeds 2TB, the starting position of the partition cannot be represented. With the rapid drive capacity of today, the 2TB limit will soon be broken. This shows that MBR partition scheme is unable to meet the needs. The GUID partition table scheme is described below.

GUID Partition Table (GPT, for short.) Disks that use a GUID partition table are called GPT disks, and are the standard for a newer disk partition table structure originating from the EFI standard. GPT provides a more flexible disk partitioning mechanism than the currently widely used master boot record (MBR) partitioning scheme. It has the following advantages:
1, support the large hard disk above 2TB.
2. There is almost no limit on the number of partitions per disk. Why do you say "almost"? is because Windows systems only allow partitioning of up to 128 partitions. But it's completely enough.
3, the size of the partition is almost unlimited. Another "almost". Because it uses a 64-bit integer to represent the sector code. Exaggeration to say that a 64-bit integer can represent the size of the partition is already an "astronomical", for several years you can not see such a size of hard disk, let alone partition.
4, the partition table comes with the backup. A copy of the same partition table is saved on the first and last part of the disk. One of them is destroyed and can be recovered by a second copy.
5, each partition can have a name (different from the volume label).

Since the GUID partitioning scheme has so many advantages, is it possible to use this scheme entirely when partitioning? No. Not all Windows systems support this partitioning scheme. Take a look at the following table:

Types of Windows Can read and write GPT disks Can I boot from a GPT disk
32-bit Windows XP No. Only one protective MBR partition can be seen Not supported
Windows 2000/nt/9x No. Only one protective MBR partition can be seen Not supported
64-bit Windows XP Yes Only Itanium-based systems can boot from GPT disks
Windows Server 2003 SP1 and later Yes Only Itanium-based systems can boot from GPT disks
Windows Vista Yes Only EFI-based system support booting from GPT disks
Windows Server 2008 Yes Only EFI-based system support booting from GPT disks
Windows 7 Yes Only EFI-based system support booting from GPT disks

Isn't it disappointing? Most of the current PC systems do not yet have the perfect support for GPT disks. However, this does not mean that we do not need to understand the GUID partitioning scheme. Don't forget, the speed of hardware development is always surprising. 1.5TB of hard drives are already on the market, 2TB or more of the capacity of the hard disk will soon become popular, EFI-based motherboards are also being sold. The GUID partitioning scheme will eventually become mainstream.

As a section software, DiskgeniusThe GUID partition table is supported starting with version 3.1. This is the first partition software that supports GUID partition table in China. Diskgenius provides features such as the creation, deletion, formatting, lost partition recovery, file recovery, partition table backup, GUID partition table format and MBR partition table format conversion (Error-correct conversion).

------------------------------------------------------------------------------------------------------

Use of larger than 2T disks under Linux: GPT disks

Two types of partitioned tables

MBR partition table: (MBR meaning: Master boot Record)

Maximum supported Volume: 2T (T; TERABYTES,1TB=1024GB)

Limits on partitions: up to 4 primary or 3 primary partitions plus one extended partition (unlimited logical drives are supported in the extended partition)

GPT partition table: (GPT meaning: GUID partition table)

Maximum volume Supported: 18EB, (E:EXABYTES,1EB=1024PB,1PB=1024TB)

Supports up to 128 partitions per disk

The Fdisk command is very interactive and easy to operate, but for disks larger than 2T, what if we want to use a disk larger than 2T? You can convert the disk to GPT format.

The GPT format disk is equivalent to the original MBR disk in the original reserved 4 partitiontable 4*16 bytes, leaving only the first 16 bytes, similar to the extended partition, the real partition table after 512 bytes, GPT disk does not have four primary partition limit.

However, Fdisk does not support GPT, and we can use parted to operate on GPT disks.

The parted feature is powerful and can be used for both command line and interactive

Enter parted at the prompt to enter interactive mode, if there are multiple disks, we need to run select SDX x as disk, to make disk selection

Parted>

Parted>select SDB assumes that the disk is SDB

Parted>mklabel GPT to format MBR disks as GPT

Parted>mklabel msdos to convert GPT disks to MBR disks

Parted>mkpart Primary 0 100 divides a primary partition with a starting position of 0 size 100M

Parted>mkpart Primary 100 200 divides a primary partition with a starting position of 100M size 100M

Parted>print Printing the current partition

Ext3 file system is not supported in parted, so if you want to use it, exit parted to format

Mkfs.ext3/dev/sdx1

Because Fdisk does not support GPT disks, do not use fdisk-l to see the area where the X disk was just divided.

Command-line mode:

After converting the hard disk to a GPT disk, execute the following command

PARTED/DEV/SDX Mkpart Primary 0 100 divides a primary partition with a starting position of 0 size 100M

Detailed usage:

parted [options] ... [Device [command [parameters] ...] ...]

Apply the command with "parameters" to "Device". If the command is not given, it runs in interactive mode.

Options:

-H,--help displays this help message

-I,--interactive prompts the user when necessary

-S,--script never prompt the user

-V,--version display version

Command:

Check minor a simple inspection of the file system.

MINOR is the partition number used by Linux.

In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5.

CP [From-device] from-minor to-minor Copy the file system to another partition.

MINOR is the partition number used by Linux. In the MSDOS disk label, the main sub-

The zone number is 1-4, and the logical partition starts at 5. DEVICE is typically/dev/hda or/DEV/SDA

Help [command] print general assistance information, or information about the command

Mklabel label Type

Create a new disk label (partition table) "label type" is any of the following: AIX, BSD, GPT, Mac, DVH, Msdos, Sun, loop

The MKFS MINOR file system type creates a file system of type "file system Type" in MINOR.

Minor is the partition number used by Linux. In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5.

The file system type is any of the following: Ext3, EXT2, FAT32, FAT16, HFS, JFS, Linux-swap, Ntfs,reiserfs,hp-ufs, Sun-ufs, XFS

Mkpart partition Type [file system type] Start point end point Create a partition.

The partition type is the primary partition, logical partition, and one of the extended partitions. File system Type "is any of the following: Ext3, EXT2, FAT32, FAT16, HFS, JFS,

Linux-swap, Ntfs,reiserfs,hp-ufs, Sun-ufs, XFS. " The start and end points are in megabytes. A negative value indicates the count starts at the end of the disk.

Mkpart Create a partition without creating a new file system on the partition. The file system type can be used to set the appropriate partition identity.

MKPARTFS partition type file system type Start point end point creates a partition with a file system, the partition type is a primary partition, a logical partition, one of the extended partitions, and a start point and a terminating point in megabytes. A negative value indicates the count starts at the end of the disk.

Move MINOR The starting point of the end point moves the partition numbered MINOR. MINOR is the partition number used by Linux. In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5. The start point and end point are in megabytes. A negative value indicates the count starts at the end of the disk.

Name MINOR names the partition with the number MINOR named "Name". MINOR is the partition number used by Linux. In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5. NAME is any word you need

Print [MINOR] the partition table, or partition

Quit quitting the program

Rescue start point end point saves missing partitions near "start point", "End point"

Resize MINOR Start point change the size of the file system in the partition numbered MINOR. MINOR is the partition number used by Linux. On the MSDOS disk

Label, the primary partition number is 1-4, and the logical partition starts at 5. The start point and end point are in megabytes. A negative value indicates the end of the disk

The segment starts counting.

RM MINOR Delete the partition numbered MINOR. MINOR is the partition number used by Linux. In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5.

Select Device Choose the device to edit

The set MINOR flag state changes the flag for the partition numbered MINOR, MINOR is the partition number used by Linux. In the MSDOS disk label, the primary partition number is 1-4, and the logical partition starts at 5. "Flag" is any of the following: Start, root, swap partition, hidden partition, RAID, LVM, LBA, Hp-service, Palo. Status: On, off

Ext2,ext3,ext4,gpt of Linux partitions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.