linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] df -h and hostfs
@ 2005-01-11 10:11 stian
  2005-01-12  0:10 ` Blaisorblade
  0 siblings, 1 reply; 8+ messages in thread
From: stian @ 2005-01-11 10:11 UTC (permalink / raw)
  To: user-mode-linux-devel

when df -h does a statfs, hostfs statfs'es /, instead of the mount-source
directory, so you get the wrong stats about free-space if the mounted
directory does not originate from the / host partition.


Stian


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-11 10:11 [uml-devel] df -h and hostfs stian
@ 2005-01-12  0:10 ` Blaisorblade
  2005-01-12 14:56   ` Henrik Nordstrom
  0 siblings, 1 reply; 8+ messages in thread
From: Blaisorblade @ 2005-01-12  0:10 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: stian

On Tuesday 11 January 2005 11:11, stian@nixia.no wrote:
> when df -h does a statfs, hostfs statfs'es /, instead of the mount-source
> directory,
I.e. the one you see in the mount point inside UML...
> so you get the wrong stats about free-space if the mounted 
> directory does not originate from the / host partition.

Yes, good idea... fixing it like you said will guarantee correct free space 
stats (apart for quotas) but not correct used-space and total-space stats 
(they would be possible only for humfs if it uses some accounting).
> Stian
However, by looking the code, I don't see an obvious way to trigger this 
bug...

In: 
static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
{
We have:
        HOSTFS_I(root_inode)->host_filename = name;
And later, this value is reused (I actually checked this is supposed to refer 
to the same thing) as:
        err = do_statfs(HOSTFS_I(sb->s_root->d_inode)->host_filename,

So, could you double-check? I'll also try to reproduce it, if possible.

Bye
-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
@ 2005-01-12 11:48 stian
  2005-01-12 17:33 ` Blaisorblade
  0 siblings, 1 reply; 8+ messages in thread
From: stian @ 2005-01-12 11:48 UTC (permalink / raw)
  To: user-mode-linux-devel

(ops, forgot reply-all)

df -h inside UML: (/etc/mtab is symlinked to /proc/mounts)

Filesystems           Size  Used Avail Use% Mounted on
rootfs                496M   11M  460M   3% /
/dev/root             496M   11M  460M   3% /
/dev/ubd/disc1/part1  187G  146G   33G  82% /a
a                     7.3G  6.2G  717M  90% /a/lost+found
/root/UML/a           7.3G  6.2G  717M  90% /a/lost+found


mount inside UML:

rootfs on / type rootfs (rw)
/dev/root on / tyoe ext3 (ro)
none on /dev/ type devfs (rw)
/dev/ubd/disc1/part1 on /a type ext2 (rw)
a on /a/lost+found type hostfs (rw)
noen on poroc type proc (rw,nodiratime)


df -h on host:

Filesystems           Size  Used Avail Use% Mounted on
/dev/hda2             7.3G  6.2G  717M  90% /
none                  126M     0  126M   0% /dev/shm
192.168.1.1:/var/home/stian
                      147G  104G   37G  75% /root/UML/a

mount on host

/dev/hda2 on / type xfs (rw,noatime)
none on /dev type devfs (rw)
none on /proc type proc (rw)
noen on /dev/shm type tmpfs (rw)
192.l68.1.1:/var/home/stian on /root/UML/a type nfs (rw,addr=192.168.1.1)


The problem is the nfs partition you can see, that is mounted inside UML
again as hostfs. (This setup is a recovery of a broken disk where I wanted
the cow layer when testing recoverytools and dumping out files they
found). The UML-kernel itself is 2.6.10-rc3-mm1 with the patch-set from
the web-pages dated back 1-2 weeks ago.


Stian




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-12  0:10 ` Blaisorblade
@ 2005-01-12 14:56   ` Henrik Nordstrom
  0 siblings, 0 replies; 8+ messages in thread
From: Henrik Nordstrom @ 2005-01-12 14:56 UTC (permalink / raw)
  To: Blaisorblade; +Cc: user-mode-linux-devel, stian

On Wed, 12 Jan 2005, Blaisorblade wrote:

> Yes, good idea... fixing it like you said will guarantee correct free space
> stats (apart for quotas) but not correct used-space and total-space stats
> (they would be possible only for humfs if it uses some accounting).

It will be as good as if the root was NFS mounted, which is what most 
people expect.

Regards
Henrik


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-12 11:48 stian
@ 2005-01-12 17:33 ` Blaisorblade
  2005-01-12 18:22   ` stian
  0 siblings, 1 reply; 8+ messages in thread
From: Blaisorblade @ 2005-01-12 17:33 UTC (permalink / raw)
  To: user-mode-linux-devel; +Cc: stian

On Wednesday 12 January 2005 12:48, stian@nixia.no wrote:
> (ops, forgot reply-all)
>
> df -h inside UML: (/etc/mtab is symlinked to /proc/mounts)

