Re: Tool for changing label of a swap partition?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 02, 2009 at 01:23:48PM +0100, Martin Pitt wrote:
> Hello Karel,
> 
> Karel Zak [2009-11-02 12:18 +0100]:
> > I guess DK-D has information (from libblkid/udev) that the device is
> > "swsuspend", the library differentiate between swap and swsuspend
> > superblocks.
> 
> Ah, perfect. So that means it should always be safe to do an mkswap on
> an inactive swap partition, and we could implement the "change swap

 You have to know what are you doing of course. The mkswap(8) (like
 all mkfs programs) does not care about data on the device. It checks
 for partition tables only.

> label" functionality in dk-disks using swapoff/mkswap/swapon? (Which
> would induce quite a lot of overhead, of course) 

 Sounds too crazy.

> Or just don't offer the feature for active swap partitions and do
> mkswap with the new label only.

 This is better idea. 


 I'm not sure but I guess that kernel does not use the swap header
 (the first page) after swapon. Maybe we can modify the label/uuid on
 active swap, I have successfully tried:

    # printf "BAR\000\000\000\000\000\000\000\000\000\000\000\000\000" | \
               dd of=/dev/sda3 bs=1 seek=$((1024 + 28)) conv=notrunc

    # blkid -p -o udev /dev/sda3 | grep LABEL=
    ID_FS_LABEL=BAR

    # grep sda3 /proc/swaps 
    /dev/sda3                      partition       2353512 812   -1

> > > Do you plan to add a tool to do that?
> > 
> > This is first time when someone is asking for such feature ;-)
> 
> I doubt that so many people will actually use it, it's just a missing
> piece in the devkit-disks feature matrix. :-)

 Yes, the feature is not so important.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux