From mboxrd@z Thu Jan 1 00:00:00 1970 From: Loiseleur Michel Subject: Re: Hacking linux-utils for swap label Date: Thu, 13 Apr 2006 14:34:58 +0200 Message-ID: <443E4572.9050402@linagora.com> References: <443E133D.8070209@linagora.com> <20060413121609.GC20839@harddisk-recovery.com> Reply-To: linux-fsdevel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from whisky.linagora.com ([62.23.27.55]:54472 "EHLO whisky.linagora.com") by vger.kernel.org with ESMTP id S964919AbWDMNJG (ORCPT ); Thu, 13 Apr 2006 09:09:06 -0400 Received: from localhost (unknown [127.0.0.1]) by whisky.linagora.com (Postfix) with ESMTP id C8447989C7C for ; Thu, 13 Apr 2006 12:35:23 +0000 (UTC) Received: from whisky.linagora.com ([127.0.0.1]) by localhost (whisky [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27544-03 for ; Thu, 13 Apr 2006 14:34:58 +0200 (CEST) Received: from [192.168.0.55] (sgi2.linagora.com [195.68.36.75]) by whisky.linagora.com (Postfix) with ESMTP id 1445C989C79 for ; Thu, 13 Apr 2006 14:34:58 +0200 (CEST) To: linux-fsdevel@vger.kernel.org In-Reply-To: <20060413121609.GC20839@harddisk-recovery.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Erik Mouw a =E9crit : >On Thu, Apr 13, 2006 at 11:00:45AM +0200, Loiseleur Michel wrote: > =20 > >>Here is the problem : >> I need a way in shell script to get back the device name from the=20 >>label name, in order to restore (ie: format) it correctly in a recove= ry=20 >>solution (mondorescue). >> For instance, a call to "e2label" do the job for the ext2/3 kind o= f=20 >>partition. >> But for swap partition, there is _no_ way to get it back. The name= =20 >>didn't appear in /proc/swaps or /proc/partitions. >> =20 >> > >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. > > =20 > >>Here is my current hacking: >> I have developped myself a small "addon" to swapon/swapoff program= ,=20 >>named _swaplabel_, which display the list of device, uuid and name of= =20 >>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" ? >> =20 >> > >Yes, but rather name it something like dumpswap, just like dumpe2fs, >etc. > =20 > This is not exactly what I need. I don't know how to dress the full map= =20 of a swap file/partition, and I don't need it. I just need to retrieve=20 the link between 'device' and 'label' put in /etc/fstab. After reading=20 the code in linux-utils package (mount/swapon.c &=20 mount/get_label_uuid.c), I figured out how to implement it in C. But I=20 need it in shell script >_<. The program I want to add is nearer of e2label program (ext2/3=20 equivalent). That's why I suggested the name "swaplabel", which would b= e=20 functionally equivalent to e2label. > =20 > >> 2.2) a new option to swapon ? (there is already a "-l" in it,=20 >>but it does not display the label) >> =20 >> > >No, mount also doesn't display labels. > =20 > ok > =20 > >> 2.3) a patch to the "-l" option ? >> 2.4) a patch to add a colum "label" in /proc/partitions ? >> =20 >> > >No, cause labels are a userland issue. > =20 > Yes, you're right. I wanted to join linux-utils developers, and it's th= e=20 mailing list which seems the good one for me. Thanks for your advice, erik. --=20 Michel Loiseleur - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html