You are not logged in.
Hello everyone,
lately I find myself booting into Windows more often than I would like (looking at you Cyberpunk 2077).
How ever, I hate loosing my tabs/windows/working environment. I know that KDE can restore a session but still a few things are always missing.
So I came up with a master plan to make things a lot easier for me:
1. Boot into Arch
2. Work for days, open 7800 firefox tabs and 280 windows
3. Feel like you want to paly some Cyberpunk
4. Hibernate the whole currently running Arch system to the disk
5. Boot the laptop
6. Select Windows instead of Arch in GRUB
7. Windows will start
8. Play Cyberpunk until it crashes a gazillion times
9. Get frustrated and turn off Windows
10. Boot the laptop
11. Select Arch instead of Windows in GRUB
12. Back to my Arch system with my whole working environment as it was before I switched to Windows
Now in order to be able to do that I will have to:
1. Create a swap file (currently I do not have a swap partition or swap file)
2. Somehow manage that disk encryption will still work and be secure even when using the swap file
3. If possible, find a way to only use to swap file for hibernation (suspend to disk) or at least only in very very minor cases where it might really be needed (my laptop has 32GB of RAM).
Is this the correct way for 1.) and 2.) ?
#create swap file on luks/lvm encrypted container
dd if=/dev/zero of=/swapfile bs=1M count=36864 status=progress #32GB RAM so 36GB SWAP? is /dev/zero correct?
chmod 600 /swapfile
mkswap /swapfile
swapon/swapfile
/etc/fstab -> /swapfile non swap default 0 0#enable hibernation with encryption:
/etc/mkinitcpio.conf:
HOOKS=(base udev autodetect keyboard keymap modconf block encrypt lvm2 resume filesystems fsck)
Add kernel parameter: resume=/dev/mapper/MyVolumeGroups/swapfile
Save physical_offset output from "filefrag -v swap_file"
Add kernel parameter: resume_offset=saved_output_from_filefrag
mkinitcpio -P
/etc/sysctl.d/99-swappiness.conf -> vm.swappiness=0
The steps are basically copied from the wiki but I thought that my user case is a little more "special".
So I hoped someone could double check before I go for it :-)
Thanks!
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
The HW is expected to be in a certain state when resuming from suspend or hibernate, if you run Windows while having a linux system suspended there aren't any guarantees for that state to still be correct when you decide to switch again.
That said if you do want to try this the general path looks alright. There shouldn't be a reason to set vm.swappiness away from defaults (the system is not going to use swap unless you actually are running out of RAM and if you run into a situation where it would be useful to be used setting it to 0 is likely to generally be counter productive) but for the intended usecase you could indeed set that. see https://chrisdown.name/2018/01/02/in-de … setting-be as well
Online
Hey V1del,
Yes I already worried that a reboot might affect the state of the hibernated hardware. But i guess i will simply try if it works. Or are you certain that things will break?
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline
with suspend to disk the main pitfall is accessing the filesystem of the suspended system, thereby corrupting it ( see big fat warning in https://www.kernel.org/doc/Documentatio … swsusp.txt )
you have to keep in mind that a suspended system is "still running" so it still has a lock on mounted filesystems and does not expect on-disk data to change
this is also why ntfs-3g refuses to mount windows filesystems, when windows is in a suspended state
if you intend to keep suspended images around or in parallel, you have to make sure to properly isolate them from each other so to avoid data corruption
Offline
Regarding isolation:
Linux and Windows have each their own nvme.
So I am not accessing each others file system.
The only thing that both "share" is the bootloader partition on the nvme where linux is also located.
Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF
Offline