From: Kenny McCormack on
Is there anything architecture-specific about "mkswap"?

That is, is there anything wrong with using "mkswap" on a machine
running Linux on one architecture (say, i386) to create a swap partition
on a device, then using that device for swap under Linux running on
another architecture (say, ARM). I.e., assume that, for whatever
reason, "mkswap" does not exist on the target architecture.

I assume the answer is "no", but thought I'd check - because one never
knows... I'd assume that "mkswap" is pretty much analogous to "mke2fs",
and obviously that's not architecture-specific.

--
"We should always be disposed to believe that which appears to us to be
white is really black, if the hierarchy of the church so decides."

- Saint Ignatius Loyola (1491-1556) Founder of the Jesuit Order -

From: Robert Heller on
At Tue, 3 Aug 2010 00:06:41 +0000 (UTC) gazelle(a)shell.xmission.com (Kenny McCormack) wrote:

>
> Is there anything architecture-specific about "mkswap"?
>
> That is, is there anything wrong with using "mkswap" on a machine
> running Linux on one architecture (say, i386) to create a swap partition
> on a device, then using that device for swap under Linux running on
> another architecture (say, ARM). I.e., assume that, for whatever
> reason, "mkswap" does not exist on the target architecture.
>
> I assume the answer is "no", but thought I'd check - because one never
> knows... I'd assume that "mkswap" is pretty much analogous to "mke2fs",
> and obviously that's not architecture-specific.

When I 'upgraded' from CentOS 4.8 i386 to CentOS 5.3 x86_64, I did not
bother to make a new swap partition (yes, I created fresh /, /var, and
/usr file systems). Things seem to be working just fine. I even once
rebooted the CentOS 4.8 system, using the *same* swap partition.

I am pretty sure that mkswap is just as architecture netural as
mke2fs. I can't imagine mkswap does much more that just write a header
/ super block containing little more that a signature that says 'Hey,
I'm a swap partition of <mumble> blocks with a label of foo'.

>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller(a)deepsoft.com -- Contract Programming: C/C++, Tcl/Tk


From: Richard Kettlewell on
John Reiser <jreiserfl(a)comcast.net> writes:

>> Is there anything architecture-specific about "mkswap"?
>
> Read The Fine Manual page: give the command "man mkswap" to a shell
> program in a terminal session. There you will see that mkswap depends
> on the native page size of the hardware, usually 4KiB or 8KiB.

It is a bit more complicated than that.

/*
* One more point of lossage - Linux swapspace really is a mess.
* The definition of the bitmap used is architecture dependent,
* and requires one to know whether the machine is bigendian,
* and if so, whether it will use 32-bit or 64-bit units in
* test_bit().
* davem writes: "... is based upon an unsigned long type of
* the cpu and the native endianness".
* So, it seems we can write `unsigned long' below.
* However, sparc64 uses 64-bit units in the kernel, while
* mkswap may have been translated with 32-bit longs. Thus,
* we need an explicit test for version 0 swap on sparc64.
*/

--
http://www.greenend.org.uk/rjk/
From: Aragorn on
On Tuesday 03 August 2010 04:11 in comp.os.linux.misc, somebody
identifying as Michael Black wrote...

> Note that I could multiple boot and have only one swap space for both
> variants of Linux, and if I booted with one, it wouldn't care one bit
> that I'd been using the swap partition with the other distribution.
> In other words, it expects a "blank" partition, and acts accordingly,
> and thus it can't expect anything to be on that partition, which means
> whatever it needs for that parition, it will provide.

Except when the swap partition is used by one of your distributions to
act as the backing storage for the RAM in a "suspend to disk" scenario.
I wouldn't recommend having the other distribution use the contents of
that swap partition for "returning from hibernation"... ;-)

--
*Aragorn*
(registered GNU/Linux user #223157)
From: Rahul on
gazelle(a)shell.xmission.com (Kenny McCormack) wrote in news:i37mih$23s$1
@news.xmission.com:

> That is, is there anything wrong with using "mkswap" on a machine
> running Linux on one architecture (say, i386) to create a swap partition
> on a device, then using that device for swap under Linux running on
> another architecture (say, ARM). I.e., assume that, for whatever
> reason, "mkswap" does not exist on the target architecture.
>

I have a Intelx32, Intelx64, and AMDx64 server sitting next to each other.
If you want me to try I'm game.

--
Rahul