Re: ext4 inode tagging

Corey Wright <[email protected]>
Newsgroups gmane.linux.vserver
Message-ID <[email protected]>
On Sat, 14 Jan 2012 11:47:13 +0100
Roberto Puzzanghera <[email protected]> wrote:

> On 01/14/2012 11:14 AM, Herbert Poetzl wrote:
> > On Sat, Jan 14, 2012 at 09:47:19AM +0100, Roberto Puzzanghera wrote:
> >> On 01/14/2012 12:48 AM, Herbert Poetzl wrote:
> >>> On Fri, Jan 13, 2012 at 07:26:13PM +0100, Roberto Puzzanghera wrote:
> >>>> On 01/13/2012 06:02 PM, Herbert Poetzl wrote:
> >>>>> On Fri, Jan 13, 2012 at 05:10:46PM +0100, Roberto Puzzanghera wrote:
> >>>>>> [...]
> >
> >>>>>>> no, I don't think that will be necessary, but
> >>>>>>> could you run the following script on your system
> >>>>>>> and provide upload the output somewhere/
> >
> >>>>>>>   # mkdir /test
> >>>>>>>   # testfs.sh -vvv -x -F ext4 -M /test -D<device>
> >
> >>>>>>> note that<device>     should be a partition, disk or
> >>>>>>> loopback device you do not mind to be reformatted
> >>>>>>> with ext4 (all data will be destroyed)
> >
> >>>>>>> you can simply create one with:
> >>>>>>>   # dd if=/dev/zero of=/path/to/somewhere bs=1M count=1024
> >>>>>>>   # losetup /dev/loop0 /path/to/somewhere
> >
> >>>>>>> also, no problem to use /mnt or /media/test instead
> >>>>>>> of just /test (i.e. it doesn't matter as long as
> >>>>>>> you specify the path in -M<path>)
> >
> >>>>>>> the test script can be found here:
> >>>>>>> http://vserver.13thfloor.at/Stuff/SCRIPT/testfs.sh
> >
> >>>> # dd if=/dev/zero of=/mnt/testfs bs=1M count=1024
> >>>> # losetup /dev/loop0 /mnt/testfs
> >>>> # mount -t ext4 /dev/loop0 /mnt/tmp/
> >>>> # testfs.sh -vvv -x -F ext4 -M /mnt/tmp/ -D /dev/loop0
> >
> >>> do not mount any filesystem on /mnt/tmp and do not
> >>> mount or busy /dev/loop0 in any way, filesystem
> >>> creation and mounting will be done by testfs.sh
> >
> >> The output follows
> >
> >> best regards
> >> Roberto Puzzanghera
> >
> >
> >> # dd if=/dev/zero of=/usr/local/testfs bs=1M count=1024
> >> # losetup /dev/loop0 /usr/local/testfs
> >> # ./testfs.sh -vvv -x -F ext4 -M /mnt -D /dev/loop0
> >> Linux-VServer FS Test [V0.23] Copyright (C) 2005-2009 H.Poetzl
> >> Linux 3.1.4-vs2.3.2.1-smp x86_64/0.30.216
> >> VCI:  0002:0308 236 13000f11 (ID24)
> >> ---
> >> testing ext4 filesystem ...
> >> mke2fs 1.41.14 (22-Dec-2010)
> >> Filesystem label=
> >> OS type: Linux
> >> Block size=4096 (log=2)
> >> Fragment size=4096 (log=2)
> >> Stride=0 blocks, Stripe width=0 blocks
> >> 65536 inodes, 262144 blocks
> >> 13107 blocks (5.00%) reserved for the super user
> >> First data block=0
> >> Maximum filesystem blocks=268435456
> >> 8 block groups
> >> 32768 blocks per group, 32768 fragments per group
> >> 8192 inodes per group
> >> Superblock backups stored on blocks:
> >>          32768, 98304, 163840, 229376
> >
> >> Writing inode tables: done
> >> Creating journal (8192 blocks): done
> >> Writing superblocks and filesystem accounting information: done
> >
> >> This filesystem will be automatically checked every 24 mounts or
> >> 180 days, whichever comes first.  Use tune2fs -c or -i to override.
> >> [000]# succeeded.
> >>          mount -t ext4 -o rw /dev/loop0 /mnt 3>&2
> >> [001]# succeeded.
> >>          mount -o remount,rw,tag /mnt 3>&2
> >> mount: /mnt not mounted already, or bad option
> >> [002]# succeeded.
> >> tag related tests ...
> >>          mount -t ext4 -o rw,tag /dev/loop0 /mnt 3>&2
> >> [011]# succeeded.
> >>          do_tag_touch /mnt 0 1 255 256 666
> >>          touch /mnt/file_1: 0
> >>          vtag --migrate --tag 0 -- touch /mnt/file_1
> >>          touch /mnt/file_2: 1
> >>          vtag --migrate --tag 1 -- touch /mnt/file_2
> >>          touch /mnt/file_3: 255
> >>          vtag --migrate --tag 255 -- touch /mnt/file_3
> >>          touch /mnt/file_4: 256
> >>          vtag --migrate --tag 256 -- touch /mnt/file_4
> >>          touch /mnt/file_5: 666
> >>          vtag --migrate --tag 666 -- touch /mnt/file_5
> >> [012]# succeeded.
> >>          do_tag_verify /mnt 0 1 255 256 666
> >>          verify /mnt/file_1: 0 = 0
> >>          verify /mnt/file_2: 1 = 1
> >>          verify /mnt/file_3: 255 = 255
> >>          verify /mnt/file_4: 256 = 256
> >>          verify /mnt/file_5: 666 = 666
> >> [014]# succeeded.
> >
> > this shows that tagging on ext4 works perfectly fine,
> > please verify (with 'cat /proc/mounts' on the host)
> > that your filesystem is indeed mounted with the 'tag'
> > option when you try to do tagging related operations
> >
> > note: it was observed that, for yet unknown reasons,
> > sometimes the 'tag' option isn't used/recognized
> > despite the fact that it is present in host/guest
> > fstab ...
> >
> > HTH,
> > Herbert
> 
> yes, it's seems this is the case. I have the tag option in my fstab, but:
> 
> # cat /proc/mounts
> /dev/sda3 /usr/local ext4 
> rw,relatime,user_xattr,barrier=1,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group 
> 0 0

