e2fsprogs/util/gen-sample-fs
Theodore Ts'o 47b8941774 e2fsck: make sure system.data xattr is present
E2fsprogs used to assume that if i_size is less than 60 bytes, the
system.data xattr isn't needed (and should be removed).  The kernel
disagree, and will declare the file system to be corrupted.  Enforce
the tighter constraints assumed by the kernel.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-01-31 14:05:45 -05:00

41 lines
1006 B
Bash
Executable File

#!/bin/bash
MNT=/mnt
FS=/tmp/foo.img
cp /dev/null $FS
mke2fs -q -t ext4 -O inline_data,^has_journal -I 256 -b 4096 -N 64 $FS 256
mount -t ext4 $FS $MNT
ln -s symlink_data $MNT/symlink
for i in 30 70 500 1023 1024; do
ln -s /$(perl -e "print 'x' x $i;") $MNT/l_$i
done
touch $MNT/acl
setfacl -m u:daemon:r $MNT/acl
setfacl -m u:bin:rx $MNT/acl
setfacl -m g:mail:rw $MNT/acl
setfacl -m g:daemon:r $MNT/acl
touch $MNT/simple_acl
setfacl -m u:daemon:r $MNT/simple_acl
touch $MNT/xattr
attr -q -s foo -V bar $MNT/xattr
echo -e "one\n\ttwo" | attr -q -s quux $MNT/xattr
echo -e "abc\001\002\003" | attr -q -s def $MNT/xattr
echo file_data > $MNT/small_inline
a="I am a very model of a modern major general;"
a="$a I've information vegetable, animal and mineral"
echo $a > $MNT/big_inline
mkdir $MNT/sdir
touch $MNT/sdir/1
touch $MNT/sdir/2
touch $MNT/sdir/3
touch $MNT/sdir/4
mkdir $MNT/mdir
touch $MNT/mdir/1
touch $MNT/mdir/2
touch $MNT/mdir/3
touch $MNT/mdir/4
touch $MNT/mdir/5
umount $MNT
e2fsck -fp $FS