Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have been having several issues with my ext4 file-systems that seem to be due to jbd2 journaling. I made a related post here and am rephrasing it with the hope that someone may be able to help.

For a minimal example, I start with an empty 8gb USB stick and use gparted to create one ext4 partition. The command used by gparted when creating the ext4 file system is:

mkfs.ext4 -j -O extent -L DataTraveler8gb /dev/sde1

I check the file-system with gparted:

e2fsck -f -y -v /dev/sde1

and I mount it:

sudo mount /dev/sde1 /media/test

The disk is empty, but the journaling is very active on this disk (/dev/sde1). The other disks are ext4 SSDs formatted similarly. A snapshot of iotop:

% sudo iotop -oPa

Total DISK READ: 0.00 B/s | Total DISK WRITE: 2027.21 K/s
  PID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
  262 be/3 root          0.00 B     56.00 K  0.00 %  0.18 % [jbd2/sda1-8]
29069 be/3 root          0.00 B      0.00 B  0.00 %  0.16 % [jbd2/sde1-8]
  891 be/3 root          0.00 B      4.00 K  0.00 %  0.03 % [jbd2/sdc1-8]

What is jbd2 doing with /dev/sde1?

If I follow the same steps with a larger 2Tb disk, iotop indicates this empty disk is constantly being written to by jbd2 at the rate of Mb/s as soon as I mount it.

On the other disks, which have the OS and /home, I have tried to find if any files are being modified by processes to cause this behavior but couldn't find any. I also moved many of the disk intensive process to use a tmpfs. And used noatime.

I have another non-SSD hard disk on this machine, /dev/sdb, that is also ext4 but was not formatted by gparted (given to me by a coworker). It does not appear in iotop. So I am assuming there an issue with gparted.

Any suggestions are appreciated. Also any tips on how to modify existing partitions to fix the issue without having to start from scratch would be great.

There are some posts related to jbd2 but they didn't help (eg. here).

share|improve this question
    
You started iotop before you formatted the disk? In that case it is showing the data written during format. –  jippie Apr 7 '12 at 22:30
    
@jippie I started iotop after formatting the disk(s). The disk in the minimal example is empty. On the similarly formatted disks, the jbd2 activity occurs even if no files are written (checked with find on my whole filesystem). –  Paul Apr 8 '12 at 9:08
    
Did you try mounting it with mount -o noatime ... ...? –  jippie Apr 8 '12 at 9:11
    
I have tried noatime. It didn't seem to do anything. –  Paul Apr 8 '12 at 15:31
    
Might be related: bugs.launchpad.net/ubuntu/+source/linux/+bug/607560 –  Glutanimate Apr 23 '13 at 14:27

1 Answer 1

It seems that ext4 does its 'quick format' by postposting a lot of its initialisation until it is mounted (the uninit_bg option, perhaps?) and I suspect that jbd2 is doing this after you first format the drive. One of the comments here suggested that jbd2 writes to the partition after creation for a time proportional to its size, and suggested 10 minutes per 200 GB, which would indicate 50 minutes per TB. I formatted a 3TB ext4 drive yesterday and jbd2 was writing away for ages, but it has now stopped.

btrfs doesn't do this, btw, but I don't trust it yet for external drives - eg you need a recent kernel (3.4+, I think) or the kernel will oops (and possibly lose data) if you remove the drive without unmounting it first (which of course happens if it loses power).

share|improve this answer
    
Wow, I never thought of that (and somehow I missed it after reading the same thread). I will try to confirm regarding uninit_bg, but if you or someone else is sure, I can mark it answered. –  Paul Jul 2 '12 at 9:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.