roberto, are you wanting to use disk limits
(http://linux-vserver.org/Disk_Limits_and_Quota) or user/group quotas
(http://linux-vserver.org/Quotas) on ext4?

you said you were "following the howto on the wiki" and that included
mounting with "-o tag".  the disk limits wiki page details mounting with "-o
tag" (and appears to be the only wiki page that includes that:
http://www.google.com/search?q=site:linux-vserver.org+%22-o+tag%22) and disk
limits haven't worked on ext4 for some time
(http://list.linux-vserver.org/archive?mss:4959:201104:cnkmighjiiigipolfgel
and attached log).

but in your mount options you are using jqfmt, usrjquota, & grpjquota, which
is for (journalling) user/group quotas, not "disk limits".  if you want
user/group quotas, then i don't believe tagging is necessary (or at least the
linux-vserver quotas wiki page doesn't specify such).

if you can clarify what you are trying to accomplish (ie "user/group quotas"
or "disk limits"), then your problem can probably be addressed more quickly
(eg if you want to do disk limits on ext4, then i could have told you it
probably doesn't work as testfs.sh says it "fails" from at least 2.6.35
through the latest 3.0.16 and following the disk limit instructions
probably won't enable user/group quotas).

corey
--
[email protected]

> tonight I will try to fix and let you know
> 
> thank you, best regards
> Roberto Puzzanghera
testfs.log (application/octet-stream, 7.4 KB)
root@vserver-squeeze-amd64:~# FSIMG="$(tempfile)"
root@vserver-squeeze-amd64:~# dd bs=1024k count=50 if=/dev/zero of="${FSIMG}"
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.139102 s, 377 MB/s
root@vserver-squeeze-amd64:~# losetup -f "${FSIMG}"
root@vserver-squeeze-amd64:~# LOOPDEV="$(losetup -j "${FSIMG}" | cut -d: -f1)"
root@vserver-squeeze-amd64:~# testfs.sh -vvv -z -F ext4 -M /mnt -D "${LOOPDEV}" -n
Linux-VServer FS Test [V0.23] Copyright (C) 2005-2009 H.Poetzl
Linux 3.0.16-vs2.3.2.1+1-k8-x6 x86_64/0.30.216
VCI:  0002:0308 236 13001f11 (ID24)
---
testing ext4 filesystem ...
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
12824 inodes, 51200 blocks
2560 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=52428800
7 block groups
8192 blocks per group, 8192 fragments per group
1832 inodes per group
Superblock backups stored on blocks: 
	8193, 24577, 40961

Writing inode tables: 0/71/72/73/74/75/76/7done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[000]# succeeded.
	mount -t ext4 -o rw /dev/loop0 /mnt 3>&2
[001]# succeeded.
	mount -o remount,rw,tag /mnt 3>&2
mount: /mnt not mounted already, or bad option
[002]# succeeded.
disk limit related tests ...
	do_dlimit_add /mnt 32 5 300 301 600 900
[201]# succeeded.
	do_dlimit_space /mnt 16 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/space-300*
	vtag --migrate --tag 300 -- dd if=/dev/zero of=/mnt/space-300 bs=1k count=16
16+0 records in
16+0 records out
16384 bytes (16 kB) copied, 7.9378e-05 s, 206 MB/s
[202]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space 17 = 16
	verify 300: 17 ~ 16
	verify 300: inode 1 = 1
[203]# failed.
	do_dlimit_inodes /mnt 3 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/inodes-300*
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-1
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-2
[204]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space 0 = 0
	verify 300: inode 2 = 2
[205]# succeeded.
	do_dlimit_space /mnt 33 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/space-300
	vtag --migrate --tag 300 -- dd if=/dev/zero of=/mnt/space-300 bs=1k count=33
dd: writing `/mnt/space-300': No space left on device
33+0 records in
32+0 records out
32768 bytes (33 kB) copied, 0.00391376 s, 8.4 MB/s
[206]# succeeded.
	do_dlimit_inodes /mnt 6 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/inodes-300-1 /mnt/inodes-300-2
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-1
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-2
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-3
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-4
	vtag --migrate --tag 300 -- touch /mnt/inodes-300-5
touch: cannot touch `/mnt/inodes-300-5': No space left on device
[207]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space 16 = 16
	verify 300: inode 2 = 2
[208]# succeeded.
	do_dlimit_add /mnt 128 10 300 301 600 900
[211]# succeeded.
	do_dlimit_cowtest /mnt 5 9 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/cow-300*
	vtag --migrate --tag 300 -- dd if=/dev/zero of=/mnt/cow-300 bs=1k count=5
5+0 records in
5+0 records out
5120 bytes (5.1 kB) copied, 4.8787e-05 s, 105 MB/s
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-0
	vtag --migrate --tag 300 -- touch /mnt/cow-300-0
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-1
	vtag --migrate --tag 300 -- touch /mnt/cow-300-1
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-2
	vtag --migrate --tag 300 -- touch /mnt/cow-300-2
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-3
	vtag --migrate --tag 300 -- touch /mnt/cow-300-3
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-4
	vtag --migrate --tag 300 -- touch /mnt/cow-300-4
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-5
	vtag --migrate --tag 300 -- touch /mnt/cow-300-5
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-6
	vtag --migrate --tag 300 -- touch /mnt/cow-300-6
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-7
	vtag --migrate --tag 300 -- touch /mnt/cow-300-7
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-8
	vtag --migrate --tag 300 -- touch /mnt/cow-300-8
[212]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space 51 = 50
	verify 300: 51 ~ 50
	verify 300: inode 10 = 10
[213]# failed.
	do_dlimit_cowtest /mnt 43 3 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/cow-300 /mnt/cow-300-0 /mnt/cow-300-1 /mnt/cow-300-2 /mnt/cow-300-3 /mnt/cow-300-4 /mnt/cow-300-5 /mnt/cow-300-6 /mnt/cow-300-7 /mnt/cow-300-8
	vtag --migrate --tag 300 -- dd if=/dev/zero of=/mnt/cow-300 bs=1k count=43
43+0 records in
43+0 records out
44032 bytes (44 kB) copied, 0.00014298 s, 308 MB/s
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-0
	vtag --migrate --tag 300 -- touch /mnt/cow-300-0
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-1
	vtag --migrate --tag 300 -- touch /mnt/cow-300-1
touch: cannot touch `/mnt/cow-300-1': No space left on device
[222]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space 36 = 36
	verify 300: inode -8 = -8
[223]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space -51 = -50
	verify 300: -51 ~ -50
	verify 300: inode -10 = -10
[231]# failed.
	do_dlimit_cowtest /mnt 3 43 300 301 600 900
	vtag --migrate --tag 300 -- rm -f /mnt/cow-300*
	vtag --migrate --tag 300 -- dd if=/dev/zero of=/mnt/cow-300 bs=1k count=3
3+0 records in
3+0 records out
3072 bytes (3.1 kB) copied, 4.1292e-05 s, 74.4 MB/s
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-0
	vtag --migrate --tag 300 -- touch /mnt/cow-300-0
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-1
	vtag --migrate --tag 300 -- touch /mnt/cow-300-1
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-2
	vtag --migrate --tag 300 -- touch /mnt/cow-300-2
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-3
	vtag --migrate --tag 300 -- touch /mnt/cow-300-3
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-4
	vtag --migrate --tag 300 -- touch /mnt/cow-300-4
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-5
	vtag --migrate --tag 300 -- touch /mnt/cow-300-5
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-6
	vtag --migrate --tag 300 -- touch /mnt/cow-300-6
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-7
	vtag --migrate --tag 300 -- touch /mnt/cow-300-7
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-8
	vtag --migrate --tag 300 -- touch /mnt/cow-300-8
	vtag --migrate --tag 300 -- ln /mnt/cow-300 /mnt/cow-300-9
	vtag --migrate --tag 300 -- touch /mnt/cow-300-9
touch: cannot touch `/mnt/cow-300-9': No space left on device
[232]# succeeded.
	do_dlimit_verify /mnt 300 301 600 900
	verify 300: space -20 = -20
	verify 300: inode 0 = 0
[233]# succeeded.
	do_fsck ext4 /dev/loop0 3>&2
/dev/loop0: 26/12824 files (3.8% non-contiguous), 6594/51200 blocks
[239]# succeeded.
	do_fsck ext4 /dev/loop0 3>&2
/dev/loop0: 26/12824 files (3.8% non-contiguous), 6594/51200 blocks
[999]# succeeded.
root@vserver-squeeze-amd64:~# losetup -d "${LOOPDEV}"
root@vserver-squeeze-amd64:~# rm -f "${FSIMG}"
root@vserver-squeeze-amd64:~# exit
exit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.