Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Move swap to USB
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Move swap to USB
4th Aug, 2014, 04:31 AM
Post: #1
rlogiacco Offline
Registered
Posts: 22
Joined: Jul 2014
Reputation: 0
Move swap to USB
After moving my root filesystem over an external USB drive I was performing some configuration task and just by accident I saw this line logged by dmesg

Code:
[77395.117621] Adding 250876k swap on /dev/mmcblk0p3.  Priority:0 extents:1 across:250876k SSFS

I then checked if that message had any correspondence and, to my surprise:

Code:
$ sudo swapon -s
Filename                                Type            Size    Used    Priority
/dev/mmcblk0p3                          partition       250876  144     0

Now, my cmdline.txt has the following directives related to swap:

Code:
zswap.enabled=1 zswap.compressor=lz4 noswap partswap

I believe the latter partswap is the source of my problems as I don/t have a swap partition on my USB disk, I thought a swap file would do.

I'm going to eliminate the swappart directive, but in case it is not going to solve... where do I specify the zswap configuration? I have nothing relevant in my /etc/fstab....

As I supposed, removing partswap didn't help and removing noswap made the swap partition on sd card get inited at boot.

Humm, I believe I've got some progress on this... Inside /etc/init/zram-swap.conf I've found

Code:
SWAPPART="$(blkid -t TYPE=swap | grep -v 'zram\|loop'| awk -F':' '{print $1}')"
        if [ -z "$SWAPPART" ]; then
            swapfile
        else
            swappart
        fi

I belive I will have to modify this script or remove the swap partition on the SD card to avoid to have it loaded....

On a second thought though having the swap file/partition ona different device than root fs should not be that bad: my only concern is about life expectancy of the SD card... but if I understand zswap it should activate the swap partition only when really needed... Am I wrong on this?
Find all posts by this user
Quote this message in a reply
4th Aug, 2014, 04:59 AM
Post: #2
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
RE: Move swap to USB
Quote:I understand zswap it should activate the swap partition only when really needed...
Yes, you can check this by doing:
Code:
free -m

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
6th Aug, 2014, 09:15 PM
Post: #3
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: Move swap to USB
partswap parameter should during enabled initramfs do this:

1) check if rootfstype=btrfs
2) check if root= is last partition on the block device
3) shrink root
4) create new partition
5) make swap on it

exactly this way is created swap upon first boot.

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 9th May, 2025, 09:44 PM Powered By MyBB, © 2002-2025 MyBB Group.