Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
swapon failed on disk partition
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
deka2013
n00b
n00b


Joined: 16 Feb 2013
Posts: 3

PostPosted: Sat Feb 16, 2013 11:58 pm    Post subject: swapon failed on disk partition Reply with quote

Greetings!

Sometime ago I'd found, that my swap area was gone. swapon returns "read swap header failed: Invalid argument" on one of swap partitions (main swap) and "read swap header failed: Inappropriate ioctl for device" on other two spare swap partitions. mkswap returns no error. Partition types (all swap partitions mentioned above) are 0x82. swapon on plain file works well.

Kernel is 3.5.7, libc -- 2.15.

On another PC with similar chipset and CPU and same kernel, libc and hdd -- all ok.

I strace'd swapon and there is result:

1. On well working system (just a fragment that start differs from failing PC):

Code:
...
readlink("/dev", 0xbfe0fbaf, 4096)      = -1 EINVAL (Invalid argument)
readlink("/dev/sda2", 0xbfe0fbaf, 4096) = -1 EINVAL (Invalid argument)
stat64("/dev/sda2", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 2), ...}) = 0
open("/dev/sda2", O_RDONLY|O_LARGEFILE) = 3
uname({sys="Linux", node="tyger", ...}) = 0
ioctl(3, BLKGETSIZE64, 4294967296)      = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536) = 65536
close(3)                                = 0
swapon("/dev/sda2")                     = 0
...


2. On failing system:
Code:
...
readlink("/dev", 0xbfadc3b7, 4096)      = -1 EINVAL (Invalid argument)
readlink("/dev/sda2", 0xbfadc3b7, 4096) = -1 EINVAL (Invalid argument)
stat64("/dev/sda2", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 2), ...}) = 0
open("/dev/sda2", O_RDONLY|O_LARGEFILE) = 3
uname({sys="Linux", node="pioneer", ...}) = 0
ioctl(3, BLKGETSIZE64, 0xbfade3b0)      = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, BLKGETSIZE, 0xbfade378)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, FDGETPRM, 0xbfade35c)          = -1 ENOTTY (Inappropriate ioctl for device)
fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 2), ...}) = 0
...


So what's wrong and why ioctl(3, BLKGETSIZE64,..) returns ENOTTY?

PS. In addition:

1. on well-working system:

Code:
# blockdev --getsz /dev/sda2
8388608
# blockdev --getsize /dev/sda2
8388608
# blockdev --getsize64 /dev/sda2
4294967296
#


2. On bad-working one:

Code:
# blockdev --getsz /dev/sda2
6291456
# blockdev --getsize /dev/sda2
BLKGETSIZE: Inappropriate ioctl for device
# blockdev --getsize64 /dev/sda2
BLKGETSIZE64: Inappropriate ioctl for device
#


The same replies on ANY partition.
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3944
Location: USA

PostPosted: Sun Feb 17, 2013 9:41 am    Post subject: Reply with quote

When you say "same kernel" do you mean same version or was it a byte-for-byte copy of the kernel, libc, util-linux ?
I first wonder if large disk support was enabled in one kernel but not the other, but if you had a binary copy of the kernel then this shouldn't be a problem...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
deka2013
n00b
n00b


Joined: 16 Feb 2013
Posts: 3

PostPosted: Sun Feb 17, 2013 3:22 pm    Post subject: Reply with quote

eccerr0r wrote:
When you say "same kernel" do you mean same version or was it a byte-for-byte copy of the kernel, libc, util-linux ?
I first wonder if large disk support was enabled in one kernel but not the other, but if you had a binary copy of the kernel then this shouldn't be a problem...

I mean "same version with very similar .config". Basically both .configs was identical, both kernels was built about same time -- I checked update on one of PCs and then updated another one. Of cause, there is some differences, but their differs on "application" level -- e.g. sound or network drivers, file systems. No kernel core options differs.
The same for libc and util-linux.

Well, what .config option(s) do you mean writting "large disk support"? Maybe I'm wrong, but I cannot remember any new options such type since 2.6.* kernel, on which swapon (or, if to be exact, ioctl(BLKGETSIZE)) works as expected. My disaster happened after one of upgrades on 3.* kernel branch, unfortunately I don't know on which (to 3.0.35, 3.2.?? or current 3.5.7)
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3944
Location: USA

PostPosted: Sun Feb 17, 2013 8:28 pm    Post subject: Reply with quote

You're right, there shouldn't be, but can't rule out the possibility that something wasn't set right...

Stuff like CONFIG_LBDAF perhaps?

If you diff the two .configs, what's different? Sure it's only driver differences?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
deka2013
n00b
n00b


Joined: 16 Feb 2013
Posts: 3

PostPosted: Sun Feb 17, 2013 11:09 pm    Post subject: Reply with quote

eccerr0r wrote:

Stuff like CONFIG_LBDAF perhaps?

Set to 'y' in both configs

eccerr0r wrote:

If you diff the two .configs, what's different? Sure it's only driver differences?

Sure, not. But nothing related to disk io or affected filesystems.

There is full 'diff -u' output. config-tyger -- .config from well-working system, config-pioneer -- the one from system with ioctl() trouble: http://pastebin.com/tfX3TkBh
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum