NetAdminTools.com
 
Categories:
GNU/Linux | Homebrew designs | Perl | Ruby | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | ERP | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Ruby
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·ERP
·REALbasic
·All Categories


E is for Ext3fs Part 2
Topic:GNU/Linux ABCs   Date: 2003-01-05
Printer Friendly: Print   Mobile View: mobile

spacerspacer
<<  <   >  >>

Subject

In Part 1 of this article, we discussed some basics of the ext* filesystems in Linux. In this section we'll have some good old filesystem fun. The most commonly used tools for working with Linux filesystems are mke2fs (create ext2/ext3 filesystem), tune2fs (adjust filesystem parameters) and e2fsck (check and repair filesystem.)

ADD JOURNAL TO EXT2
Example: /var doesn't have a journal and really needs one as this host is syslog server for the net and /var is a mess when system crashes.
[root@princess etc]# tune2fs -j /dev/hda3
tune2fs 1.27 (8-Mar-2002)
Creating journal inode: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Be sure to change "ext2" to "ext3" in /etc/fstab for the next reboot.

OVERRIDE AUTOMATIC FILESYSTEM CHECKS
CAUTION! Although this may be desirable for large file systems with journals which can take hours to fsck, remember that filesystem corruption can be caused by hardware failures or kernel bugs that might go unnoticed if not for the periodic filesystem checks at reboot. Replaying your journal won't help you in these cases! If you disable them, send yourself a cron job to remind yourself to schedule downtime to check the filesystem manually a couple times a year at least.
Example: 180 GB file system with journal. Takes hours to fsck.

[root@duchess root]# tune2fs -c 0 -i 0 /dev/md0
tune2fs 1.27 (8-Mar-2002)
Setting maximal mount count to -1
Setting interval between check 0 seconds

By the way, you can view your filesystem settings by running:

tune2fs -l /dev/device

SET JOURNAL MODE MOUNT OPTIONS
There are three mount options for the journal modes. They are:
data=writeback -- does no journalling of data; metadata only. fastest. data corruption possible in system crash.
data=ordered -- default. strictly speaking only journals metadata but uses transactions to protect data as well. slightly slower than writeback mode. Because of the way the blocks to be written to disk are ordered in this mode, it offers all the protection of full data journalling mode when files are being appended to; corruption is possible when files are being overwritten.
data=journal -- full journalling of data and metadata. Should be slowest because data is written twice, once to journal & once to final location. However some tests have shown that its performance surpasses the other two modes in busy interactive environments where disks are being read from & written to at same time. Also requires the largest disk footprint for journal.
Example: Change journal mode to data=writeback for a filesystem containing database files where i/o performance has to be great. Risk of corruption is mitigated by the fact that the db is keeping redo logs on separate filesystem. Not that I'm recommending this.

1. Edit /etc/fstab
change this:
LABEL=/u01              /u01                    ext3    defaults        1 2
to this:
LABEL=/u01              /u01                    ext3    data=writeback  1 2
2. Unmount the filesystem, then remount it. The output of mount now shows the specified mount option:
[root@countess root]# mount
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda7 on /opt type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda6 on /tmp type ext3 (rw)
/dev/sda3 on /usr type ext3 (rw)
/dev/sda5 on /var type ext3 (rw)
/dev/sdb1 on /u01 type ext3 (rw,data=writeback)


Familiarize yourself by reading the tune2fs and mke2fs man pages with options that are tuneable and options that can only be set at filesystem creation time, like the number of inodes. And be very very careful when manipulating the filesystems on any production system.

People:
Places:
Things:
Times:





Please read our Terms of Use and our Privacy Policy
Microsoft, Windows, Windows Server are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2013 NetAdminTools.com