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

Re: De-activate a swap partition - I don't believe it!

From: "Jeff Vian" <jvian10 charter net>

On Sun, 2006-03-19 at 20:33 +0000, Anne Wilson wrote:
On Sunday 19 March 2006 19:52, Craig McLean wrote:
> Anne Wilson wrote:
> > I want to reorganise partitions on hdb - combining some, to make fewer,
> > larger partitions.  gparted says that I can't do that, because hdb11 is
> > being used as a swap partition.  I do have a swap on hda, so could easily
> > manage wihout it temporarily.  Is there any way to do that without
> > rebooting?  I removed it from fstab and did 'mount -a', but that doesn't
> > solve the problem.  I think I'm right in saying that it is not mounted,
> > in a conventional sense, so I don't know how to proceed.
> >
> > Anne
> Anne,
> Check the manpages for swapon/swapoff..
I used gparted to delete a couple of partitions and create a new one, then created a new one at the end, in some unallocated space. Everything looked fine, and it started the final scan - the whole disk is marked Unallocated, and fdisk -l doesn't see anything. Tomorrow I'll try testdisk to see whether it is recoverable, but if fdisk can't see it I'm not hopeful.

You might try fdisk to do the partitioning instead of gparted.  That may
be the problem. fdisk -l only reports the partition table it sees. If nothing it
recognizes is there it cannot report it.

It sounds like Anne committed one or more of the death penalty sins for
working with operating systems and file systems in particular.

NEVER EVER repartition an active drive. Your data is likely toast.
NEVER EVER repartition a drive without taking a backup first.
NEVER EVER use a partitioning tool without understanding what it is going
          to do to you, in detail.

In any case somebody who is VERY careful to dismount partitions (at least
ones that are going to be changed), can get away with repartitioning an
active disk. It is like juggling weeping sticks of dynamite, though. In
general drop to single user mode, backup all data on the drive you're going
to mess with, then mess with the drive after completely dismounting it,
every one of its partitions. The Linux Documentation Project is a good
place to find HOW-TO help on this sort of thing. And, really, if the HOW-TOs leave you baffled you're not ready to play with a given feature.
(Hint, there is at least partitioning HOW-TO with some hints on where the
swap files ought to go. Three partitions are usually called for. /boot,
/, and swap. Ordering depends on the performance you need. If you go to
swap a lot - put it near the outside of the disk. If you do not go to swap
at all often then put it anywhere you want, it'll not make a huge difference.)

Sometimes the kernel sees one partition table, and when changes are made
it *requires* a reboot to see the new table.  Sometimes it sees the
change without a reboot.  I have not really figured out the differences,
but I do know that after a reboot it will see the current table

THAT is a fine way to destroy partitions that might have been saved if they
are still mounted.

I learned WAY WAY WAY more about partition tables than I ever wanted by
embracing Anne's folly. <sigh - I am human.> Had I not rebooted I could
probably have found the kernel's records of the partitions it was using.
As it was I had to learn about ext2fs's disk organization and recover
the hard way. It was a long job even though I remembered the basics of
the partitioning. NOW I make a print out of an "fdisk -l". I keep a sane
fdisk around, too. New ones are broken. They have an artificial limit on
the number of partitions they will handle. I have had times I really had
serious use for about 24 partitions on one disk. I do NOT like tools that
make artificial limits. (I have some read only partition images I use
from time to time for some "ancient archives" work. I try not to EVER
lose data. And given a choice it will be available for me when I want it.)

Anyway, with the fdisk -l listing I can generally recover from blunders
pretty easily as long as I do not try to take too many of the "fdisk" and
"makefs" steps at once. It's ALWAYS painful. Do it all one careful step
at a time and check the work at each step. And "please" do it in single
user mode. You'll find it is easier on your nerves.

{o.o}   <- When I embrace folly I try to turn it into a learning experience.
       Learning is a nasty experience. Having learned is rather fun.

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