Announcement

Collapse
No announcement yet.

Activate Swap File after installation

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Activate Swap File after installation

    Hi

    Just done a re-install and forgot to check the "format" box for the swap partition during the process.

    Running the partition manager reveals an "unknown" partition of 1.95 gb. It remains that way after using a live version to format the partition as linuxswap.

    I believe the problem to be my fstab. I have played around with it to try and sort this but, currently to no avail. The contents are:

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>  <type> <options>    <dump> <pass>
    proc      /proc      proc  nodev,noexec,nosuid 0    0
    # / was on /dev/sda1 during installation
    UUID=52644df4-8a37-4190-bdc8-50d507b5de50 /        ext4  errors=remount-ro 0    1
    # /home was on /dev/sda2 during installation
    UUID=5770932f-09cd-4b4a-80ee-1e69fbe3a5bd /home      ext4  defaults    0    2
    # swap was on /dev/sda3 during installation
    UUID=4144565f-09fd-4585-a0b4-74f7168aab7f none	swap  sw	0	0
    /dev/mapper/cryptswap1 none swap sw 0 0
    I'm assuming the final line (which I've never before seen in my fstab) and the previous one conflict. I'm also assuming that the final line has arisen due to me telling the system during install to encrypt the home directory.

    Is anyone able to advise me please on the changes I should make to the fstab file for it to recognise the swap partition?

    Many thanks

    #2
    Re: Activate Swap File after installation

    looks like you got an encrypted swap not home ................I would try removing that last line from fstab (after copying it down) and a reboot to see if that helps ........IS the unknown 1.95 gb partition your swap?

    BUT I never did an encrypted swap or /home before so I'm not real sure what it should look like in fstab


    .........Anyone elce know about encrypted partitions ?

    VINNY
    i7 4core HT 8MB L3 2.9GHz
    16GB RAM
    Nvidia GTX 860M 4GB RAM 1152 cuda cores

    Comment


      #3
      Re: Activate Swap File after installation

      Thanks Vinny

      I have commented out the final line but no joy. After a reboot and a further formatting of the partition the partition manager looks like this

      Sorry it's not very clear but I had to really downsize it to fit the file size requirements. In case you can't see it it shows sda3 with type "unknown"
      Attached Files

      Comment


        #4
        Re: Activate Swap File after installation

        that is strange ........perhaps a deletion and recreating the partition is in order ......IS your /home encrypted?

        that pick was almost to small to see in gwenview ......after enlarging it pixalated quick .

        when it is a good swap partition you are aware of the "swapon" command right! ......it is of corse temporary until it is in fstab

        VINNY
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          Re: Activate Swap File after installation

          you should also varify that the new uuid for the swap partiton is correct in your fstab file. its possible that when you formated it maybe its changed you might also want to format that partiton as swap . perhaps from a live disk (parted magic live is nice). if all else fails you should use swapon <dev> to turn swap on that device.
          Mark Your Solved Issues [SOLVED]
          (top of thread: thread tools)

          Comment


            #6
            Re: Activate Swap File after installation

            yes @sithlord48 has a good point check the UUID with
            Code:
            sudo blkid
            VINNY
            i7 4core HT 8MB L3 2.9GHz
            16GB RAM
            Nvidia GTX 860M 4GB RAM 1152 cuda cores

            Comment


              #7
              Re: Activate Swap File after installation

              Thanks both!

              Here's the output of sudo blkid

              Code:
              ian@ian-MXC051:~$ sudo blkid
              [sudo] password for ian: 
              /dev/sda1: UUID="52644df4-8a37-4190-bdc8-50d507b5de50" TYPE="ext4" 
              /dev/sda2: UUID="5770932f-09cd-4b4a-80ee-1e69fbe3a5bd" TYPE="ext4" 
              /dev/mapper/cryptswap1: UUID="5f2ca019-d440-4852-a79a-8077f85f2b7d" TYPE="swap"
              It is clear that the UUID is different from that in the fstab, so in my excitement I changed the fstab reference for swap to that shown above.

              Rebooted and s**t!!!!!!! The system failed to boot complaining that / could not be found Very weird, but thank goodness for automatic backup - reinstate the fstab with a live CD and I can get back up and running. No swap file though.

              I'm not familiar with swapon. Given it's main use for me would be hibernation I suspect that might not help me in view of what you say about it Vinny, or am I wrong on that one?

              As I see it, I currently have 2 issues. Firstly a UUID mismatch. Secondly it seems no matter how many times I try to format /sda3, when I check it has the type "unknown". That, and the entry in fstab leads me to wonder whether somehow the installation process has encrypted the swap partition rather than /home. In that event I wonder whether a reinstall will be the only answer. Any thoughts please?

              Comment


                #8
                Re: Activate Swap File after installation

                it dose appear as thought that is the case ........swap is encrypted.

                I'v never done one so you will half to research it .

                VINNY
                i7 4core HT 8MB L3 2.9GHz
                16GB RAM
                Nvidia GTX 860M 4GB RAM 1152 cuda cores

                Comment


                  #9
                  Re: Activate Swap File after installation

                  This thread has e a little confused, but I see the initial fstab looks as though swap is defined twice - which is OK except I don't think that was what was intended. Also, both have mountpoints of "none" instead of "swap"

                  As far as UUID's if you're having trouble with them, why use them? They're not required and really aren't of much use in a single drive system.

                  My best guess is you want /dev/sda3 to be swap, but crypttab isn't pointing to it.

                  I would just start over from scratch. Wipe /dev/sda3, re-create encrypted swap, fix you crypttab, and mount it.

                  Please Read Me

                  Comment


                    #10
                    Re: Activate Swap File after installation

                    Originally posted by oshunluvr
                    This thread has e a little confused, but I see the initial fstab looks as though swap is defined twice - which is OK except I don't think that was what was intended. Also, both have mountpoints of "none" instead of "swap"

                    As far as UUID's if you're having trouble with them, why use them? They're not required and really aren't of much use in a single drive system.

                    My best guess is you want /dev/sda3 to be swap, but crypttab isn't pointing to it.

                    I would just start over from scratch. Wipe /dev/sda3, re-create encrypted swap, fix you crypttab, and mount it.

                    @oshunluvr

                    Thanks

                    You are not alone in being confused. During the setup I elected to set up an encrypted /home and wrongly omitted to format the swap file so how I have come up with an entry for an encypted swap partition defeats me - I've never seen that before and wouldn't even know how to set one up.

                    Does swap need to be encrypted? If so, can you tell me how to go about setting it up please as the only option within the kde partition manager is linuxswap? If I just set it up in fstab in the old fashioned way as /sda3 with the generic options and with parted magic as generic swap am I likely to get any problems?

                    Thanks for your help on this folks - it really has me stumped

                    Comment


                      #11
                      Re: Activate Swap File after installation

                      swap only needs to be encrypted if you desire it. What level of security do you desire?

                      If you don't need it to be encrypted, open a terminal and;

                      sudo -i
                      swapoff -a
                      mkswap /dev/sda3
                      swapon -a
                      swapon -s
                      exit


                      The final command above should return /dev/sda3 as mounted swap.
                      Then edit fstab to show the new swap. Editing fstab will ensure swap is reloaded when you reboot.

                      /dev/sda3 none swap defaults 0 0

                      I commented earlier about using "swap" instead of "none" as file system type. Apparently either works.

                      If you want an encrypted swap, there's a few more steps. Let me know...

                      Please Read Me

                      Comment


                        #12
                        Re: Activate Swap File after installation

                        Thanks

                        Just before I got your message I reformatted the partition as swap with parted magic.

                        On booting into kubuntu I now find that setting has stuck, so that is progress.

                        On running the commands I got:

                        Code:
                        ian@ian-MXC051:~$ sudo -i
                        [sudo] password for ian: 
                        root@ian-MXC051:~# swapoff -a
                        root@ian-MXC051:~# mkswap /dev/sda3
                        /dev/sda3: Device or resource busy
                        root@ian-MXC051:~# swapon -a
                        swapon: cannot find the device for UUID=5f2ca019-d440-4852-a79a-8077f85f2b7d
                        root@ian-MXC051:~# swapon -s
                        Filename                Type      Size  Used  Priority
                        I then ran again sudo blkid and got

                        Code:
                        root@ian-MXC051:~# sudo blkid
                        /dev/sda1: UUID="52644df4-8a37-4190-bdc8-50d507b5de50" TYPE="ext4" 
                        /dev/sda2: UUID="5770932f-09cd-4b4a-80ee-1e69fbe3a5bd" TYPE="ext4" 
                        /dev/sda3: UUID="bf0579ed-5818-47ed-9594-d53dc0176ac2" TYPE="swap"           
                        /dev/mapper/cryptswap1: UUID="c477ccf4-1d40-4ac8-950e-39c54821f7a2" TYPE="swap"     
                        root@ian-MXC051:~#
                        I am now getting incredibly confused.

                        The entry for swap in /etc fstab looks like this:

                        Code:
                        UUID=5f2ca019-d440-4852-a79a-8077f85f2b7d none	swap  sw	0	0
                        #/dev/mapper/cryptswap1 none swap sw 0 0
                        It appears that formatting the partition has given it 2 new UUIDs. Is it simply a case of overwriting the UUID and type references in fstab with those shown by sudo blkid or is it more complex?

                        Thanks for your continuing help.

                        Comment


                          #13
                          Re: Activate Swap File after installation

                          hear I found this
                          Also, it is strongly recommended that you encrypt your swap space. Users installing from Ubuntu 9.10 and selecting the Encrypted Home option will automatically have encrypted swap space. Other users can run sudo ecryptfs-setup-swap. This is critically important, because your home directory data will appear as cleartext in memory, as the kernel reads your encrypted data. If the kernel swaps this data to disk, it could potentially leak your decrypted data back to disk, totally defeating your Encrypted Home. Encrypted Swap solves this problem. However:

                          Hibernation will not work. Actually, hibernation will work just fine. But you can't resume. There are ways around this, but it involves choosing a password to use for your swap encryption, and entering that password every time you boot your system, and sharing that password with anyone else that might want to resume the system.
                          This is a known, wishlist issue that we hope to solve for Ubuntu 10.04.
                          You may be able to avoid these problems by running without a swapfile.
                          frome this page

                          https://help.ubuntu.com/community/EncryptedHome

                          that seems to state that if you did encrypt /home then so was your swap.

                          VINNY
                          i7 4core HT 8MB L3 2.9GHz
                          16GB RAM
                          Nvidia GTX 860M 4GB RAM 1152 cuda cores

                          Comment


                            #14
                            Re: Activate Swap File after installation

                            So what appears to have happened is that because I chose to encrypt /home but didn't format swap I have an fstab that points to a none-existant encrypted swap file.

                            I have now put the blkid entries into the fstab file and still nothing after reboot - except now all hibernate options appear to have disappeared.

                            I sometimes hibernate the machine but because it has a firewire port I use it to edit and transcode my camcorder footage so I really need a working swapfile. It really seems that the line of least resistance is to reinstall here. However, it appears that hibernation will be a problem. I'll have to weigh up the lesser of 2 evils, given that my HDD is password protected.

                            Comment


                              #15
                              Re: Activate Swap File after installation

                              Sorry, I should have told you to remove the old fstab entries first.

                              Rather than encrypting swap, you might consider wiping it at log-off. Also, is this a laptop? if not then the hibernation issue really isn't one.

                              Another option is to use a swapfile rather than a swap partition.

                              Please Read Me

                              Comment

                              Working...
                              X