Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 812  / 1 Year ago, sat, april 29, 2023, 12:53:26

What I want: I want to install Ubuntu on a USB pen drive completely independent of the Windows partition schemes, but i want it to run fast.

Ie: When pdrive is not inserted, boot windows and nobody knows i use linux;

when pdrive inserted boot ubuntu(setting the bios to use pdrive when it is present)



||



Problem: because the pen drive is slow Ubuntu loads file/applications to and from the pen drive and/or the swap partition on it.
Only the loading of libraries for active applications (maybe some setting files written once in a while also) make the most semnificative impact on the oss; it seems that swapping (on my 6gb, 4x2.4ghz computer) never takes place(which is good, since pdrive swap is awfully slow). Firefox is extremely slow for example, freezing 5s every 20s if i am installing stuff (which i do everytime i install the os) and 5s every 60s if i am not but have 5tabs open = pain the f*cking neck



||



My solution:

1 I can use TrueCrypt to make a virtual swap partition(since they do not affect the hdd noone can tell i am using a diferent os) on the windows hdd which would speed up the swapping incredibly much but what about the application loading from the pen drive since hdd swap speed (even with decryption is 10x faster)
2 Thx to blankreg for these commands(though i want to go into more detail about them)
3 Boot to ram

4 Preload is useless with boot to ram



|| ||



|| ||



What other ways of optimizing such a configuration?



THX blankreg for this great information,
I would also like to add the PRELOAD package works wonders


More From » boot

 Answers
6

0k here is what i did and works wonders:



-1 truecrypt swapping from hdd (didnt do it yet, i will because i need some 10gb swap space later on for some gimp image processing



2 thx to blankreg i used some of his code:



vm.swappiness = 10
vm.vfs_cache_pressure = 50
vm.dirty_writeback_centisecs = 1500


these 3 lines are very useful but the later ones became useless once i implemented the 3rd option, although swappiness(do not set it to 0 as when ram will get full you will need to wait to swap parts of it before running the current program, when set to 10, imagine that the os will leave 10% free ram space for unexpected applications and while running them free some other 10%)



and cache pressure is important as programs can break if the next command to be run is not in memory(setting this value to low will cause data-ram to be ejected to swap when needed and code-ram be constantly present in ram - which is bad because when you are not using firefox for example you dont need the code-ram of it so those rams could be used by the active aplication to store data-ram)



and writeback is useful for the /home directory read writes not overflood the pdrive with lots of small writes, instead use few big writes (NOT SURE) so that the pdrive can be free whenever a read operation need to be performed(you do want firefox not to freze, do you? this is because programs dont need to wait for writes, they just say they want to save this there and then continue on with their business, but when a program reads something, it is waiting (99% of the time) to receive what it wants and in the case of the pdrive it will take more than a few seconds and so firefox freezes)



to implement these commands you need to edit the /etc/sysctl.conf soo run



gksudo gedit /etc/sysctl.conf  


in my case the lines were not present(default values were loaded) so i just added these lines, it is possible for you to edit the lines that have these variables (append or overwrite, who cares, just do it)



3 boot to ram,
http://ubuntuforums.org/showthread.php?t=1594694

here is the forum, a great boot to ram script, it creates another os (now you have 2 ubuntus) one is readonly-fast-ram(do not missunderstand readonly, you can read and write in the filesystem whatever you want ie install games and programs, but once reboot or shutdown occurs those files will be lost) other one is readwrite-slow-pdrive

to enable your /home folder to store data between restarts you need to make a partition for "/home", and another for "/"

i noticed that the "/" partition used 2x800mb soo take into consideration how many applications you are going install there
I HAVE NO IDEA if the readonly-fast-ram os can move to swap instead of ram (preferably the hdd swap, making it just as slow as it were installed on the hdd (instead of pdrive which is 10 slower), but as fast as it was installed on a pc from the future) or it will always eat ram



to install the script without reading the forum run



sudo apt-get install git
git clone git://github.com/terminator14/RAM_booster.git
cd /home/UserName/RAM_booster
sudo bash RAM_booster_Ubuntu_12.04.sh


CAFERUL as the above example is for 12.4 version

durring the installation(about 45minutes in my case) you will be asked some question like make the homefolder save data between sessions and making an automatic scheduled operation at midnight (i prefer to update manually, and reading the forum beforehand i already made my /home partition separate)

afterwards your grub will have an extra (new default) option to boot the readonly-fast-ram os, in here IT IS AWESOME! i mean i click firefox and it feels like i didnt release my finger from the button and firefox already pooped(pun intended) open

to save any updates (the simple way) that you have done to the readonly-fast-ram os run



sudo rupdate --both  


this operation saves the data inside the ram os to the readwrite-slow-pdrive, and to the readonly-fast-ram container (they are separate, this container is loaded to ram in about 45seconds in my case at bootup)



4 preloader, cant not talk about preloader, preloader is nice because it tries to load all the libraries that can be needed (instead of being needed at that moment in time and then removed) to the ram, but since step 3 already does this it is useless to install preloader if you installed boot to ram, but in case you dont want to install boot to ram then use this code



sudo apt-get install preload  


but if you are already here (didnt install boot to ram) think of using blankreg's code to store some temporary files to ram instead of disk (though it wont help a lot, i tried it a few days ago, and firefox froze frequently enough to piss you off when the pc was doing lots of things (i was updating the local dropbox folder + installing some aplications + sufring the net about boot to ram and it still froze every 45 seconds or so, good thing i could read the letter while it was frozen)

i dont recomend using the last line of code, as my ubuntu broke a few times(~4) when running from the pendrive in workspace switcher ie mose was moving, keyboard no efect, nothing on screen was updated clock showed same time for the past 30minutes, and i really wanted to check the crash report



gksudo gedit /etc/fstab  

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/backups tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/cache/apt/archives/ tmpfs defaults,noatime 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0

[#28577] Sunday, April 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ainlyyor

Total Points: 210
Total Questions: 129
Total Answers: 116

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
;