From: Erik Mouw Subject: Re: Hacking linux-utils for swap label Date: Thu, 13 Apr 2006 14:16:09 +0200 Message-ID: <20060413121609.GC20839@harddisk-recovery.com> References: <443E133D.8070209@linagora.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from dtp.xs4all.nl ([80.126.206.180]:5820 "HELO abra2.bitwizard.nl") by vger.kernel.org with SMTP id S964889AbWDMMQN (ORCPT ); Thu, 13 Apr 2006 08:16:13 -0400 To: Loiseleur Michel Content-Disposition: inline In-Reply-To: <443E133D.8070209@linagora.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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. > 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. > 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. Erik -- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands