linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Camille Moncelier <pix@devlife.org>
To: linux-fsdevel@vger.kernel.org
Subject: Re: [ext3] Changes to block device after an ext3 mount point has been remounted readonly
Date: Thu, 18 Feb 2010 17:50:37 +0100	[thread overview]
Message-ID: <baaef4711002180850y4f3b79dibe59d22effad3026@mail.gmail.com> (raw)
In-Reply-To: <baaef4711002180845n29561ccif451fae62e49e520@mail.gmail.com>

Just forgot to post the script:

------------ 8< test.sh 8< ------------
#!/bin/bash

while true; do
    dd bs=1M count=3 if=/dev/zero of=/tmp/sample.img > /tmp/testsha.log  2>&1
    losetup /dev/loop0 /tmp/sample.img               >> /tmp/testsha.log 2>&1
    mkfs.ext3 /dev/loop0                             >> /tmp/testsha.log 2>&1
    mount /dev/loop0 /mnt                            >> /tmp/testsha.log 2>&1
    touch /mnt/test                                  >> /tmp/testsha.log 2>&1
    echo 's' > /proc/sysrq-trigger
    tail -n1 /var/log/messages.log                   >> /tmp/testsha.log 2>&1
    mount -o remount,ro,sync,dirsync /mnt            >> /tmp/testsha.log 2>&1
    dd if=/dev/loop0 of=/tmp/hash1.img               >> /tmp/testsha.log 2>&1
    HASH_1=$(sha1sum /tmp/hash1.img | cut -d" " -f1)
    umount /mnt                                      >> /tmp/testsha.log  2>&1
    dd if=/dev/loop0 of=/tmp/hash2.img               >> /tmp/testsha.log  2>&1
    HASH_2=$(sha1sum /tmp/hash2.img | cut -d" " -f1)
    mount -o ro /dev/loop0 /mnt                      >> /tmp/testsha.log  2>&1
    umount /mnt                                      >> /tmp/testsha.log  2>&1
    dd if=/dev/loop0 of=/tmp/hash3.img               >> /tmp/testsha.log  2>&1
    HASH_3=$(sha1sum /tmp/hash3.img | cut -d" " -f1)
    losetup -d /dev/loop0                            >> /tmp/testsha.log  2>&1

    if [ "$HASH_1" = "$HASH_2" -a "$HASH_1" = "$HASH_3" ] ; then
        rm /tmp/hash{1,2,3}.img
        echo All right !
    else
        echo Something gone wrong:
        cat /tmp/testsha.log
        echo HASH_1: $HASH_1
        echo HASH_2: $HASH_2
        echo HASH_3: $HASH_3
        exit 1
    fi
done
------------ 8< test.sh 8< ------------

----------------- 8< -----------------
$ sudo bash test.sh
All right !
All right !
Something gone wrong:
3+0 records in
3+0 records out
3145728 bytes (3.1 MB) copied, 0.00673144 s, 467 MB/s
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
768 inodes, 3072 blocks
153 blocks (4.98%) reserved for the super user
First data block=1
Maximum filesystem blocks=3145728
1 block group
8192 blocks per group, 8192 fragments per group
768 inodes per group

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Feb 18 17:40:15 graves kernel: EXT3-fs: mounted filesystem with
writeback data mode.
6144+0 records in
6144+0 records out
3145728 bytes (3.1 MB) copied, 0.0271642 s, 116 MB/s
6144+0 records in
6144+0 records out
3145728 bytes (3.1 MB) copied, 0.0315827 s, 99.6 MB/s
6144+0 records in
6144+0 records out
3145728 bytes (3.1 MB) copied, 0.0293324 s, 107 MB/s
HASH_1: 5a08a18d139fced51a874a091c52eb31c36d37b5
HASH_2: 6114873f3ef93a4a2636a04e172dd3a80ea54950
HASH_3: 6114873f3ef93a4a2636a04e172dd3a80ea54950
----------------- 8< -----------------

On Thu, Feb 18, 2010 at 5:45 PM, PiX <pix@devlife.org> wrote:
> I'm experiencing a strange behavior. After having remounted / to
> readonly, I'm doing a sha1sum on /dev/sda1 (which is mounted on /)
> Then, I reboot, GRUB starts the kernel with the ro option, when I do a
> hash of /dev/sda1 the sum has changed.
> This only happen when the rootfs hash been mounted ro, then remounted
> rw to make some changes and remounted ro.
> On the next reboot the hash will change, but only one time. Next
> reboots will not alter the control sum, until of course I remount it
> RW.
> Here's a small shell script that show that some changes are made
> between "mount -o remount,ro" and umount.
> On my system the might run 1 time before failing as well as 20.
> For the record:
> $ uname -a
> Linux cortex 2.6.32-ARCH #1 SMP PREEMPT Tue Feb 9 14:46:08 UTC 2010
> i686 Intel(R) Core(TM)2 Duo CPU E4400 @ 2.00GHz GenuineIntel GNU/Linux
> --
> Camille Moncelier
> http://devlife.org/
>
> If Java had true garbage collection, most programs would
> delete themselves upon execution.
>



-- 
Camille Moncelier
http://devlife.org/

If Java had true garbage collection, most programs would
delete themselves upon execution.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-02-18 16:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 16:45 [ext3] Changes to block device after an ext3 mount point has been remounted readonly PiX
2010-02-18 16:50 ` Camille Moncelier [this message]
2010-02-18 21:41 ` Andreas Dilger
2010-02-19  7:38   ` Camille Moncelier
2010-02-22 22:32     ` Jan Kara
2010-02-22 23:05       ` Jan Kara
2010-02-22 23:09         ` Andreas Dilger
2010-02-23  8:42           ` Camille Moncelier
2010-02-23 13:55             ` Jan Kara
2010-02-24 16:01               ` Dmitry Monakhov
2010-02-24 16:26                 ` Camille Moncelier
2010-02-24 16:59                   ` Jan Kara
2010-02-24 16:56                 ` Jan Kara
2010-03-02  9:34                   ` Christoph Hellwig
2010-03-02 10:01                     ` Dmitry Monakhov
2010-03-02 13:26                       ` Jan Kara
2010-03-02 23:10                     ` Joel Becker
2010-02-24 16:57                 ` Eric Sandeen
2010-02-24 17:05                   ` Jan Kara
2010-02-24 17:26                     ` Dmitry Monakhov
2010-02-24 21:36                       ` Jan Kara
2010-03-02 10:29         ` Nick Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baaef4711002180850y4f3b79dibe59d22effad3026@mail.gmail.com \
    --to=pix@devlife.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).