LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-06-2018, 12:49 PM   #1
BrandNewToUbuntu
LQ Newbie
 
Registered: Oct 2018
Posts: 10

Rep: Reputation: Disabled
Encrypt a swap file residing on a hd where Ubuntu runs from a USB stick


Hi everyone,

I'm running Ubuntu on a USB stick and have created a swap file on the computer's hd the stick is plugged in at, so that Ubuntu can run faster. Since the pc just has USB2.0 .

Now it works fine ( except of hibernation ). However I want to encrypt the swap file since it does not reside on the stick.

Using ecryptfs-setup-swap ( sudo ) when the swap is mounted kinda works and sets the appropriate entries in fstab and cryptstab however the defined /dev/mapper/cryptswap1 in fstab are not generate in the folder /dev/mapper. I usually try to find the solution by myself in order to learn the materia, however I'm not able to get the encryption of that swap file done no matter what I do. So what am I missing here?

The content of my fstab is :

UUID=592c5fe4-d05a-48b8-8826-9c8ea0464274 / jfs errors=remount-ro 0 1
#/swapfile none swap sw 0 0
/dev/disk/by-uuid/624C30384C3008F5 /home/ac/Drives/AspireONE auto nosuid,nodev,nofail 0 0
/home/ac/Drives/AspireONE/AntiCrime.swap none swap sw 0 0

/dev/mapper/cryptswap1 none swap sw 0 0

And the crypttab :

cryptswap1 /home/ac/Drives/AspireONE/AntiCrime.swap /dev/urandom swap,offset=1024,cipher=aes-xts-plain64

Any ideas?
 
Old 10-06-2018, 04:48 PM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: Currently OpenMandriva. Previously openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,076

Rep: Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576Reputation: 1576
While I can't say I've done this myself (and didn't think it was possible), upon some searching, it seems it is possible. But, it looks like too much effort for me personally.

Have you seen the following links?

https://wiki.archlinux.org/index.php...wap_encryption
https://wiki.archlinux.org/index.php..._file_creation

(sorry if you already have, but the Arch Linux wiki is probably the best one out)
 
1 members found this post helpful.
Old 10-06-2018, 06:09 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
How did you make the swap file? Did you make it first and then encrypt it? Or did you open it and then make it a swap file?

I don't understand the need for this, because the requirement for swap is really dependent on the amount system ram. Usb 2 is 420 MB/s, way faster than flash memory. How much memory is in the machine?
 
Old 10-07-2018, 11:46 AM   #4
BrandNewToUbuntu
LQ Newbie
 
Registered: Oct 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
While I can't say I've done this myself (and didn't think it was possible), upon some searching, it seems it is possible. But, it looks like too much effort for me personally.

Have you seen the following links?

https://wiki.archlinux.org/index.php...wap_encryption
https://wiki.archlinux.org/index.php..._file_creation

(sorry if you already have, but the Arch Linux wiki is probably the best one out)
Thx, jsbjsb001 !! I worked it out with the help of ArchLinux. Awesome site!

Basically, you have to make following entries :

in fstab :
/swapfile none swap sw 0 0

And the crypttab :

swapfile /home/ac/Drives/AspireONE/AntiCrime.swap /dev/urandom swap,cipher=aes-xts-plain64


and that's it already. The /dev/mapper/swapfile is then generated after reboot automatically. Kinda easy when you know
 
Old 10-07-2018, 12:01 PM   #5
BrandNewToUbuntu
LQ Newbie
 
Registered: Oct 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
How did you make the swap file? Did you make it first and then encrypt it? Or did you open it and then make it a swap file?

I don't understand the need for this, because the requirement for swap is really dependent on the amount system ram. Usb 2 is 420 MB/s, way faster than flash memory. How much memory is in the machine?
I made the file using "dd ..." without encrypting it.

I got USB2.0 on that machine I'm using currently and it is kinda slow in starting and switching between apps. The stick is a USB3.0 one, maybe that is the reason. Who knows. However having a swap file on the host computer's hd has speed up ubuntu notably.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Knoppix on USB stick sometimes runs very slow pedrwilliams Linux - Newbie 3 03-24-2014 12:40 PM
How to encrypt Mint 13 KDE (which runs from USB Flash) without reinstall imayneed Linux - Software 4 09-19-2012 01:10 AM
Do I need swap space if installing linux on a USB flash stick? FireRaven Linux - Software 3 09-22-2010 12:27 PM
can I use a USB stick for home and swap? euripides Linux - Newbie 7 09-13-2009 07:45 PM
Trying To Encrypt a USB Stick bobbelfield Mandriva 4 02-20-2006 07:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration