热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

全面指南:RedHatEnterpriseLinux6中的Ext3文件系统详解

第五章详细探讨了RedHatEnterpriseLinux6中的Ext3文件系统。5.1节介绍了如何创建Ext3文件系统,包括必要的命令和步骤,以及在实际操作中可能遇到的问题和解决方案。此外,还涵盖了Ext3文件系统的性能优化和维护技巧,为用户提供全面的操作指南。

Chapter 5. The Ext3 File System

5.1. Creating an Ext3 File System
5.2. Converting to an Ext3 File System
5.3. Reverting to an Ext2 File System
The ext3 file system is essentially an enhanced version of the ext2 file system. These improvements provide the following advantages:
Availability
After an unexpected power failure or system crash (also called an  unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the  e2fsck program. This is a time-consuming process that can delay system boot time significantly, especially with large volumes containing a large number of files. During this time, any data on the volumes is unreachable.
It is possible to run  fsck -n on a live filesystem. However, it will not make any changes and may give misleading results if partially written metadata is encountered.
If LVM is used in the stack, another option is to take an LVM snapshot of the filesystem and run  fsck on it instead.
Finally, there is the option to remount the filesystem as read only. All pending metadata updates (and writes) are then forced to the disk prior to the remount. This ensures the filesystem is in a consistent state, provided there is no previous corruption. It is now possible to run  fsck -n.
The journaling provided by the ext3 file system means that this sort of file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files; rather, it depends on the size of the  journal used to maintain consistency. The default journal size takes about a second to recover, depending on the speed of the hardware.

Note

The only journaling mode in ext3 supported by Red Hat is  data=ordered (default).
Data Integrity
The ext3 file system prevents loss of data integrity in the event that an unclean system shutdown occurs. The ext3 file system allows you to choose the type and level of protection that your data receives. With regard to the state of the file system, ext3 volumes are configured to keep a high level of data consistency by default.
Speed
Despite writing some data more than once, ext3 has a higher throughput in most cases than ext2 because ext3's journaling optimizes hard drive head motion. You can choose from three journaling modes to optimize speed, but doing so means trade-offs in regards to data integrity if the system was to fail.
Easy Transition
It is easy to migrate from ext2 to ext3 and gain the benefits of a robust journaling file system without reformatting. Refer to  Section 5.2, “Converting to an Ext3 File System” for more information on how to perform this task.
The Red Hat Enterprise Linux 6 version of ext3 features the following updates:
Default Inode Sizes Changed
The default size of the on-disk inode has increased for more efficient storage of extended attributes, for example, ACLs or SELinux attributes. Along with this change, the default number of inodes created on a file system of a given size has been decreased. The inode size may be selected with the  mke2fs -I option or specified in  /etc/mke2fs.conf to set system wide defaults for  mke2fs.

Note

If you upgrade to Red Hat Enterprise Linux 6 with the intention of keeping any ext3 file systems intact, there is no need to remake the file system.
New Mount Option:  data_err
A new mount option has been added:  data_err=abort. This option instructs ext3 to abort the journal if an error occurs in a file data (as opposed to metadata) buffer in  data=ordered mode. This option is disabled by default (set as  data_err=ignore).
More Efficient Storage Use
When creating a file system (that is,  mkfs),  mke2fs will attempt to "discard" or "trim" blocks not used by the file system metadata. This helps to optimize SSDs or thinly-provisioned storage. To suppress this behavior, use the  mke2fs -K option.
The following sections cover creating and tuning ext3 partitions. For ext2 partitions, skip the partitioning and formatting sections below and go directly to  Section 5.2, “Converting to an Ext3 File System”.

⁠5.1. Creating an Ext3 File System

After installation, it is sometimes necessary to create a new ext3 file system. For example, if a new disk drive is added to the system, you may want to partition the drive and use the ext3 file system.
The steps for creating an ext3 file system are as follows:

Procedure 5.1. Create an ext3 file system

  1. Format the partition with the ext3 file system using  mkfs.
  2. Label the file system using  e2label.

⁠5.2. Converting to an Ext3 File System

The  tune2fs command converts an  ext2 file system to  ext3.

Note

A default installation of Red Hat Enterprise Linux uses ext4 for all file systems. However, to convert ext2 to ext3, always use the  e2fsck utility to check your file system before and after using  tune2fs. Before trying to convert ext2 to ext3, back up all file systems in case any errors occur.
In addition, Red Hat recommends creating a new ext3 file system and migrating data to it, instead of converting from ext2 to ext3 whenever possible.
To convert an  ext2 file system to  ext3, log in as root and type the following command in a terminal:
# tune2fs -j block_device
block_device contains the ext2 file system to be converted.
A valid block device can be one of two types of entries:
A mapped device
A logical volume in a volume group, for example,  /dev/mapper/VolGroup00-LogVol02.
A static device
A traditional storage volume, for example,  /dev/sdbX, where  sdb is a storage device name and  X is the partition number.
Issue the  df command to display mounted file systems.

⁠5.3. Reverting to an Ext2 File System

In order to revert to an ext2 file system, use the following procedure.
For simplicity, the sample commands in this section use the following value for the block device:
/dev/mapper/VolGroup00-LogVol02

Procedure 5.2. Revert from ext3 to ext2

  1. Unmount the partition by logging in as root and typing:
    # umount /dev/mapper/VolGroup00-LogVol02
  2. Change the file system type to ext2 by typing the following command:
    # tune2fs -O ^has_journal /dev/mapper/VolGroup00-LogVol02
  3. Check the partition for errors by typing the following command:
    # e2fsck -y /dev/mapper/VolGroup00-LogVol02
  4. Then mount the partition again as ext2 file system by typing:
    # mount -t ext2 /dev/mapper/VolGroup00-LogVol02 /mount/point
    In the above command, replace  /mount/point with the mount point of the partition.

    Note

    If a  .journal file exists at the root level of the partition, delete it.
To permanently change the partition to ext2, remember to update the  /etc/fstab file, otherwise it will revert back after booting.

推荐阅读
  • Iris 开发环境配置指南 (最新 Go & IntelliJ IDEA & Iris V12)
    本指南详细介绍了如何在最新的 Go 语言环境及 IntelliJ IDEA 中配置 Iris V12 框架,适合初学者和有经验的开发者。文章提供了详细的步骤说明和示例代码,帮助读者快速搭建开发环境。 ... [详细]
  • 本文档详细介绍了Robot Framework的基础知识、安装配置方法及其实用技巧。从环境搭建到编写第一个测试用例,涵盖了一系列实用的操作指南和最佳实践。 ... [详细]
  • 学习目的:1.了解android线程的使用2.了解主线程与子线程区别3.解析异步处理机制主线程与子线程:所谓主线程,在Windows窗体应用程序中一般指UI线程,这个是程序启动的时 ... [详细]
  • grep、sed、awk一、grep的用法1、grep简介grep是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。grep包 ... [详细]
  • OpenWrt 是一款高度可定制的嵌入式 Linux 发行版,广泛应用于无线路由器等领域,拥有超过百个预装软件包。本文详细探讨如何在 OpenWrt 上通过 Luci 构建自定义模块,以扩展其功能。 ... [详细]
  • 本文详细介绍了 C# 编程语言中 Main 方法的作用、不同形式及其使用场景,帮助开发者更好地理解和应用这一重要概念。 ... [详细]
  • 探索PWA H5 Web App优化之路(Service Worker与Lighthouse的应用)
    本文探讨了如何通过Service Worker和Lighthouse工具来优化PWA H5 Web App,旨在提升用户体验,包括提高加载速度、增强离线访问能力等方面。 ... [详细]
  • Redis 教程01 —— 如何安装 Redis
    本文介绍了 Redis,这是一个由 Salvatore Sanfilippo 开发的键值存储系统。Redis 是一款开源且高性能的数据库,支持多种数据结构存储,并提供了丰富的功能和特性。 ... [详细]
  • 本文将详细介绍如何使用ViewPager实现多页面滑动切换,并探讨如何去掉其默认的左右切换动画效果。ViewPager是Android开发中常用的组件之一,用于实现屏幕间的内容切换。 ... [详细]
  • 深入理解FastDFS
    FastDFS是一款高效、简洁的分布式文件系统,广泛应用于互联网应用中,用于处理大量用户上传的文件,如图片、视频等。本文探讨了FastDFS的设计理念及其如何通过独特的架构设计提高性能和可靠性。 ... [详细]
  • Flutter入门指南:实现自动关闭的对话框与提示
    本文为Flutter系列教程的一部分,专注于讲解如何在Flutter应用中实现自动关闭的对话框和提示。通过具体的代码示例,帮助开发者掌握SnackBar、BottomSheet和Dialog的使用方法。 ... [详细]
  • 使用Python轻松合并大量复杂Excel文件
    当面对大量的Excel文件时,如何高效地将它们合并成一个文件成为了一项挑战。本文将指导初学者如何利用Python的几个库,在几十行代码内完成这一任务。 ... [详细]
  • 本文深入探讨了企业级开发框架NHibernate和Spring.NET的关键特性之一——面向方面编程(AOP)。文章不仅介绍了AOP的基本概念及其如何增强面向对象编程(OOP),还详细说明了Spring.NET中AOP的具体应用,包括事务管理和自定义方面的实现。 ... [详细]
  • 本文详细介绍了RPM包构建过程中Spec文件的结构和各部分的作用,包括包描述、准备阶段、构建过程、安装步骤、清理操作以及文件列表等关键环节。同时,提供了关于RPM宏命令、打包目录结构及常见标签的深入解析。 ... [详细]
  • Python图像处理库概览
    本文详细介绍了Python中常用的图像处理库,包括scikit-image、Numpy、Scipy、Pillow、OpenCV-Python、SimpleCV、Mahotas、SimpleITK、pgmagick和Pycairo,旨在帮助开发者和研究人员选择合适的工具进行图像处理任务。 ... [详细]
author-avatar
僾媙
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有