LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 05-17-2007, 10:27 AM   #1
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Rep: Reputation: 49
WARNING! When deleting or moving swap partition!


In the past with Sarge, I didn't worry too much about the swap partition. I'd delete or create or move swap partitions as convenient, and just edit /etc/fstab as appropriate. This was particularly convenient for upgrading hard drives or copying an OS partition to a new computer.

However, with Etch, doing this can put your OS in an unbootable state! Not even to single user mode!

I had been struggling with this for two days, when I was attempting to migrate an OS partition from a drive with a swap partition in hda2 to a file server drive with existing data. I thought I was being quite clever--first install/configure the OS on a different drive, and then copy over the OS partition to minimize downtime. Unfortunately, I put in a swap partition in hda2, whereas the file server drives have swap in hdb1.

As a result, when I copied the OS over the copy couldn't boot! It got to a point where it said something cryptic about "swsusp" attempting to resume from device /dev/hda2 and failing. I couldn't get to a command prompt even in single user mode.

After much frustration including trying to squeeze in a small hda2 swap partition (which didn't work but I didn't have enough space for a sufficiently large one), I eventually figured out it had something to do with "initramfs", the thing which gets Debian to boot up.

The solution, is to do the following to the original OS partition before making any changes to any swap partitions:

1) edit /etc/initramfs-tools/conf.d/resume
2) change the contents from:

RESUME=/dev/hda2

to

RESUME=

3) Update initramfs with the command "update-initramfs -u"

This will remove the offending attempt by swsusp to resume from swap.
 
Old 05-17-2007, 11:02 AM   #2
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Newer distributions use the swap drive to enable suspend and hibernate modes. This is why it isn't easy to move the swap drive around. If you don't have a need for suspend or hibernate, then by all means disable it. Otherwise, it is recommended to leave the swap space alone. Also, the swap partition should be ~2x the size of your physical ram at the most. Any more is a wast of drive space. With 500g drives in the $200 price range, anyone should be able to afford to allocate 4g without relocating it.
 
Old 05-17-2007, 11:20 AM   #3
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
Not all hard drives are 500gigs in size (none of mine are), and my larger hard drives are already partitioned with a small OS partition and large data partition--no space to "squeeze" in a swap partition big enough for swsusp to not bomb.

Also, when migrating to/from a dual boot system, you may not have the option to just leave swap alone. For example, suppose you're currently dual booting like this:

hda1 Windows OS
hda5 ntfs data
hda6 /
hda7 /home
hda8 swap

You decide to get rid of Windows. You could pad in a bunch of small "dummy" partitions to get swap to remain hda8, but that's really silly, isn't it?

Or maybe you're currently dual booting with Windows on hda and Linux on hdb. You want to get rid of Windows and move the Linux drive from hdb to hda.
 
Old 05-17-2007, 11:37 AM   #4
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
My point on the drive sizes was that drive space is fairly cheap. Most systems have at least 40-80G drives, and if you are dual booting, you should at least have 80-120G. Most Linux distributions take less than 10G to install. The rest is data.

Each of the scenarios you mention above are usually onetime instances. I don't know of any logical reason to be copying a Linux installation around multiple times. Reinstalling and then copying your home partition is just as quick in most cases.

And I would assume that if you are copying a Linux installation from one drive to another, you are using a boot cd and not copying a live system. Once the new copy is made, you can modify all of the configuration files and even run configuration utilities by first chroot'ng the partition (cd /mnt/hda1; chroot . ). The resume partition is usually defined in the kernel boot options, and can be changed by editing the grub or lilo boot configuration file (resume=/dev/hda8 in your example).

But like I said, if you aren't using suspend to disk or hibernate modes, you can just disable them and not run into this again.
 
Old 05-17-2007, 12:03 PM   #5
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
My point is to give advice for doing what you want to do, for whatever reasons.

Quote:
Most systems have at least 40-80G drives
So what? What about the systems which don't? Most of my computers don't. I dual boot on a 20gig drive and have a very basic dual boot system on a 1.3gig drive.

Quote:
Each of the scenarios you mention above are usually onetime instances.
All it takes is one time to bomb your OS into an unbootable state to ruin your day! Wouldn't it be nice to have had a warning about it so you know what to do about it BEFORE that happens? The fix is EASY if you know what to do BEFORE it happens. The other way around? I found out the hard way!

Quote:
I don't know of any logical reason to be copying a Linux installation around multiple times. Reinstalling and then copying your home partition is just as quick in most cases.
Now you're just showing a lack of experience and/or imagination. Reinstalling doesn't install all of your software and configuration settings (I'm talking about configuration settings--the things in /etc--not user specific preferences--the things in /home). It doesn't keep the same SSH keys. It doesn't add all of the users/groups you've set up. It doesn't keep the SAMBA settings. It doesn't even keep your xorg settings. For most sorts of server the contents of /home are barely even relevant!

Also, when setting up a bunch of computer systems, it is much better and faster to set up a base install and then copy the OS partition.
 
Old 05-17-2007, 12:31 PM   #6
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Hey, I wasn't trying to get personal. I originally thought your top post was a question, but I guess not. I only suggested that if you don't need suspend to disk or hibernate, disable them.

As to experience, I used to manage a network of ~200 systems in multiple locations (Oregon, Arizona, Penang), and it was easier to do a custom install (which included customized /etc config files) than to copy partitions, mainly due to host name and network configuration settings. The methods I created in that job have been used to deploy over 10k systems in the last two years at that company. If you have that many user, group, and other settings of the like, maybe you should be using an NIS server to maintain them in a central location.

I have also run a lab that saved the partitions to a central server with partimage, than reloaded them on multiple systems for driver testing, so I have done both methods. If the installation is available on the network or on a local drive (not cd), the time taken to reinstall vs image copying is almost the same on an individual system basis. The install method takes some work to setup the installation customization scripts, the image copying takes some post-image customization. It really depends on the number of systems being deployed as to which approach to take. The more systems you need to image, the better off you are with custom installation scripts.
 
Old 05-17-2007, 02:23 PM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
Quote:
Hey, I wasn't trying to get personal. I originally thought your top post was a question, but I guess not.
My original post wasn't a question, indeed. It would have been a question two days ago, but my habit is to first stubbornly try and solve something myself. Even if I eventually give up, I learn a lot in the process of trying to solve something myself.

Usually, when I solve something myself, I don't post anything about it. This time was an exception, though, because I thought it would have been REALLY helpful if someone had warned me about this potential problem beforehand.

Quote:
I only suggested that if you don't need suspend to disk or hibernate, disable them.
No, you also suggested that you shouldn't mess with the swap partition and you shouldn't need to mess with the swap partition.

Quote:
As to experience, I used to manage a network of ~200 systems in multiple locations (Oregon, Arizona, Penang), and it was easier to do a custom install (which included customized /etc config files) than to copy partitions, mainly due to host name and network configuration settings.
Interesting. My post-image configuration usually amounts to editing /etc/hostname and editing /etc/X11/xorg.conf to the desired resolutions/monitors if necessary. I do the network configuration on the DHCP server. The most time consuming interactive part of the entire process is getting/copying the MAC address.

Quote:
If you have that many user, group, and other settings of the like, maybe you should be using an NIS server to maintain them in a central location.
What about the NIS server itself?

Besides, a reinstall won't keep NIS client settings either. Nor will it keep any of the settings in /etc.

Now, you seem to be using the term "reinstall" to mean some sort of heavily customized process, which copies over all these configuration settings in detail using automated scripts. But this might as well be copying over an OS partition plus some extra script steps for automating configuration.

I took "reinstall" to mean using the standard installer CD.

Either way, I'm never going to bother with creating and testing customized "reinstall" scripts for servers. I don't want to mess with reinstall scripts which might miss something. I just want to backup/restore EVERYTHING.

Don't tell me you don't keep backups of your servers's OS partitions.

Last edited by IsaacKuo; 05-17-2007 at 02:25 PM.
 
Old 05-17-2007, 09:08 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 3,975

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Maybe this is a stupid question, but I thought that with hibernating the computers memory image is written to disk. Usually (and in the case of the OP) this is the swap partition.

If you nuke the swap partition, you can't resume, right?

But I thought in the GRUB boot menu you have to add a parameter to tell the kernel to resume and from which partition. I think it is RESUME=/dev/hda2 or so.

But if you do not want to resume, you can simple edit this line, isn't it? Remove the resume and continue booting.

You only would loose your current memory contents, comparable to what you get when you have suffered a power outage while working.

When I experimented with swsusp2 I added this RESUME= to my menu.lst entry, in addition to a line which omitted it.

I remember for sure that I have booted the machine again without resuming, ignoring whatever was on the swap partition.

Isaac, could that have been a solution or am I nuts?

BTW, ignoring the hibernated image imposed another unexpected problem. When I wanted to resume again, swsusp2 refused to do so, because it said the previous startup was a boot, and not a resume. It could see that at the RESUME= kernel parameter. So... if you didn't resume, you can never hibernate anymore...?

I did not investigate this further. First I didn't have the time, secondly resuming was not much faster than rebooting. Strange but true. Should this be a bug, or just an overly and unnecessary cautious program?

jlinkels
 
Old 05-17-2007, 10:54 PM   #9
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,838

Rep: Reputation: 48
Correct me if I'm wrong but there are some misleading statements here.

Let's start with the real cause:
Quote:
...first install/configure the OS on a different drive, and then copy over the OS partition to minimize downtime. Unfortunately, I put in a swap partition in hda2, whereas the file server drives have swap in hdb1
An attempt is made to transfer a misconfigured image to a seperate computer. The cause is user error. The operation is not a common one.

And OP's statements are:
"WARNING! When deleting or moving swap partition!"
"In the past with Sarge, I didn't worry too much about the swap partition."
"However, with Etch, doing this can put your OS in an unbootable state! Not even to single user mode!"
"All it takes is one time to bomb your OS into an unbootable state to ruin your day!"

Okay, so your post is about recovering from a user configuration error. I don't get what the point is of all the generic warnings about "SWAP PARTITIONS!!!!!!!!!!!!"
To me it seems out of place and severely detracts from any real information you are offering.

Last edited by 2damncommon; 05-17-2007 at 10:56 PM.
 
Old 05-18-2007, 12:29 AM   #10
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
I did something which I did commonly with Debian Sarge, and had no problems with Sarge. It seems that Etch is a LOT less forgiving of moving around OS partitions and hardware.

In the past, I used a swap partition simply to improve the performance of the install and configuration. The spare workstation doesn't have as much RAM as the server. This was never a problem with Sarge.

I've also run into problems related to the fact that my spare workstation has a different MAC address than the server. With Sarge, this was never a problem. Even if the hardware wasn't identical, eth0 would come up eth0. But Etch seems to have some sort of udev thing which specifies makes a NIC eth1 even if there's only one of them. Very annoying! This is only helpful in cases where the user/administrator would want to manually configure multiple NICs anyway! I fixed that one by manually editing the relevant file, but for some reason I'm left with an empty resolve.conf. It seems to have something to do with "networkmanager", which is supposedly supposed to make network configuration easier. Of course, the only time it has affected me so far is to break my network configuration. Oh, joys.

That, and the Etch installer can't even copy or resize ext3 partitions that it creates. It can copy and resize ext3 partitions created by the Sarge installer just fine.

You can say these are all just "user mistakes", but these are all things I did routinely with Sarge and they just worked.
 
Old 05-18-2007, 12:40 AM   #11
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by jlinkels
But I thought in the GRUB boot menu you have to add a parameter to tell the kernel to resume and from which partition. I think it is RESUME=/dev/hda2 or so.
Unfortunately, not. In my GRUB menu entries, there are no such RESUME=/dev/hda2 parameters anywhere. It's built into initrd.img, and the only way to get rid of it is to rebuild it.

BTW, I was not "experimenting" with swsusp. I never had any interest in any sort of "hibernate" mode, nor any interest in suspending or resuming. For me, this swsusp thing is just something which Debian 4.0 includes by default which made my life more difficult.
 
Old 05-18-2007, 01:10 AM   #12
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Not trying to stir your emotions any more than they already are, but there was 2 years of development in the kernel and all of the other applications between sarge and etch. I'm not a Debian user, but I have seen ALL of the major distros (Ubuntu, Gentoo, Redhat, Suse, Mandriva, etc) shifting towards mobile computing and advanced power management in those two years. this means udev configuration for wireless networking, suspend to disk and hibernation, etc.

I'm sorry if this doesn't agree with your usage model, but the rest of the Linux community seem set on this path.

These issues you brought up are really not normal usage model issues. The fact that you stuck it out, learned from it (albet the hard way), and are now sharing that experience speaks volumes, though.

Last edited by GrueMaster; 05-18-2007 at 01:11 AM.
 
Old 05-18-2007, 01:36 AM   #13
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,346

Original Poster
Rep: Reputation: 49
Yes, these aren't "normal" usage issues. But I figure someone who is never thinking of deleting or moving the swap partition is going to just ignore this warning post anyway.

As frustrating as my experiences have been, I appreciate them because I have learned a LOT about the way Linux and Debian works. Without these little "incidents", I'd have never really dug around inside initramfs and udev and such.

I know that it's not just Debian Etch. When searching around on the Internet about these issues, I get a lot more relevant hits with Ubuntu than Debian--natural, since Debian has only just released Etch while Ubuntu has had these more modern features for a lot longer. The difference between the Ubuntu hits and the other distributions is that Ubuntu is Debian based so the various nuts and bolts work more or less the same.
 
Old 05-18-2007, 05:57 AM   #14
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 3,975

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Quote:
Originally Posted by IsaacKuo
Unfortunately, not. In my GRUB menu entries, there are no such RESUME=/dev/hda2 parameters anywhere. It's built into initrd.img, and the only way to get rid of it is to rebuild it.
Ah, I see. I was not aware of that swsusp2 is now a part of the kernel. I am running Debian Lenny, but I compiled my own kernel instead of installing the one which came with Debian. I must have missed that.

jlinkels
 
Old 05-18-2007, 10:06 AM   #15
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,838

Rep: Reputation: 48
Quote:
Originally Posted by IsaacKuo
You can say these are all just "user mistakes", but these are all things I did routinely with Sarge and they just worked.
I believe I suggested setting up an operating system on one computer and transferring it to another computer with mismatched settings is a user error. Why the misdirection?
My understanding is that you are saying that newer "features" make it harder to recover from that error. You suggest a solution to recover from a misconfigured swap partition. Besides that there are numerous other "new features" you do not like.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a swap partition? Ahmed Linux - Hardware 7 09-30-2005 12:18 PM
What process is changing /etc/fstab and deleting my swap mount? ffrr Linux - Software 8 03-18-2005 09:16 PM
deleting/resizing swap partition / increasing hd space saranga2000 Linux - Hardware 1 12-09-2004 10:03 AM
Moving swap and sharing folders in distros jazzyjazz Slackware 1 11-19-2003 06:40 AM
Moving swap back to main memory acid_kewpie Linux - General 4 08-26-2001 09:40 AM


All times are GMT -5. The time now is 04:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration