* getting UUID and label of a filesystem
@ 2003-11-06 20:46 Boyd Waters
2003-11-06 20:54 ` Brian Tinsley
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Boyd Waters @ 2003-11-06 20:46 UTC (permalink / raw)
To: reiserfs-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Perhaps this is obvious, but I cannot find a way to print out the UUID
or the label of a mounted reiser filesystem, in a manner similar to
xfs_admin.
Best way to do this?
On a mounted filesystem?
As non-root user?
Thanks!
~ - boyd
Boyd Waters
http://www.aoc.nrao.edu/~bwaters
National Radio Astronomy Observatory
Socorro, New Mexico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/qrMw0is8k1r0QeURAhekAJ9N7Q7USe7Hull5ydP99vdS/uYO2gCgrj0v
v5MuJNmUlLEJyYWUaVjqn2M=
=J7uc
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: getting UUID and label of a filesystem
2003-11-06 20:46 getting UUID and label of a filesystem Boyd Waters
@ 2003-11-06 20:54 ` Brian Tinsley
2003-11-10 20:07 ` John Dalbec
2003-11-06 20:57 ` Redeeman
2003-11-06 21:07 ` Andreas Dilger
2 siblings, 1 reply; 18+ messages in thread
From: Brian Tinsley @ 2003-11-06 20:54 UTC (permalink / raw)
To: reiserfs-list
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
On Thu, 2003-11-06 at 14:46, Boyd Waters wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Perhaps this is obvious, but I cannot find a way to print out the UUID
> or the label of a mounted reiser filesystem, in a manner similar to
> xfs_admin.
>
> Best way to do this?
debugreiserfs /dev/xxx
>
> On a mounted filesystem?
Yes.
>
> As non-root user?
Doubtful
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 20:54 ` Brian Tinsley
@ 2003-11-10 20:07 ` John Dalbec
2003-11-10 20:14 ` Mike Fedyk
0 siblings, 1 reply; 18+ messages in thread
From: John Dalbec @ 2003-11-10 20:07 UTC (permalink / raw)
To: Brian Tinsley; +Cc: reiserfs-list
Brian Tinsley wrote:
> On Thu, 2003-11-06 at 14:46, Boyd Waters wrote:
>
>
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>Perhaps this is obvious, but I cannot find a way to print out the UUID
>>or the label of a mounted reiser filesystem, in a manner similar to
>>xfs_admin.
>>
>>Best way to do this?
>
>
>
> debugreiserfs /dev/xxx
>
>
>
>>On a mounted filesystem?
>
>
>
> Yes.
>
>
>
>>As non-root user?
I've added myself to the "disk" group and it works for me as non-root. You just
need read access to the raw device, no?
John
>
>
>
> Doubtful
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 20:07 ` John Dalbec
@ 2003-11-10 20:14 ` Mike Fedyk
2003-11-10 20:40 ` Boyd Waters
0 siblings, 1 reply; 18+ messages in thread
From: Mike Fedyk @ 2003-11-10 20:14 UTC (permalink / raw)
To: John Dalbec; +Cc: Brian Tinsley, reiserfs-list
On Mon, Nov 10, 2003 at 03:07:40PM -0500, John Dalbec wrote:
> I've added myself to the "disk" group and it works for me as non-root. You
> just need read access to the raw device, no?
Yes.
But how many need access to the UUID information? That can be a big
security hole...
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 20:14 ` Mike Fedyk
@ 2003-11-10 20:40 ` Boyd Waters
2003-11-10 21:05 ` Bennett Todd
0 siblings, 1 reply; 18+ messages in thread
From: Boyd Waters @ 2003-11-10 20:40 UTC (permalink / raw)
To: reiserfs-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mike Fedyk wrote:
| On Mon, Nov 10, 2003 at 03:07:40PM -0500, John Dalbec wrote:
|
|>I've added myself to the "disk" group and it works for me as non-root.
You
|>just need read access to the raw device, no?
|
|
| Yes.
|
| But how many need access to the UUID information? That can be a big
| security hole...
Cool discussion.
Um, can you point me to info regarding security holes in exposing the
UUID of a filesystem? I can't come up with a use-case that would support
this statement, but I'm willing to believe there is such.
I am using UUID's to track the source filesystem of a large
distributed-backup; I have lots of copies of stuff strewn across various
filesystems and I am in the process of pouring it all into a centralized
version-control system (Subversion). I can set arbitrary name=value tags
on the versioned files, and I'm currently setting one of them to the
source filesystem's UUID.
(Later, I'll start another thread which explores how to use ReiserFS
features to support Subversion, without an intervening database layer...)
So: What's the security hole in exposing the filesystem UUID?
~ - boyd
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/r/ez0is8k1r0QeURAvvjAJsFAKITHuQUcPhdS14/VecHvDL31wCfVEIs
4B+HXCitmX4m3QpVH5I/g7c=
=J0yK
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 20:40 ` Boyd Waters
@ 2003-11-10 21:05 ` Bennett Todd
2003-11-11 0:12 ` Mike Fedyk
0 siblings, 1 reply; 18+ messages in thread
From: Bennett Todd @ 2003-11-10 21:05 UTC (permalink / raw)
To: Boyd Waters; +Cc: reiserfs-list
[-- Attachment #1: Type: text/plain, Size: 734 bytes --]
2003-11-10T15:40:19 Boyd Waters:
> Mike Fedyk wrote:
> > On Mon, Nov 10, 2003 at 03:07:40PM -0500, John Dalbec wrote:
> > > I've added myself to the "disk" group and it works for me as
> > > non-root. You just need read access to the raw device, no?
> >
> > Yes.
> > But how many need access to the UUID information? That can be a
> > big security hole...
>
> Um, can you point me to info regarding security holes in exposing
> the UUID of a filesystem?
Interesting. I read Mike's response to be talking about the security
consequences of having lots of users able to read the raw disk
device, and thereby bypass any access control mechanisms the
filesystem might implement (including even normal Unix file
permissions).
-Bennett
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 21:05 ` Bennett Todd
@ 2003-11-11 0:12 ` Mike Fedyk
0 siblings, 0 replies; 18+ messages in thread
From: Mike Fedyk @ 2003-11-11 0:12 UTC (permalink / raw)
To: Bennett Todd; +Cc: Boyd Waters, reiserfs-list
On Mon, Nov 10, 2003 at 04:05:13PM -0500, Bennett Todd wrote:
> 2003-11-10T15:40:19 Boyd Waters:
> > Mike Fedyk wrote:
> > > On Mon, Nov 10, 2003 at 03:07:40PM -0500, John Dalbec wrote:
> > > > I've added myself to the "disk" group and it works for me as
> > > > non-root. You just need read access to the raw device, no?
> > >
> > > Yes.
> > > But how many need access to the UUID information? That can be a
> > > big security hole...
> >
> > Um, can you point me to info regarding security holes in exposing
> > the UUID of a filesystem?
>
> Interesting. I read Mike's response to be talking about the security
> consequences of having lots of users able to read the raw disk
> device, and thereby bypass any access control mechanisms the
> filesystem might implement (including even normal Unix file
> permissions).
Yes, that's exactly what I meant. Sorry for the non-exact wording.
Mike
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 20:46 getting UUID and label of a filesystem Boyd Waters
2003-11-06 20:54 ` Brian Tinsley
@ 2003-11-06 20:57 ` Redeeman
2003-11-06 21:03 ` Brian Tinsley
2003-11-06 21:07 ` Andreas Dilger
2 siblings, 1 reply; 18+ messages in thread
From: Redeeman @ 2003-11-06 20:57 UTC (permalink / raw)
To: Reiserfs Mailinglist
now you talk about label, how to change a label?
On Thu, 2003-11-06 at 21:46, Boyd Waters wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Perhaps this is obvious, but I cannot find a way to print out the UUID
> or the label of a mounted reiser filesystem, in a manner similar to
> xfs_admin.
>
> Best way to do this?
>
> On a mounted filesystem?
>
> As non-root user?
>
> Thanks!
>
> ~ - boyd
>
> Boyd Waters
> http://www.aoc.nrao.edu/~bwaters
> National Radio Astronomy Observatory
> Socorro, New Mexico
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE/qrMw0is8k1r0QeURAhekAJ9N7Q7USe7Hull5ydP99vdS/uYO2gCgrj0v
> v5MuJNmUlLEJyYWUaVjqn2M=
> =J7uc
> -----END PGP SIGNATURE-----
--
Regards, Redeeman
() ascii ribbon campaign - against html e-mail
/\ - against microsoft attachments
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 20:57 ` Redeeman
@ 2003-11-06 21:03 ` Brian Tinsley
2003-11-10 20:01 ` John Dalbec
0 siblings, 1 reply; 18+ messages in thread
From: Brian Tinsley @ 2003-11-06 21:03 UTC (permalink / raw)
To: reiserfs-list
[-- Attachment #1: Type: text/plain, Size: 978 bytes --]
reiserfstune --label <new label> /dev/xxx
That ought to do it ;)
On Thu, 2003-11-06 at 14:57, Redeeman wrote:
> now you talk about label, how to change a label?
>
> On Thu, 2003-11-06 at 21:46, Boyd Waters wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Perhaps this is obvious, but I cannot find a way to print out the UUID
> > or the label of a mounted reiser filesystem, in a manner similar to
> > xfs_admin.
> >
> > Best way to do this?
> >
> > On a mounted filesystem?
> >
> > As non-root user?
> >
> > Thanks!
> >
> > ~ - boyd
> >
> > Boyd Waters
> > http://www.aoc.nrao.edu/~bwaters
> > National Radio Astronomy Observatory
> > Socorro, New Mexico
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.3 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQE/qrMw0is8k1r0QeURAhekAJ9N7Q7USe7Hull5ydP99vdS/uYO2gCgrj0v
> > v5MuJNmUlLEJyYWUaVjqn2M=
> > =J7uc
> > -----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 21:03 ` Brian Tinsley
@ 2003-11-10 20:01 ` John Dalbec
2003-11-10 20:42 ` Andreas Dilger
0 siblings, 1 reply; 18+ messages in thread
From: John Dalbec @ 2003-11-10 20:01 UTC (permalink / raw)
To: Brian Tinsley; +Cc: reiserfs-list
I set labels on my ReiserFS filesystems, but I can't use LABEL= in /etc/fstab.
I thought that was the point of having filesystem labels. Is there some
configuration setting that I'm missing?
Thanks,
John
Brian Tinsley wrote:
> reiserfstune --label <new label> /dev/xxx
>
> That ought to do it ;)
>
>
> On Thu, 2003-11-06 at 14:57, Redeeman wrote:
>
>
>>now you talk about label, how to change a label?
>>
>>On Thu, 2003-11-06 at 21:46, Boyd Waters wrote:
>>
>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>Hash: SHA1
>>>
>>>Perhaps this is obvious, but I cannot find a way to print out the UUID
>>>or the label of a mounted reiser filesystem, in a manner similar to
>>>xfs_admin.
>>>
>>>Best way to do this?
>>>
>>>On a mounted filesystem?
>>>
>>>As non-root user?
>>>
>>>Thanks!
>>>
>>>~ - boyd
>>>
>>>Boyd Waters
>>>http://www.aoc.nrao.edu/~bwaters
>>>National Radio Astronomy Observatory
>>>Socorro, New Mexico
>>>
>>>-----BEGIN PGP SIGNATURE-----
>>>Version: GnuPG v1.2.3 (GNU/Linux)
>>>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>>iD8DBQE/qrMw0is8k1r0QeURAhekAJ9N7Q7USe7Hull5ydP99vdS/uYO2gCgrj0v
>>>v5MuJNmUlLEJyYWUaVjqn2M=
>>>=J7uc
>>>-----END PGP SIGNATURE-----
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 20:01 ` John Dalbec
@ 2003-11-10 20:42 ` Andreas Dilger
2003-11-12 13:35 ` John Dalbec
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Dilger @ 2003-11-10 20:42 UTC (permalink / raw)
To: John Dalbec; +Cc: Brian Tinsley, reiserfs-list
On Nov 10, 2003 15:01 -0500, John Dalbec wrote:
> I set labels on my ReiserFS filesystems, but I can't use LABEL= in /etc/fstab.
> I thought that was the point of having filesystem labels. Is there some
> configuration setting that I'm missing?
"mount" has not been updated to use libblkid. I had always intended on
doing that, but it was never in the top 10 on my todo list. I had agreement
in principle from Andries Brouwer to use a libblkid in mount instead of
having a duplicate set of LABEL/UUID parsing code there, but just lacked
the time/incentive to do that part.
It would probably benefit all reiserfs users to get this working, so that
you can finally mount reiserfs filesystems by LABEL/UUID, so if someone
has some time and wants to contribute back to reiserfs this is a fairly
easy project (not kernel hacking ;-).
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 20:42 ` Andreas Dilger
@ 2003-11-12 13:35 ` John Dalbec
2003-11-12 15:32 ` Brian Tinsley
0 siblings, 1 reply; 18+ messages in thread
From: John Dalbec @ 2003-11-12 13:35 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Brian Tinsley, reiserfs-list
Andreas Dilger wrote:
> "mount" has not been updated to use libblkid. I had always intended on
> doing that, but it was never in the top 10 on my todo list. I had agreement
> in principle from Andries Brouwer to use a libblkid in mount instead of
> having a duplicate set of LABEL/UUID parsing code there, but just lacked
> the time/incentive to do that part.
>
> It would probably benefit all reiserfs users to get this working, so that
> you can finally mount reiserfs filesystems by LABEL/UUID, so if someone
> has some time and wants to contribute back to reiserfs this is a fairly
> easy project (not kernel hacking ;-).
Brian Tinsley wrote:
> I use labels on SuSE with no problem. Could be an incompatibility with
> your mount command, but I'm not sure.
Has SuSE already updated the mount command to use libblkid then? Or did they
insert duplicate LABEL/UUID parsing code for ReiserFS?
John
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-12 13:35 ` John Dalbec
@ 2003-11-12 15:32 ` Brian Tinsley
0 siblings, 0 replies; 18+ messages in thread
From: Brian Tinsley @ 2003-11-12 15:32 UTC (permalink / raw)
To: John Dalbec; +Cc: Andreas Dilger, reiserfs-list
[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]
On Wed, 2003-11-12 at 07:35, John Dalbec wrote:
> Andreas Dilger wrote:
> > "mount" has not been updated to use libblkid. I had always intended on
> > doing that, but it was never in the top 10 on my todo list. I had agreement
> > in principle from Andries Brouwer to use a libblkid in mount instead of
> > having a duplicate set of LABEL/UUID parsing code there, but just lacked
> > the time/incentive to do that part.
> >
> > It would probably benefit all reiserfs users to get this working, so that
> > you can finally mount reiserfs filesystems by LABEL/UUID, so if someone
> > has some time and wants to contribute back to reiserfs this is a fairly
> > easy project (not kernel hacking ;-).
>
> Brian Tinsley wrote:
> > I use labels on SuSE with no problem. Could be an incompatibility with
> > your mount command, but I'm not sure.
>
> Has SuSE already updated the mount command to use libblkid then? Or did they
> insert duplicate LABEL/UUID parsing code for ReiserFS?
> John
There is a libblkid on my SuSE 9 laptop, but I don't see it on
Enterprise Server 8. The mount command on version 9 doesn't appear to be
linked to libblkid, so it's probably a safe assumption to say that they
modified the mount command on both.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 20:46 getting UUID and label of a filesystem Boyd Waters
2003-11-06 20:54 ` Brian Tinsley
2003-11-06 20:57 ` Redeeman
@ 2003-11-06 21:07 ` Andreas Dilger
2003-11-10 17:22 ` Boyd Waters
2 siblings, 1 reply; 18+ messages in thread
From: Andreas Dilger @ 2003-11-06 21:07 UTC (permalink / raw)
To: Boyd Waters; +Cc: reiserfs-list
On Nov 06, 2003 13:46 -0700, Boyd Waters wrote:
> Perhaps this is obvious, but I cannot find a way to print out the UUID
> or the label of a mounted reiser filesystem, in a manner similar to
> xfs_admin.
>
> Best way to do this?
>
> On a mounted filesystem?
>
> As non-root user?
If you have a recent e2fsprogs (1.33+ I think), you can use "blkid" to dump
the UUID/LABEL of most filesystem types (including reiserfs, XFS, JFS, ext*).
If run as root it will create a cache of available block devices and
their UUID/LABEL that non-root users can access even if they can't read
the block device, so it doesn't need to be suid or anything. You can also
use it to locate specific devices by LABEL/UUID/TYPE from scripts, etc.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-06 21:07 ` Andreas Dilger
@ 2003-11-10 17:22 ` Boyd Waters
2003-11-10 18:12 ` Mike Fedyk
0 siblings, 1 reply; 18+ messages in thread
From: Boyd Waters @ 2003-11-10 17:22 UTC (permalink / raw)
To: Andreas Dilger; +Cc: reiserfs-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andreas Dilger wrote:
|>As non-root user?
|
|
| If you have a recent e2fsprogs (1.33+ I think), you can use "blkid" to
dump
| the UUID/LABEL of most filesystem types (including reiserfs, XFS, JFS,
ext*).
| If run as root it will create a cache of available block devices and
| their UUID/LABEL that non-root users can access even if they can't read
| the block device, so it doesn't need to be suid or anything. You can also
| use it to locate specific devices by LABEL/UUID/TYPE from scripts, etc.
Great!
as non-root user:
$ /sbin/blkid /dev/loop5
/dev/loop5: LABEL="35" UUID="c9923c3f-da67-464f-ad55-6b4da22dabf0"\
TYPE="reiserfs"
So in a script:
#/bin/bash
FS_DEV=/dev/hda1
FS_UUID=`/sbin/blkid $FS_DEV | cut -d '"' -f4`
And this seems to work on non-reiser partitions, as well.
Nice, thanks!
~ - boyd
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/r8lp0is8k1r0QeURAis3AJ9eX0nboz9sp+gDQOjKW6WatSntBgCgj1jm
UQKh+2tCqO5EdBLomleG8MA=
=dUTb
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 17:22 ` Boyd Waters
@ 2003-11-10 18:12 ` Mike Fedyk
2003-11-10 18:44 ` Andreas Dilger
2003-11-10 19:35 ` Chris Dukes
0 siblings, 2 replies; 18+ messages in thread
From: Mike Fedyk @ 2003-11-10 18:12 UTC (permalink / raw)
To: Boyd Waters; +Cc: Andreas Dilger, reiserfs-list
On Mon, Nov 10, 2003 at 10:22:49AM -0700, Boyd Waters wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andreas Dilger wrote:
>
> |>As non-root user?
> |
> |
> | If you have a recent e2fsprogs (1.33+ I think), you can use "blkid" to
> dump
> | the UUID/LABEL of most filesystem types (including reiserfs, XFS, JFS,
> ext*).
> | If run as root it will create a cache of available block devices and
> | their UUID/LABEL that non-root users can access even if they can't read
> | the block device, so it doesn't need to be suid or anything. You can also
> | use it to locate specific devices by LABEL/UUID/TYPE from scripts, etc.
>
> Great!
>
> as non-root user:
>
> $ /sbin/blkid /dev/loop5
> /dev/loop5: LABEL="35" UUID="c9923c3f-da67-464f-ad55-6b4da22dabf0"\
> TYPE="reiserfs"
>
>
> So in a script:
>
> #/bin/bash
> FS_DEV=/dev/hda1
> FS_UUID=`/sbin/blkid $FS_DEV | cut -d '"' -f4`
Better would be:
FS_UUID=`/sbin/blkid $FS_DEV |grep UUID | head -n1| cut -d '"' -f4`
That way you don't get multiple lines of output, and don't expect the first
line to contain your UUID.
Also the second lines could be used to execute commands if you don't quote
the output from the programs.
Mike
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 18:12 ` Mike Fedyk
@ 2003-11-10 18:44 ` Andreas Dilger
2003-11-10 19:35 ` Chris Dukes
1 sibling, 0 replies; 18+ messages in thread
From: Andreas Dilger @ 2003-11-10 18:44 UTC (permalink / raw)
To: Mike Fedyk; +Cc: Boyd Waters, reiserfs-list
On Nov 10, 2003 10:12 -0800, Mike Fedyk wrote:
> On Mon, Nov 10, 2003 at 10:22:49AM -0700, Boyd Waters wrote:
> > Andreas Dilger wrote:
> > | If you have a recent e2fsprogs (1.33+ I think), you can use "blkid" to
> > dump
> > | the UUID/LABEL of most filesystem types (including reiserfs, XFS, JFS,
> > ext*).
> > | If run as root it will create a cache of available block devices and
> > | their UUID/LABEL that non-root users can access even if they can't read
> > | the block device, so it doesn't need to be suid or anything. You can also
> > | use it to locate specific devices by LABEL/UUID/TYPE from scripts, etc.
> >
> > Great!
> >
> > as non-root user:
> >
> > $ /sbin/blkid /dev/loop5
> > /dev/loop5: LABEL="35" UUID="c9923c3f-da67-464f-ad55-6b4da22dabf0"\
> > TYPE="reiserfs"
> >
> >
> > So in a script:
> >
> > #/bin/bash
> > FS_DEV=/dev/hda1
> > FS_UUID=`/sbin/blkid $FS_DEV | cut -d '"' -f4`
>
> Better would be:
>
> FS_UUID=`/sbin/blkid $FS_DEV |grep UUID | head -n1| cut -d '"' -f4`
Or rather:
PATH=/sbin:$PATH
eval `blkid $FSDEV | cut -d: -f2-`
and use UUID (TYPE, LABEL) directly (I also hate hard-coding paths in scripts).
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: getting UUID and label of a filesystem
2003-11-10 18:12 ` Mike Fedyk
2003-11-10 18:44 ` Andreas Dilger
@ 2003-11-10 19:35 ` Chris Dukes
1 sibling, 0 replies; 18+ messages in thread
From: Chris Dukes @ 2003-11-10 19:35 UTC (permalink / raw)
To: Mike Fedyk; +Cc: Boyd Waters, Andreas Dilger, reiserfs-list
On Mon, Nov 10, 2003 at 10:12:12AM -0800, Mike Fedyk wrote:
> > as non-root user:
> >
> > $ /sbin/blkid /dev/loop5
> > /dev/loop5: LABEL="35" UUID="c9923c3f-da67-464f-ad55-6b4da22dabf0"\
> > TYPE="reiserfs"
> >
> >
> > So in a script:
> >
> > #/bin/bash
> > FS_DEV=/dev/hda1
> > FS_UUID=`/sbin/blkid $FS_DEV | cut -d '"' -f4`
>
> Better would be:
>
> FS_UUID=`/sbin/blkid $FS_DEV |grep UUID | head -n1| cut -d '"' -f4`
>
> That way you don't get multiple lines of output, and don't expect the first
> line to contain your UUID.
FS_UUID=$(/sbin/blkid "$FS_DEV" | awk -F'"' '/UUID/{print $4;exit}')
The /UUID/ probably should be $<some number>=="UUID" or $<some number>~/UUID/,
but I don't know the column.
$() is now the preferred form and is nestable. This is in the POSIX spec,
if your shell doesn't handle this form, your shell is not POSIX compliant.
The use of grep|head|cut pipelines is really poor form
--
Chris Dukes
I tried being reasonable once--I didn't like it.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2003-11-12 15:32 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-06 20:46 getting UUID and label of a filesystem Boyd Waters
2003-11-06 20:54 ` Brian Tinsley
2003-11-10 20:07 ` John Dalbec
2003-11-10 20:14 ` Mike Fedyk
2003-11-10 20:40 ` Boyd Waters
2003-11-10 21:05 ` Bennett Todd
2003-11-11 0:12 ` Mike Fedyk
2003-11-06 20:57 ` Redeeman
2003-11-06 21:03 ` Brian Tinsley
2003-11-10 20:01 ` John Dalbec
2003-11-10 20:42 ` Andreas Dilger
2003-11-12 13:35 ` John Dalbec
2003-11-12 15:32 ` Brian Tinsley
2003-11-06 21:07 ` Andreas Dilger
2003-11-10 17:22 ` Boyd Waters
2003-11-10 18:12 ` Mike Fedyk
2003-11-10 18:44 ` Andreas Dilger
2003-11-10 19:35 ` Chris Dukes
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.