> Filesystems           Size  Used Avail Use% Mounted on
> rootfs                496M   11M  460M   3% /
> /dev/root             496M   11M  460M   3% /
> /dev/ubd/disc1/part1  187G  146G   33G  82% /a

> a                     7.3G  6.2G  717M  90% /a/lost+found
> /root/UML/a           7.3G  6.2G  717M  90% /a/lost+found
What has happened here? Why there are two entries on the same mount point? One 
mount over the other?

> mount inside UML:

> rootfs on / type rootfs (rw)
> /dev/root on / tyoe ext3 (ro)
> none on /dev/ type devfs (rw)
> /dev/ubd/disc1/part1 on /a type ext2 (rw)
> a on /a/lost+found type hostfs (rw)
> noen on poroc type proc (rw,nodiratime)

How did you mount that folder on /a/lost+found? You wanted, probably, to do:
mount <whatever> > /a/lost+found -t hostfs -o /root/UML/a (or "-o /a", if UML 
is chrooted inside /root/UML).

But it seems that you forgot the -o /root/UML/a part and assumed that could be 
given on the first part... even /proc/mounts contains most mount options. 
I've had just re-checked that even when the root is passed with -o, that is 
used even for the mount-point. And now I've actually ran the test...
> df -h on host:
>
> Filesystems           Size  Used Avail Use% Mounted on
> /dev/hda2             7.3G  6.2G  717M  90% /
> none                  126M     0  126M   0% /dev/shm
> 192.168.1.1:/var/home/stian
>                       147G  104G   37G  75% /root/UML/a

> mount on host

> /dev/hda2 on / type xfs (rw,noatime)
> none on /dev type devfs (rw)
> none on /proc type proc (rw)
> noen on /dev/shm type tmpfs (rw)
> 192.l68.1.1:/var/home/stian on /root/UML/a type nfs (rw,addr=192.168.1.1)

> The problem is the nfs partition you can see, that is mounted inside UML
> again as hostfs. (This setup is a recovery of a broken disk where I wanted
> the cow layer when testing recoverytools and dumping out files they
> found). The UML-kernel itself is 2.6.10-rc3-mm1 with the patch-set from
> the web-pages dated back 1-2 weeks ago.

> Stian


-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-12 17:33 ` Blaisorblade
@ 2005-01-12 18:22   ` stian
  2005-01-12 18:36     ` Blaisorblade
  0 siblings, 1 reply; 8+ messages in thread
From: stian @ 2005-01-12 18:22 UTC (permalink / raw)
  To: Blaisorblade; +Cc: user-mode-linux-devel, stian

>> df -h inside UML: (/etc/mtab is symlinked to /proc/mounts)
>
>> Filesystems           Size  Used Avail Use% Mounted on
>> rootfs                496M   11M  460M   3% /
>> /dev/root             496M   11M  460M   3% /
>> /dev/ubd/disc1/part1  187G  146G   33G  82% /a
>> a                     7.3G  6.2G  717M  90% /a/lost+found
>> /root/UML/a           7.3G  6.2G  717M  90% /a/lost+found
> What has happened here? Why there are two entries on the same mount point?
> One
> mount over the other?

I just used
mount /root/UML/a /a/lost+found -t hostfs
why should you need an -o ? The mount-point works, and everything inside
it looks like it should, and files I put into it appears as they should (I
used that directory, since the uml-filesystem is just banged together som
files from /bin so I could fix a disk, use /bin/sh as init for instance)
An those entries as what likes in /proc/mounts, since I don't have a
maintained /etc/mtab file in that filesystem. /etc/mtab is symlinked to
/proc/mounts

>> mount inside UML:
>
>> rootfs on / type rootfs (rw)
>> /dev/root on / tyoe ext3 (ro)
>> none on /dev/ type devfs (rw)
>> /dev/ubd/disc1/part1 on /a type ext2 (rw)
>> a on /a/lost+found type hostfs (rw)
>> noen on poroc type proc (rw,nodiratime)
>
> How did you mount that folder on /a/lost+found? You wanted, probably, to
> do:
> mount <whatever> > /a/lost+found -t hostfs -o /root/UML/a (or "-o /a", if
> UML
> is chrooted inside /root/UML).
>
> But it seems that you forgot the -o /root/UML/a part and assumed that
> could be
> given on the first part... even /proc/mounts contains most mount options.
> I've had just re-checked that even when the root is passed with -o, that
> is
> used even for the mount-point. And now I've actually ran the test...
>> df -h on host:
>>
>> Filesystems           Size  Used Avail Use% Mounted on
>> /dev/hda2             7.3G  6.2G  717M  90% /
>> none                  126M     0  126M   0% /dev/shm
>> 192.168.1.1:/var/home/stian
>>                       147G  104G   37G  75% /root/UML/a
>
>> mount on host
>
>> /dev/hda2 on / type xfs (rw,noatime)
>> none on /dev type devfs (rw)
>> none on /proc type proc (rw)
>> noen on /dev/shm type tmpfs (rw)
>> 192.l68.1.1:/var/home/stian on /root/UML/a type nfs
>> (rw,addr=192.168.1.1)
>
>> The problem is the nfs partition you can see, that is mounted inside UML
>> again as hostfs. (This setup is a recovery of a broken disk where I
>> wanted
>> the cow layer when testing recoverytools and dumping out files they
>> found). The UML-kernel itself is 2.6.10-rc3-mm1 with the patch-set from
>> the web-pages dated back 1-2 weeks ago.

Stian


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-12 18:22   ` stian
@ 2005-01-12 18:36     ` Blaisorblade
  2005-01-13  9:23       ` stian
  0 siblings, 1 reply; 8+ messages in thread
