From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OUKkP-0006Yf-KG for garchives@archives.gentoo.org; Thu, 01 Jul 2010 14:28:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6726BE0D9A; Thu, 1 Jul 2010 14:27:41 +0000 (UTC) Received: from spsmtp02oc.mail2world.com (spsmtp02oc.mail2world.com [74.202.142.198]) by pigeon.gentoo.org (Postfix) with ESMTP id 2D9D3E0D9A for ; Thu, 1 Jul 2010 14:27:41 +0000 (UTC) Received: from mail pickup service by spsmtp02oc.mail2world.com with Microsoft SMTPSVC; Thu, 1 Jul 2010 07:27:35 -0700 auth-sender:nisselarsson@home.se Received: from 82.182.34.222 unverified ([82.182.34.222]) by spsmtp02oc.mail2world.com with Mail2World SMTP Server; Thu, 01 Jul 2010 07:27:34 -0700 Subject: Re: [gentoo-user] activating swap by udev event From: Nils Larsson To: gentoo-user@lists.gentoo.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Thu, 01 Jul 2010 16:05:56 +0200 Message-ID: <1277993156.10569.21.camel@growl> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 01 Jul 2010 14:27:35.0486 (UTC) FILETIME=[8CAF8DE0:01CB1929] X-Archives-Salt: b8af3696-31d1-40a9-a17b-5a166b3e7ec9 X-Archives-Hash: d7f539ecf5791d6c21e6577e44188021 tor 2010-07-01 klockan 15:49 +0200 skrev SpaceCake: > Hi, > > > I would like to increase the speed of my machine by putting some swap > on a fast pendrive. It is working manually by starting a script > > swapon -s > swapon -p -1 /dev/sdb1 > swapoff /dev/sda6 > swapon -p -2 /dev/sda6 > swapon -s > > but, I would like to make it automatic by creating an udev rule, so > when I plug in that device the swap space is automatically activated > and the priority is changed. I've tried to google for a solution like > this, but I did not find. Maybe you already have some script at > hand :) can you please share this with me? > > Thanks > Laszlo > I tried doing something like this awhile ago. The problem I encountered was that I couldn't disable the swap once the the device was removed, swapoff couldn't find the device path(as it wasn't there anymore) but the system thought the swap was still there. So plugging and unplugging the swap stick got my system thinking it had loads of swap. But I didn't experiment all that much, maybe there's a way. Tricking udev to hold on to the device node until swap is disabled might be possible.