All of lore.kernel.org
 help / color / mirror / Atom feed
* Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
@ 2007-03-21 19:13 Paul Rolland
  2007-03-21 19:20 ` Valdis.Kletnieks
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Paul Rolland @ 2007-03-21 19:13 UTC (permalink / raw)
  To: 'LKML'

Hello,

I was trying to backup a machine using tar and the --one-file-system option
and I was getting an archive without /dev, but tar was spitting :
/dev: file is on a different filesystem; not dumped

So, I had a look at the code in tar, and the comparison is done on the
stat.st_dev field... 
I then wrote a simple program to stat("/", ...) and stat("/dev", ...),
and got :

For / :
st_dev   : 769
st_ino   : 2
st_mode  : 16877
st_nlink : 23
st_uid   : 0
st_gid   : 0
st_rdev  : 0
st_size  : 4096

For /dev :
st_dev   : 15
st_ino   : 1117
st_mode  : 16877
st_nlink : 23
st_uid   : 0
st_gid   : 0
st_rdev  : 0
st_size  : 165580

So, obviously, tar is right...
man 2 stat says :
       The st_dev field describes the device on which this file resides.

and df -a reports :
[root@host-181 src]# df -a
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1              7936256   3105556   4421048  42% /
proc                         0         0         0   -  /proc
sysfs                        0         0         0   -  /sys
devpts                       0         0         0   -  /dev/pts
tmpfs                   517632         0    517632   0% /dev/shm
/dev/hda5             61787140    237360  58360480   1% /usr/local/witbe
/dev/hda2              4956316    142292   4558192   4% /var/log
none                         0         0         0   -
/proc/sys/fs/binfmt_misc

So, obviously, /dev is on /, but the stat(2) says no.
Who is right, and where is the bug ?

Kernel 2.4 had it right : /dev was on /, no doubt.

Regards,
Paul


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

* Re: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
@ 2007-03-21 19:20 ` Valdis.Kletnieks
  2007-03-21 19:30   ` Paul Rolland
  2007-03-21 19:37 ` Greg KH
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2007-03-21 19:20 UTC (permalink / raw)
  To: rol; +Cc: 'LKML'

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

On Wed, 21 Mar 2007 20:13:50 BST, Paul Rolland said:
>
> So, obviously, tar is right...
> man 2 stat says :
>        The st_dev field describes the device on which this file resides.
> 
> and df -a reports :
> [root@host-181 src]# df -a
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/hda1              7936256   3105556   4421048  42% /

> So, obviously, /dev is on /, but the stat(2) says no.
> Who is right, and where is the bug ?

Might want to 'cat /proc/mounts', and ponder the fact that a filesystem
can be mounted and not listed in /etc/mtab, and then see if your system
has 'udev' installed and enabled.

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

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

* RE: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:20 ` Valdis.Kletnieks
@ 2007-03-21 19:30   ` Paul Rolland
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Rolland @ 2007-03-21 19:30 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: 'LKML'

> Might want to 'cat /proc/mounts', and ponder the fact that a 
> filesystem
> can be mounted and not listed in /etc/mtab, and then see if 
> your system
> has 'udev' installed and enabled.

Damn ! You're right :
cat /proc/mounts | grep dev
none /dev tmpfs rw 0 0

and no, I don't have any udev running, still can't stand it ;)

Thx for the pointer, I was too much trusting df :(

Regards,
Paul
 


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

* Re: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
  2007-03-21 19:20 ` Valdis.Kletnieks
@ 2007-03-21 19:37 ` Greg KH
  2007-03-21 19:59 ` David Schwartz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2007-03-21 19:37 UTC (permalink / raw)
  To: Paul Rolland; +Cc: 'LKML'

On Wed, Mar 21, 2007 at 08:13:50PM +0100, Paul Rolland wrote:
> Hello,
> 
> I was trying to backup a machine using tar and the --one-file-system option
> and I was getting an archive without /dev, but tar was spitting :
> /dev: file is on a different filesystem; not dumped

That is probably because your distro is using udev which usually means
tmpfs is mounted at /dev/

> So, I had a look at the code in tar, and the comparison is done on the
> stat.st_dev field... 
> I then wrote a simple program to stat("/", ...) and stat("/dev", ...),
> and got :

What does /proc/mounts show?

thanks,

greg k-h

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

* RE: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
  2007-03-21 19:20 ` Valdis.Kletnieks
  2007-03-21 19:37 ` Greg KH
@ 2007-03-21 19:59 ` David Schwartz
  2007-03-21 20:58 ` Alistair John Strachan
  2007-03-21 21:32 ` Andreas Schwab
  4 siblings, 0 replies; 7+ messages in thread
From: David Schwartz @ 2007-03-21 19:59 UTC (permalink / raw)
  To: Linux-Kernel@Vger. Kernel. Org


> So, obviously, /dev is on /, but the stat(2) says no.
> Who is right, and where is the bug ?
> 
> Kernel 2.4 had it right : /dev was on /, no doubt.

Have a look at the contents of /proc/mounts and all will be clear.

DS



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

* Re: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
                   ` (2 preceding siblings ...)
  2007-03-21 19:59 ` David Schwartz
@ 2007-03-21 20:58 ` Alistair John Strachan
  2007-03-21 21:32 ` Andreas Schwab
  4 siblings, 0 replies; 7+ messages in thread
From: Alistair John Strachan @ 2007-03-21 20:58 UTC (permalink / raw)
  To: rol; +Cc: 'LKML'

On Wednesday 21 March 2007 19:13, Paul Rolland wrote:
> So, obviously, /dev is on /, but the stat(2) says no.
> Who is right, and where is the bug ?
>
> Kernel 2.4 had it right : /dev was on /, no doubt.

Some distros will mount tmpfs over /dev so that a minimal "real dev" can be 
provided as a fallback, but udev can add and remove nodes from /dev ad hoc 
during regular runtime. So I don't think there's a bug and I don't think 
anything is lying.

If you want the dev your distro gave you, just mount your rootfs on another 
mount point in read-only and run tar over that instead.

-- 
Cheers,
Alistair.

Final year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.

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

* Re: Why is /dev on a different filesystem ? [Kernel 2.6.20.3]
  2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
                   ` (3 preceding siblings ...)
  2007-03-21 20:58 ` Alistair John Strachan
@ 2007-03-21 21:32 ` Andreas Schwab
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2007-03-21 21:32 UTC (permalink / raw)
  To: rol; +Cc: 'LKML'

"Paul Rolland" <rol@as2917.net> writes:

> and df -a reports :
> [root@host-181 src]# df -a
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/hda1              7936256   3105556   4421048  42% /
> proc                         0         0         0   -  /proc
> sysfs                        0         0         0   -  /sys
> devpts                       0         0         0   -  /dev/pts
> tmpfs                   517632         0    517632   0% /dev/shm
> /dev/hda5             61787140    237360  58360480   1% /usr/local/witbe
> /dev/hda2              4956316    142292   4558192   4% /var/log
> none                         0         0         0   -
> /proc/sys/fs/binfmt_misc
>
> So, obviously, /dev is on /, but the stat(2) says no.
> Who is right, and where is the bug ?

Try cat /proc/mounts, apparently when /dev was mounted /etc/mtab wasn't
updated appropriately.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2007-03-21 21:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-21 19:13 Why is /dev on a different filesystem ? [Kernel 2.6.20.3] Paul Rolland
2007-03-21 19:20 ` Valdis.Kletnieks
2007-03-21 19:30   ` Paul Rolland
2007-03-21 19:37 ` Greg KH
2007-03-21 19:59 ` David Schwartz
2007-03-21 20:58 ` Alistair John Strachan
2007-03-21 21:32 ` Andreas Schwab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.