Erik Mouw a écrit :
On Thu, Apr 13, 2006 at 11:00:45AM +0200, Loiseleur Michel wrote:
Here is the problem :
I need a way in shell script to get back the device name from the
label name, in order to restore (ie: format) it correctly in a recovery
solution (mondorescue).
For instance, a call to "e2label" do the job for the ext2/3 kind of
partition.
But for swap partition, there is _no_ way to get it back. The name
didn't appear in /proc/swaps or /proc/partitions.
That's because filesystem labels is a userland issue and not at all
kernel related. It's also how mount label works: the userland program
"mount" figures out which device contains the requested label and
passes the correct device to the mount() syscall.
Here is my current hacking:
I have developped myself a small "addon" to swapon/swapoff program,
named _swaplabel_, which display the list of device, uuid and name of
all the partitions. It was really easy, this code is old but so damn cool !
Here is the question :
1) Is this possible to enhance linux-utils in order to do the job ?
2) What's the better way to correct this :
2.1) a new program as my "swaplabel" ?
Yes, but rather name it something like dumpswap, just like dumpe2fs,
etc.
This is not exactly what I need. I don't know how to dress the full map
of a swap file/partition, and I don't need it. I just need to retrieve
the link between 'device' and 'label' put in /etc/fstab. After reading
the code in linux-utils package (mount/swapon.c &
mount/get_label_uuid.c), I figured out how to implement it in C. But I
need it in shell script >_<.
The program I want to add is nearer of e2label program (ext2/3
equivalent). That's why I suggested the name "swaplabel", which would be
functionally equivalent to e2label.
2.2) a new option to swapon ? (there is already a "-l" in it,
but it does not display the label)
No, mount also doesn't display labels.
ok
2.3) a patch to the "-l" option ?
2.4) a patch to add a colum "label" in /proc/partitions ?
No, cause labels are a userland issue.
Yes, you're right. I wanted to join linux-utils developers, and it's the
mailing list which seems the good one for me.
Thanks for your advice, erik.
--
Michel Loiseleur
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html