From: Blaisorblade @ 2005-01-12 18:36 UTC (permalink / raw)
  To: stian; +Cc: user-mode-linux-devel

On Wednesday 12 January 2005 19:22, stian@nixia.no wrote:
> >> df -h inside UML: (/etc/mtab is symlinked to /proc/mounts)
> >>
> >> Filesystems           Size  Used Avail Use% Mounted on
> >> rootfs                496M   11M  460M   3% /
> >> /dev/root             496M   11M  460M   3% /
> >> /dev/ubd/disc1/part1  187G  146G   33G  82% /a
> >> a                     7.3G  6.2G  717M  90% /a/lost+found
> >> /root/UML/a           7.3G  6.2G  717M  90% /a/lost+found
> >
> > What has happened here? Why there are two entries on the same mount
> > point? One
> > mount over the other?

Well, there is a big question - is there in the patchset a "hostfs" or 
"externfs" patch? In that case, if you used the *new* hostfs code, everything 
I said disappears, because that's completely different code.

Only in the other case, you can find below my answer.

> I just used
> mount /root/UML/a /a/lost+found -t hostfs
Hmm, like I supposed. This is the wrong command line. To mount the 
host /root/UML/a, you need to use this syntax:

mount none /a/lost+found -t hostfs -o /root/UML/a

This is the correct syntax.
> why should you need an -o ? The mount-point works, and everything inside
> it looks like it should,

Well, do you claim that it contains only the content of /root/UML/a on the 
host?

I think that this is false, and I just tested this on my UML (2.6.9-bs5):

root@zion:~ (0)# umount /mnt/host/
root@zion:~ (0)# mount /bin/ -t hostfs /mnt/host/
root@zion:~ (0)# ls /mnt/host/
bin/   dev/   etc/   lib/  opt@   root/  sys/  usr/
boot/  disk@  home/  mnt/  proc/  sbin/  tmp/  var/
root@zion:~ (0)# umount /mnt/host/

root@zion:~ (0)# mount none  -t hostfs /mnt/host/ -o /bin
root@zion:~ (0)# ls /mnt/host/
Mail@          df*             install*        pidof@       tar*
root@zion:~ (0)# umount /mnt/host/

Satisfied? If that syntax works on your kernel, something *very* strange is 
happening.
> and files I put into it appears as they should (I 
> used that directory, since the uml-filesystem is just banged together som
> files from /bin so I could fix a disk, use /bin/sh as init for instance)

> An those entries as what likes in /proc/mounts, since I don't have a
> maintained /etc/mtab file in that filesystem. /etc/mtab is symlinked to
> /proc/mounts
Ok, understood, but the duplicate entry still seems a bit strange...

-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [uml-devel] df -h and hostfs
  2005-01-12 18:36     ` Blaisorblade
@ 2005-01-13  9:23       ` stian
  0 siblings, 0 replies; 8+ messages in thread
From: stian @ 2005-01-13  9:23 UTC (permalink / raw)
  To: Blaisorblade; +Cc: stian, user-mode-linux-devel

After I got away the double mounts it seems to be correct. So probably me
that made a mess somewhere that night. I'm done dumping files now so I
could reboot it and recheck the stuff. And the double mounts probably made
the result from df appear wrong, since the kernel walks the mount list
forward when trying to locate the affected filesytems, while all other
file-operations walks it backwards. So it seems to be general
kernel-problem when you have mounted a mount-point two times (Either with
intension or accident)


Stian


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-01-13  9:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 10:11 [uml-devel] df -h and hostfs stian
2005-01-12  0:10 ` Blaisorblade
2005-01-12 14:56   ` Henrik Nordstrom
  -- strict thread matches above, loose matches on Subject: below --
2005-01-12 11:48 stian
2005-01-12 17:33 ` Blaisorblade
2005-01-12 18:22   ` stian
2005-01-12 18:36     ` Blaisorblade
2005-01-13  9:23       ` stian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox