You are not logged in.
Pages: 1
Currently running arch on a usb device as my old laptop hard drive is failing. Boots and runs ok but does lag from time to time. So thought I would try a swapfile as it only has a gig of ram.. Created swapfile without a problem, ran mkswap but swap on failed. On boot systemd is complaining, am guessing that I need to activate a service so systemd sees swap?
Never really used swap before so am in the dark about using it.
Have thought about adding some more options too fstab to boost f2fs performance, possibly discard.
Last edited by Mr Green (2015-04-01 06:57:42)
Mr Green
Offline
Did you add the fstab entry for your swapfile?
https://wiki.archlinux.org/index.php/Swap#Swap_file
systemd should activate swap automatically.
Also, "discard" will reduce performance as the device will attempt to TRIM continuously; try the fstrim.timer instead:
https://wiki.archlinux.org/index.php/So … md_service
Check your USB device will actually support TRIM first:
https://wiki.archlinux.org/index.php/So … IM_Support
Jin, Jîyan, Azadî
Offline
Did add too fstab, only on boot I get an error from systemd (will post later). As I said swapon command failed for some reason. Will look at trim and if usb is supported.
Mr Green
Offline
[mrgreen@ArchUsb ~]$ dmesg | grep swap
[ 9.285635] systemd[1]: Activating swap /swapfile...
[ 10.796658] swapon: swapfile has holes
[ 10.797528] systemd[1]: swapfile.swap swap process exited, code=exited status=255
[ 10.798377] systemd[1]: Failed to activate swap /swapfile.
[ 10.798926] systemd[1]: Job swap.target/start failed with result 'dependency'.
[ 10.798949] systemd[1]: Unit swapfile.swap entered failed state.Fstab
# Swap
/swapfile none swap defaults,pri=10 0 0Error
swapon /swapfile
swapon: /swapfile: swapon failed: Invalid argumentMr Green
Offline
Did you follow all the steps in the ArchWiki page I linked (eg, `chmod 600 /swapfile`)?
Try removing the "pri=10" bit from the options in your fstab line.
What is the output of:
systemctl --all --no-pager|grep swapJin, Jîyan, Azadî
Offline
did the chmod, but will double check, thanks
Mr Green
Offline
[mrgreen@ArchUsb ~]$ systemctl --all --no-pager|grep swap
● swapfile.swap loaded failed failed /swapfile
swap.target loaded inactive dead Swap
[mrgreen@ArchUsb ~]$ Have removed 'pri=10'
Mr Green
Offline
How about:
systemctl status swapfile.swap
systemctl status swap.targetAs they are failed units, this will output a suggestion to check another command output (can't remember what as I haven't had any failed units for a while): post the output of that command as well plz.
Also, how did you create the swapfile?
Jin, Jîyan, Azadî
Offline
I followed wiki page:
fallocate -l 512M /swapfileMade mine 2G...
Mr Green
Offline
Which filesystem are you using?
http://superuser.com/questions/539287/s … filesystem
Jin, Jîyan, Azadî
Offline
f2fs ---
mrgreen@ArchUsb ~]$ systemctl status swapfile.swap
● swapfile.swap - /swapfile
Loaded: loaded (/etc/fstab)
Active: failed (Result: exit-code) since Tue 2015-03-31 20:18:13 BST; 6min ago
What: /swapfile
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 135 ExecActivate=/sbin/swapon /swapfile (code=exited, status=255)Mr Green
Offline
[mrgreen@ArchUsb ~]$ systemctl status swap.target
● swap.target - Swap
Loaded: loaded (/usr/lib/systemd/system/swap.target; static; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd.special(7)Mr Green
Offline
Sorry, you did mention f2fs and of course systemd will fail trying to activate the swapfile if `swapon` failed... ![]()
Perhaps f2fs doesn't support swapfiles.
Jin, Jîyan, Azadî
Offline
I can check by using internal hard drive (ext4)....
Mr Green
Offline
It might be that f2fs does not support swapfiles, swap partition might work will have to test and see...time to break out gparted :-)
Mr Green
Offline
Well f2fs does support swapfiles and does not allow partition resizing. I stuck a small swap partition on laptops internal drive and set up as per Arch Wiki
[mrgreen@ArchUsb ~]$ swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 2047996 0 -1[mrgreen@ArchUsb ~]$ free -h
total used free shared buff/cache available
Mem: 1.5G 55M 1.3G 524K 113M 1.3G
Swap: 2.0G 0B 2.0GRunning from usb does lag from time to time, opening firefox took forever...[I can replace with something lighter in the near future]
Thanks for all your help
Mr Green
Offline
Pages: 1