Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Swapfile on laptop HDD
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Kresp
n00b
n00b


Joined: 17 Oct 2016
Posts: 60

PostPosted: Thu Oct 12, 2017 1:55 pm    Post subject: Swapfile on laptop HDD Reply with quote

I'm trying to setup hibernation, so I moved swapfile from SDD root drive to more spacious HDD.

Now on mount kernel complains that file does not exist, even though the partition containnig it is already mounted cleanly.
First file access to this HDD after boot is really slow and takes a couple of seconds to ls - so I think it must be one of those annoying ones that take their time to spin up and down to save energy.
lshw detects it as Western Digital WDC WD5000LPCX-2.

If I execute swapon -a, it mounts fine, but it does not work on boot.
Any way to make this initial HDD mount on boot blocking so it waits for the drive to spin up before trying to mount swapfile?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3776
Location: Austro Bavaria

PostPosted: Thu Oct 12, 2017 1:59 pm    Post subject: Reply with quote

http://man7.org/linux/man-pages/man7/bootparam.7.html

Quote:
'rootdelay='
This parameter sets the delay (in seconds) to pause before
attempting to mount the root filesystem.


Normally needed for USB "external" drives. Try something very big like 20 seconds or such first! you can optimize later

--

Also use busybox or something else to determine how your "early boot stage", and if your "early boot stage" sees your drive. how it is named and such ! some bootloaders also have a build in shell which can be used to debug things. "early boot stage" is in my point of view different to booted box.
Back to top
View user's profile Send private message
Kresp
n00b
n00b


Joined: 17 Oct 2016
Posts: 60

PostPosted: Thu Oct 12, 2017 2:24 pm    Post subject: Reply with quote

rootdelay only affects root filesystem and it's fast nvme drive.

Swap file is on normal HDD.
Kernel does indeed seems it - i can access it via emergency shell, for example, and it gets mounted normally.

Btw, how do I read boot log? I can see swapfile mount error before login screen, but can not find it anywhere in /var/log - neither kernel nor messages.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3776
Location: Austro Bavaria

PostPosted: Fri Oct 13, 2017 9:30 am    Post subject: Reply with quote

There were an option to turn off powersaving with SMART on HARDDRIVES.

Did you tried rootdelay? No?

Quote:
If I execute swapon -a, it mounts fine, but it does not work on boot.
Any way to make this initial HDD mount on boot blocking so it waits for the drive to spin up before trying to mount swapfile?


Early boot stage vs Last stage of init

https://wiki.gentoo.org/wiki/Fstab

Quote:
localmount- Mount disks and swap according to fstab.


I assumed this is common knowledge when using linux these days.

--

Also breaks down, how your /etc/fstab is, if you are using a feasable init like eudev + openrc, I am not talking about systemd (that's maybe total different), not talking about static init, any other init there exists.

--

I think you may have a broken init, or it is the init script job to do that. => initramfs job to be precise

E.g. I had to edit the genkernel initramfs + rebuild it and since than I use it with newer kernels.

--

Sometimes you need to adress the drive in another way. sda / sdbxy is a bad idea. usually UUID works better, or any other way to adress the drives.
In my point of view, the human readable naming is the best, therefore I use luks + lvm. I have named the lvm "containers" (very wrong naming) to something easily readable. Please check gentoo wiki on how to address a "drive" (generic term now) with a kernel and a bootloader.

e.g. /dev/mapper/root_vg_root_volume_SanDisk-lv_root_volume_SanDisk-root

--

Also grub2 (linux mint, older version) uses a different naming than the system, it starts counting by Zero afaik. Gives only a headache, therefore lvm is much easier, the only issue

--

I think your issue will mostly be fixed by using lvm instead, and editing and fixing the initramfs from genkernel itself, if you want to go my route. This also suggest that you edit your bootloader by hand and not using some self destructing script from grub.

or

when you post all affecting files, starting with bootloader files and such.

--

quote random net ressource:
Quote:
dmesg output is diagnostic messages of the Linux kernel, i.e. some information about hardware and driver initialization.


https://forums.gentoo.org/viewtopic-t-708863-highlight-bootlog.html

--
It breaks down reading the docs, analyzing what is really done. I did the same and since than my issues were solved. Even shipped scrips are very often broken, or need to be adapted. Not every usecase is covered.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 38837
Location: 56N 3W

PostPosted: Fri Oct 13, 2017 10:11 am    Post subject: Reply with quote

Kresp,

There are two aspects to rotating rust HDD. The electronics, which the kernel will see as fast as your NVMe drive and data access, which requires the drive to be spun up, heads loaded and generating a 'ready' signal.

The kernel probably has a timeout on how long it will wait for ready before it gives up and resets the drive.
dmesg may show some HDD error messages. They would be useful.
Even healthy laptop HDDs should not not trigger the timeout.

As you say, rootdelay is not useful to you.

Please post the output of
Code:
fdisk -l
and the content of your boot loader configuration file.
You /etc/fstab might be interesting too but it won't affect resume.

Suspend/Resume is a two step process too.
Suspending to one swap and attempting to resume from another would produce your reported symptoms. Suspend would work though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 4373

PostPosted: Fri Oct 13, 2017 5:39 pm    Post subject: Reply with quote

Change its line in /etc/fstab to noauto and put a direct swapon command in a startup script in /etc/local.d. It'll start after udev so the drive should be spun up by then, it also won't block the rest of the boot process.
_________________
Your PID1 sucks // runit-scripts
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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