• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Need help on using vi

Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
20 Posts 5 Posters 7.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    dreamerman
    last edited by May 5, 2016, 11:18 AM

    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.

    pfSense 2.3-RELEASE (amd64)
    DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

    1 Reply Last reply Reply Quote 0
    • H
      heper
      last edited by May 5, 2016, 11:33 AM

      Vi somefile
      Press [insert]
      Make adjustments
      Press [escape]
      Type:  wq!

      1 Reply Last reply Reply Quote 0
      • P
        phil.davis
        last edited by May 5, 2016, 11:55 AM

        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.

        As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
        If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

        1 Reply Last reply Reply Quote 0
        • M
          muswellhillbilly
          last edited by May 5, 2016, 12:05 PM May 5, 2016, 12:00 PM

          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.

          1 Reply Last reply Reply Quote 0
          • D
            dreamerman
            last edited by May 7, 2016, 11:12 PM May 7, 2016, 11:07 PM

            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 2

            Do 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.

            IMG_0628.JPG
            IMG_0628.JPG_thumb

            pfSense 2.3-RELEASE (amd64)
            DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

            1 Reply Last reply Reply Quote 0
            • D
              Derelict LAYER 8 Netgate
              last edited by May 7, 2016, 11:51 PM

              Does pfSense run?

              Diagnostics > Edit File

              Chattanooga, Tennessee, USA
              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
              Do Not Chat For Help! NO_WAN_EGRESS(TM)

              1 Reply Last reply Reply Quote 0
              • D
                dreamerman
                last edited by May 8, 2016, 12:19 AM May 8, 2016, 12:06 AM

                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….......  :-[

                pfSense 2.3-RELEASE (amd64)
                DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                1 Reply Last reply Reply Quote 0
                • D
                  dreamerman
                  last edited by May 8, 2016, 12:11 AM

                  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?

                  pfsense.JPG
                  pfsense.JPG_thumb

                  pfSense 2.3-RELEASE (amd64)
                  DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                  1 Reply Last reply Reply Quote 0
                  • D
                    Derelict LAYER 8 Netgate
                    last edited by May 8, 2016, 2:57 AM

                    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.

                    Chattanooga, Tennessee, USA
                    A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                    DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                    Do Not Chat For Help! NO_WAN_EGRESS(TM)

                    1 Reply Last reply Reply Quote 0
                    • D
                      dreamerman
                      last edited by May 8, 2016, 8:58 AM

                      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).

                      pfSense 2.3-RELEASE (amd64)
                      DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                      1 Reply Last reply Reply Quote 0
                      • D
                        Derelict LAYER 8 Netgate
                        last edited by May 8, 2016, 9:55 AM

                        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.

                        Chattanooga, Tennessee, USA
                        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                        Do Not Chat For Help! NO_WAN_EGRESS(TM)

                        1 Reply Last reply Reply Quote 0
                        • D
                          dreamerman
                          last edited by May 8, 2016, 10:16 AM

                          @Derelict:

                          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?

                          pfSense 2.3-RELEASE (amd64)
                          DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                          1 Reply Last reply Reply Quote 0
                          • D
                            dreamerman
                            last edited by May 8, 2016, 11:05 AM

                            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 2

                            Have rebooted pfsense and did not vomit any errors. So is that it? How do I know squidcache is pointing to my second hdd ada1p1?

                            pfSense 2.3-RELEASE (amd64)
                            DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                            1 Reply Last reply Reply Quote 0
                            • H
                              heper
                              last edited by May 8, 2016, 11:07 AM

                              just type 'mount' in the console & press enter

                              1 Reply Last reply Reply Quote 0
                              • D
                                dreamerman
                                last edited by May 8, 2016, 11:21 AM

                                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)

                                pfSense 2.3-RELEASE (amd64)
                                DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                                1 Reply Last reply Reply Quote 0
                                • D
                                  Derelict LAYER 8 Netgate
                                  last edited by May 8, 2016, 11:25 AM

                                  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.

                                  Chattanooga, Tennessee, USA
                                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    dreamerman
                                    last edited by May 8, 2016, 11:39 AM

                                    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?

                                    pfSense 2.3-RELEASE (amd64)
                                    DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      Derelict LAYER 8 Netgate
                                      last edited by May 8, 2016, 11:42 AM

                                      Insignificant.

                                      Chattanooga, Tennessee, USA
                                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        dreamerman
                                        last edited by May 8, 2016, 11:48 AM

                                        @Derelict:

                                        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?

                                        pfSense 2.3-RELEASE (amd64)
                                        DELL Optiplex GX620 Pentium D CPU 3.40GHz, 240GB SSD, 4GB RAM

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          Derelict LAYER 8 Netgate
                                          last edited by May 8, 2016, 11:54 AM

                                          Standard logs are circular and when you're talking about hundreds of gigabytes it is insignificant.

                                          Chattanooga, Tennessee, USA
                                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                          1 Reply Last reply Reply Quote 0
                                          20 out of 20
                                          • First post
                                            20/20
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                            This community forum collects and processes your personal information.
                                            consent.not_received