How to add Swap to current session?

Using applications, configuring, problems
Message
Author
jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#16 Post by jafadmin »

greengeek wrote:Thanks for confirming that Swap is a security risk. I had thought this for a long time but without knowing for sure. As a matter of interest - how would you violate the sanctity of someones swap space and check up on someones mylittlepony research? Hex editors? Forensic recovery utilities? etc?
cheers!
Someone would typically use "dd" to copy the swap partition to an image file. After that, it's fairly trivial to copy the file to a thumb drive and take it to summer camp where everyone sitting around the campfire can use it for mutual amusement into the wee hours of the morning.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#17 Post by nic007 »

How big was your swapfile and on what medium? A Big one will take extra long to create on a pendrive and will also work slowly from it. I remember a while back asking a similar question on here relating to whether a swapfile actually works when one is running totally in RAM (because I have never seen it in action in that situation myself). A user with very low specs and RAM did confirm it works for him under those circumstances.

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#18 Post by HerrBert »

nic007 wrote:.... A user with very low specs and RAM did confirm it works for him under those circumstances.
http://murga-linux.com/puppy/viewtopic. ... 336#989336

i use the swap-file created after boot only for palemoons cache but it does not increase the personal storage.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#19 Post by greengeek »

nic007 wrote:How big was your swapfile and on what medium?
Yep, it was a 2GB swap file on a 16GB usb stick. Not sure of the write speed of the stick, or of the specs of the usb controller, or of the actual driver puppy had allocated to that usb port - so all in all those factors add up to generate the un-likelihood of good performance. It did prove that the swap space could be created and is available for normal swap usage.

Could i use that utility to create a swap space on the NTFS partition? (ordinarily I want to avoid doing this as my puppy is set to handle NTFS 'readonly' - but maybe some times i might decide it is necessary and advantageous to use inbuilt HDD...)
HerrBert wrote:i use the swap-file created after boot only for palemoons cache but it does not increase the personal storage.
Thanks for confirming. Is there a method how you restricted the swap space only to Palemoon? Or was that the only programme thrashing the memory at the time?
jafadmin wrote:Someone would typically use "dd" to copy the swap partition to an image file. After that, it's fairly trivial to copy the file to a thumb drive and take it to summer camp where everyone sitting around the campfire can use it for mutual amusement into the wee hours of the morning.
<chuckle> Sounds like fun. Do you have an example of syntax to create the image file? And by image file do you mean an iso??

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#20 Post by nic007 »

You can create the swapfile on an ntfs partition but personally I won't. Linux and ntfs filesystems don't go along very nicely in my experience (more likely to get corrupted).

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#21 Post by jafadmin »

greengeek wrote: <chuckle> Sounds like fun. Do you have an example of syntax to create the image file? And by image file do you mean an iso??
dd bs=1M if=/dev/<swap partition> of=/mnt/MyUSB/swapdump.dd

Then just use hexedit to browse swapdump.dd

(it's what all the cool kids do ..)
Last edited by jafadmin on Thu 21 Jun 2018, 13:37, edited 1 time in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#22 Post by greengeek »

... also just wanted to post an interesting link for me to investigate further later:

https://unix.stackexchange.com/question ... e-in-linux

It discusses other uses of swap space and I am looking for more details about how swap can be reallocated as temporary data storage areas (like puppy seems to do during boot and i guess prior to the "switch root" phase)

EDIT: Also -
https://askubuntu.com/questions/846163/ ... filesystem
It is quite common to write a single file (ala tar and dd) to unformatted storage, and even more common to have nested filesystems (virtual disks, .iso, squashfs). Games on floppy would sometimes write high scores to an absolute (fixed) location, and some applications are Cylinder, Head, Sector based. Swap partitions are still partitions, but no, there is no filesystem, or "mapping" other than offset and run ? – mckenzm Nov 7 '16 at 1:31
Last edited by greengeek on Tue 19 Jun 2018, 18:22, edited 1 time in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#23 Post by greengeek »

jafadmin wrote:(it's what all the cool kids do ..)
Explains why I had no idea how to do it. My coke bottle lenses are too thick to be cool.
:-)

Thanks for the syntax!
nic007 wrote:You can create the swapfile on an ntfs partition but personally I won't. Linux and ntfs filesystems don't go along very nicely in my experience (more likely to get corrupted).
Thanks. I'm not a fan of cross copulating with NTFS but good to know it can be done if needed.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#24 Post by greengeek »

jafadmin wrote:Then just use hexedit to browse swampdump.dd
Ahhh, I see what you mean,,,

Code: Select all

  @
   |
   -
 /    \
/ UU  \
 |   |
 / v \
 |   |
_|  _|

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#25 Post by HerrBert »

greengeek wrote:Is there a method how you restricted the swap space only to Palemoon? Or was that the only programme thrashing the memory at the time?
it is not restricted to palemoon, but palemoon is the only app i use on this old netbook, that runs out of memory very quick and causes a freeze.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#26 Post by nic007 »

Hi, HerrBert - The following command will free all your systems caches. I used to run it in regular intervals. May be useful to you:

Code: Select all

sync;echo 3 > /proc/sys/vm/drop_caches

Post Reply