What's new

how to use swap partition instead of file

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

steelskinz

Regular Contributor
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.
 
Try
Code:
mkswap /tmp/mnt/sdb2
swapon /tmp/mnt/sdb2
Now verify with free command
Code:
free
 
Thanks. Will try it tonight. Won't it delete my other ext4 partition on the same device ?
 
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
 
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)
 
It works until reboot. Guess I have to add swapon /dev/sda1 in post-mount as mention. Thanks. :)
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top