Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

how to use swap partition instead of file

Discussion in 'Asuswrt-Merlin' started by steelskinz, Feb 17, 2017.

  1. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    Hi there,
    As i had problem with my USB key i formatted it and i want to know if it is possible to use a swap partition instead of creating a swap file under extX partition.
    I don't see it when i type "mount" and don't really know how to do it.
    It is labelled SWAP on sdb2.

    Thanks.
     
  2. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    937
    Location:
    Europe
    Try
    Code:
    mkswap /tmp/mnt/sdb2
    swapon /tmp/mnt/sdb2
    Now verify with free command
    Code:
    free
     
  3. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    937
    Location:
    Europe
    If is not working, post output from
    Code:
    mount
    fdisk -l
     
  4. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    Thanks. Will try it tonight. Won't it delete my other ext4 partition on the same device ?
     
  5. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    Disk /dev/sda: 121438208 sectors, 57.9G
    Logical sector size: 512
    Disk identifier (GUID): c36f47c9-6879-49e1-9605-0851cb43335f
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 121438174

    Number Start (sector) End (sector) Size Code Name
    1 2048 2099199 1024M 0700 SWAP
    2 2099200 121436159 56.9G 0700 MEDIA
    Found valid GPT with protective MBR; using GPT

    Disk /dev/sdb: 121438208 sectors, 57.9G
    Logical sector size: 512
    Disk identifier (GUID): 57a96495-b6fd-408c-83d5-97c0bd2e2ca2
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 121438174

    Number Start (sector) End (sector) Size Code Name
    1 2048 121436159 57.9G 0700 BT
     
  6. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    937
    Location:
    Europe
    And "mount" output?
     
  7. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    rootfs on / type rootfs (rw)
    /dev/root on / type squashfs (ro,relatime)
    devtmpfs on /dev type devtmpfs (rw,relatime,size=127756k,nr_inodes=31939,mode=755)
    proc on /proc type proc (rw,relatime)
    tmpfs on /tmp type tmpfs (rw,relatime)
    sysfs on /sys type sysfs (rw,relatime)
    devpts on /dev/pts type devpts (rw,relatime,mode=600)
    /dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
    usbfs on /proc/bus/usb type usbfs (rw,relatime)
    /dev/sdb1 on /tmp/mnt/BT type ext2 (rw,nodev,relatime,errors=continue,user_xattr)
    /dev/sda2 on /tmp/mnt/MEDIA type ext4 (rw,nodev,relatime,barrier=1,data=ordered)
     
  8. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    937
    Location:
    Europe
    Ok, try
    Code:
    mkswap /dev/sda1
    swapon /dev/sda1
     
  9. Diamond67

    Diamond67 Regular Contributor

    Joined:
    Jul 23, 2015
    Messages:
    70
  10. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    It works until reboot. Guess I have to add swapon /dev/sda1 in post-mount as mention. Thanks. :)
     
    Last edited: Feb 17, 2017
  11. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    937
    Location:
    Europe
    Yes, add at the end of /jffs/scripts/post-mount
    Code:
    swapon /dev/sda1
     
    amplatfus likes this.
  12. steelskinz

    steelskinz Regular Contributor

    Joined:
    Mar 9, 2015
    Messages:
    78
    Location:
    France
    Work great ! Thank you.

    Ps : TeHashX thanks for your website dude ! ;)
     
    TeHashX likes this.

Share This Page