Re: [ext3] Changes to block device after an ext3 mount point has been remounted readonly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux