Disable (turn off) journaling -- Ext4 Formatted USB Stick

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

Disable (turn off) journaling -- Ext4 Formatted USB Stick

#1 Post by mikeslr »

Hi All,

Puppies employing kernels before 2.6.28 can not read or write to partitions formatted as Linux Ext4.

Not sure where I found the instructions. Not sure if doing so creates more problems than it solves. When USB Sticks became common, there was some concern over how many "writes-to" would end up corrupting them. The last estimate I recall was 100,000, which might not seem like a small number until you recall that if your web-browser's cache or the wordprocessing file your working on is on your USB-stick every time the browser caches a webpage or you save an edit to your document you're writing to your USB-stick.

The original recommendation was to format the USB-key to either Fat32 or Linux Ext2. Ext2 doesn't journalize, and journaling involves writing even more frequently. But running Puppies from a Fat32 partition loose many of its advantages --symlinks out of "Puppy-Space, the use of SaveFolders as examples; and Ext2 partitions are more prone to corruption than Ext3 or Ext4. Ext3 and 4 tracks all changes, so if a system crashes, the possibility of file system corruption is less because of journaling.

The main advantage of Ext3 over Ext4 is that Ext4 can handle file systems in the exobyte range; something not applicable to current USB-sticks. Usually, my preference is to run Puppies from an Ext3 partition on a USB-Stick and replace the most often used Stick whenever I can get one for a good price or the spirit moves me.

That said, if you want to format a stick (or partition) as Ext4 and disable that file systems journaling. here are the instructions. Note that these presume your USB-Stick was recognized by Puppy as sdg1:

# Create ext4 fs on /dev/sdg1 disk [I format using gparted, then open a terminal to tune etc.]

mkfs.ext4 /dev/sdg1

# Enable writeback mode. This mode will typically provide the best ext4 performance.

tune2fs -o journal_data_writeback /dev/sdg1

# Delete has_journal option

tune2fs -O ^has_journal /dev/sdg1

# Required fsck
e2fsck -f /dev/sdg1

# Check fs options

dumpe2fs /dev/sdg1 |more

####### Found the below. Untested by me. Don't really understand it.

For more performance add fstab opions: data=writeback,noatime,nodiratime
i.e:
/dev/sdg1 /opt ext4 defaults,data=writeback,noatime,nodiratime 0 0

Tested at non-boot partition ;) --by original author, not be me.

mikesLr

p310don
Posts: 1492
Joined: Tue 19 May 2009, 23:11
Location: Brisbane, Australia

#2 Post by p310don »

I'm not an expert, but wouldn't disabling journalling in ext3 or ext4 essentially make it ext2? I thought the journalling is what helped avoid data corruption in the event of power failure etc

superchook
Posts: 117
Joined: Mon 13 Mar 2006, 07:39
Location: Sydney, Australia

Disable (turn off) journaling -- Ext4 Formatted USB Stick

#3 Post by superchook »

Ext3 is, indeed, Ext2 with journaling added. Ext4 is a later system. The journal does not prevent data loss but vastly speeds up the filesystem check which is necessary following an unclean shutdown of the filesystem.
The time taken to run a check on a filesystem of under 2 Gb is probably tolerable.
cheers,
Ken

Post Reply