Need help on using vi
-
Ok I have been stuck for a week now. I added a second SATA hdd for squid. My pfsense 2.3-RELEASE (amd64) is working fine.
I followed https://www.freebsd.org/doc/handbook/disks-adding.html and reached the stage where a file system is created in the new partition on the new disk # newfs -U /dev/ada1p1
Next I tried to create a mount point using # mkdir /squidcache. It is telling me that the file exists. So I tried # mkdir squidcache and that seems to work. I get the following using command ls -1 .cshrc .gitsync_merge.sample . hushlogin .login .profile .shrc .tcshrc squidcache
Note that squidcache is without the dot like others. I think that is ok since I read those with dots are hidden system files.
So the next step will be to add an entry to /etc/fstab so the new disk will be mounted automatically at startup /dev/ada1p1 /squidcache ufs rw 2 2
Problem is how do I use vi? Where and what command I should type? Help.
-
Vi somefile
Press [insert]
Make adjustments
Press [escape]
Type: wq! -
Or use ee
ee somefile
The top of the screen shows the special commands you can use.
Arrow around and make the changes/additions.
Press Esc to get the exit and save dialog. -
There are plenty of online tutorials on using vi. Here are two:
http://www.tutorialspoint.com/unix/unix-vi-editor.htm
http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Editors/ViIntro.html
As heper says, it's quite simple. If I want to edit the file 'file.txt' and amend a line I would do the following:
vi file.txt
Use the arrow key to position myself at the point in the file I wish to amend.
Press the 'i' key to insert new text.
Type my text.
When finished, press the 'ESC' key to exit from 'insert' mode to 'command' mode.
Press the colon symbol (:), followed by w (write) and q (quit). EG: :wq
Press enter after the above command and your file is saved and you've exited the editor.Some people prefer Emacs to Vi, but it's up to you what you feel more comfortable using.
-
I tried vi /etc/fstab several times and had to reinstall pfsense that many times. I think I can manage vi commands (i, :, esc, w, q, set verbose showmode) as I only needed a few to achieve my aim. I realised my other problem is the way my screen displays the output of vi /etc/fstab - see image. Text does not line up with column headers below:-
Device Mountpoint FStype Options Dump Pass#
So how do add the following text in fstab:-
/dev/ada1p1 /newdisk ufs rw 2 2Do I just type it separated by spacebar? I tried that, save fstab and run vi /etc/fstab the result is exactly as I have typed which is not in line with headers and the default texts in fstab.
I must be really dumb as I have NO idea how to do this. Help.
-
Does pfSense run?
Diagnostics > Edit File
-
Does pfSense run? Diagnostics > Edit File
For the life of me why haven't I read about this despite a week's worth of painfully crawling the googlenet? Argh…....... :-[
-
Ok mine looks like this under Diagnostics > Edit File. Column headers and text also don't look aligned. When I type my entry, how do I jump to next column? Do I use tabs?
-
All you need to get is the white space (tabs, spaces) in the right places and it'll work. Doesn't have to line up.
Are you sure you need a second disk? Might be easier to just take a backup, switch drives, reinstall on the larger disk, and restore.
-
Thanks Derelict. What I did was to copy paste the existing swap entry on the next line below and edit the entries while carefully keep to the spaces. I think it works but need to reboot to be sure. I has a second SATA 160GB hdd laying around so I thought I use it for squid cache. I have a very poor internet bandwidth (3.0-3.5mbps ADSL2+) and having a large cache should help (I hope).
-
Right but pfSense is pretty low on disk. I don't know if it's worth running multi-disk just for squid. Install the 160GB, reinstall, and enable squid. Then you're not dealing with things outside the config/gui.
-
Right but pfSense is pretty low on disk.
I am running pfsense on a 240GB SSD. It is just pfsense in the SSD, nothing else. What would you say to be ideal size for squid cache? 50GB?
-
How do I know if I mounted it correctly? I created newfs -U /dev/ada1p1 and mkdir /squidcache. My /etc/fstab looks like below:
Device Mountpoint FStype Options Dump Pass#
/dev/ufsid/572df99e0f441273 / ufs rw 1 1
/dev/label/swap0 none swap sw 0 0
/dev/ada1p1 /squidcache ufs sw 2 2Have rebooted pfsense and did not vomit any errors. So is that it? How do I know squidcache is pointing to my second hdd ada1p1?
-
just type 'mount' in the console & press enter
-
just type 'mount' in the console & press enter
The result is as follows. I don't see squidcache.
/dev/ufsid/572df99e0f441273 on / (ufs, local, journalled soft-updates)
devfs on /dev (devfs, local)
/dev/md0 on /var/run (ufs, local)
devfs on /var/dhcpd/dev (devfs, local) -
I think you're nuts for doing this outside the gui.
If you're worried about SSD writes, reinstall on the spinning disk. If you're not, just enable squid and you're done.
-
If you're worried about SSD writes, reinstall on the spinning disk.
Hey you are right. I did not think much when I used a 240GB SSD. I have a couple of SATA and IDE disks around. I read https://forum.pfsense.org/index.php?topic=34381.0 and FJS explained it well. Ok I am gonna rebuilt pfsense and use a 250GB SATA instead of the SSD.
Reason I wanted to use a second disk is because I have a few laying about doing nothing and I don't want to crowd-out other important pfsense stuff.
So assuming I install all available packages how much disk space it will consume?
-
Insignificant.
-
Insignificant.
Appreciate your replies. Are you able to give me an estimate in terms of GB? If I install all packages and enable all logs in a home network (10 devices) is 100GB enough?
-
Standard logs are circular and when you're talking about hundreds of gigabytes it is insignificant.