PDA

View Full Version : No Swap After Disc Clone



n2ize
09-06-2012, 05:26 AM
Okay, so I successfully cloned the disk (see other thread). . One thing I am now noticing. If I do a "$ df -h" it shows that the swap partition from the old drive has been copied to the new disc. But when I run either "$ top" or "$ free" it is telling me that there is no swap space available. Do I need to run a "$ swapon" or, "$swapon -a" to turn on the swap for the new disc ? . Guess it won't hurt to give it a try just to make sure. I am going to have to run GParted on the new disk anyway to enlarge the partitions to the size of the new disc so I guess I can always make some new swap space while I am at it.

KA9MOT
09-06-2012, 06:50 AM
Jeez...... Just yesterday I discovered how cool dual monitors is...... your question makes my head hurt. Sorry, I can't be any help.

W4GPL
09-06-2012, 07:26 AM
swapon -a won't harm anything..but if your swap isn't defined in /etc/fstab, it won't know where to look..

n2ize
09-06-2012, 03:11 PM
f I do a "$ swapon -a" I get the following


swapon: cannot find the device for LABEL=SWAP-hda8
This partition appears to have been copied and if I do a "# fdisk -l" is shows that /dev/hda8 is swap. It is also listen in "/etc/fstab" as copied from the old disk.

n6hcm
09-06-2012, 10:49 PM
f I do a "$ swapon -a" I get the following


This partition appears to have been copied and if I do a "# fdisk -l" is shows that /dev/hda8 is swap. It is also listen in "/etc/fstab" as copied from the old disk.

right--but if it is listed in /etc/fstab as LABEL=SWAP-hda8 and /dev/hda8 isn't labelled "SWAP-hda8" then swapon will never find it.

two choices: label /dev/hda8 correctly (as above) or list the partition explicitly in fstab like this:



/dev/hda8 swap swap defaults 0 0


only do this, however, if you are ABSOLUTELY CERTAIN that /dev/hda8 is the swap area--the minute you turn swap on (with swapon -a) after doing this it will write to that partition ...

n2ize
09-07-2012, 12:54 AM
right--but if it is listed in /etc/fstab as LABEL=SWAP-hda8 and /dev/hda8 isn't labelled "SWAP-hda8" then swapon will never find it.

two choices: label /dev/hda8 correctly (as above) or list the partition explicitly in fstab like this:



only do this, however, if you are ABSOLUTELY CERTAIN that /dev/hda8 is the swap area--the minute you turn swap on (with swapon -a) after doing this it will write to that partition ...
Thanks, I'll give that a try tomorrow. I am sure /dev/hda8 is swap partition. However, I saved the old drive that was cloned so, in a worst case scenario I can remount the old drive and re-clone. Of course as an extra precaution I'll make sure and important files are backed up (such as database files, etc.).

n6hcm
09-08-2012, 04:11 AM
good luck! hope this fixes your issue ...

n2ize
09-08-2012, 11:34 AM
good luck! hope this fixes your issue ...


Thanks, it worked. Since the swap partition was already defined in fstab as "LABEL=SWAP-hda8" and it wasn't enabling I did the latter method you mentioned, namely I defined the device (partition) directly in /etc/fstab as "/dev/hda8 swap swap defaults 0 0", then I ran a "# swapoin -a" and viola' it worked. I ran "$ top" and the swap space is now enabled. So far it's not using any of the swap space... it seems to chug along okay without it for the most part but, at least its there if the system needs it. So I guess the new (cloned) system needed to be told exactly which device (partition) was the swap partition.

Thank you very much for the help...

n2ize
09-08-2012, 03:31 PM
Jeez...... Just yesterday I discovered how cool dual monitors is...... your question makes my head hurt. Sorry, I can't be any help.

No problem. I've been using Linux since it's early days, (about 16+ years), It has matured and come along way since it's humble beginning. I remember when I used to have to recompile the kernel if I wanted support for sound, graphics, etc. And in those days I got quite used to doing everything from the command line. Very little support for GUI config tools then..

n6hcm
09-09-2012, 12:42 AM
using the LABEL technology is in one respect better--you can move your disk to other locations on the bus (if your disk technology supports this) and you don't have to care which device number or partition designator are assigned by the operating system. still, either works ...

ideally, you want enough memory so that you don't have to use swap space most of the time.

n2ize
09-09-2012, 01:59 AM
using the LABEL technology is in one respect better--you can move your disk to other locations on the bus (if your disk technology supports this) and you don't have to care which device number or partition designator are assigned by the operating system. still, either works ...


Yeah, but for some reason or other the cloned system no longer knew what device the label referenced. Perhaps that is because the system was cloned but the actual device (physical drive) onto which it was cloned is no longer the same device ? At least that is the only reason I can think of for the moment.


ideally, you want enough memory so that you don't have to use swap space most of the time.
Yes, I checked the swap usage on the server and it is currently using less than 0.5% of the total swap space available. Then again this particular system doesn't operate under much of a processor or memory intensive load. Other than the OS function an occasional MySQL query, web query, etc. I've been noticing that nn a lot of the new systems they are coming with enough memory right out of the box where I really don't need to set up swap space. Such was the case when I set up Linux on my Dad's new system, I set up a small swap partition and thus far it seems like the system hardly touches it. In the old days a lot of systems would hardly run unless I gave them swap space.