[solved] Create linux swap partition

Forum Forums New users New Users and General Questions [solved] Create linux swap partition

  • This topic has 8 replies, 7 voices, and was last updated Nov 30-12:31 am by seaken64.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #46073
    Member
    Askic

      Hello,

      recently I have installed antix in dual boot with windows XP on my old Ideapad S10e notebook. The existing HDD already had two partitions: NTFS for win XP and FAT32 for recovery.
      Wehn installing antiX, I didn’t want to destroy existing system, so I used Gparted tool to create two additional paritions, for root and /home. I also left 2 GB unallocated space for linux swap.
      I have installed antiX successfully and it works in dual boot with win XP without problems.

      However, when I tried later to format unallocated space as linux swap using Gparted tool, I got error message that max 4 primary partitions can exists.
      Does it mean there is no possibility to add linux swap partition?
      Currently there are four partitions, 2 for win Xp and 2 for antiX. Please have a look at the attached picture.
      Since I don’t have linux swap partition, is it going to affect the performance of antix?

      • This topic was modified 2 years, 5 months ago by christophe. Reason: op stated solved
      Attachments:
      #46075
      Member
      Xecure
        Helpful
        Up
        0
        ::

        That is the limitation of using the old msdos partition table. Maximum 4 primary partitions. “New” GPT partition tables are more flexible.
        On these old partition tables, what people usually do is have 3 primary partitions and one extended partitions to create logical partitions inside (overcoming the partition limit).
        But as you are only missing a swap partition, you could use a swap file instead of re-partitioning. It should work almost the same.

        You have made your root partition too small to host it, so you could host it inside the home partition. Add the missing 2Gbs to the home partition and create a 2GB swap file inside (Though I would add it to the root partition, but I don’t know if you can increase partitions “from the left” in msdos partition tables).

        Based on this tutorial: https://www.howtogeek.com/455981/how-to-create-a-swap-file-on-linux/
        for 2 GB partiton inside the /home partition, it would be something like:
        sudo dd if=/dev/zero of=/home/swapfile bs=1024 count=2097152
        and then follow the rest of the tutorial.

        Does anyone else have a better suggestion?

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #46077
        Member
        fatmac
          Helpful
          Up
          0
          ::

          1.6GHz with 1GB ram will be pretty slow, but usable.

          With standard partitioning, you are allowed 4 primary partitions only, but one of those can be an ‘extended’ partition that will let you add a further 14 partitions, (if my memory is right), so your best bet is to re install using an extended partition. You could add a swap file, but it would work a lot slower & take up some of your disk space. I recommend re installing.

          Linux (& BSD) since 1999

          #46086
          Member
          Askic
            Helpful
            Up
            0
            ::

            Hello and thank you for the replies. Unfortunately, when installing antix in the first place, I didn’t pay attention that drive is initialized as MBR (there was already win XP installed). So I created and mounted two additional partitions /root and /home. Later, I have read that if swap is missing and RAM is fully occupied, the computer can halt, and I want to avoid that.

            I have upgraded my S10e notebook and it has 2 GB of RAM, conky showed that max RAM usage was about 600 MB so far, so maybe I’m good. Reinstalling antiX won’t be that much of a problem, but I’d rather avoid that if not necessary. I’m just curious, what could happen if I leave things as they are. So far (and I’m using antiX only two days, I didn’t experienced any problems with the system).

            What about to use antiX live CD and use GParted tool to delete /home partition and recreate it as extended? Then I could create a new logical partition of 2 GB for swap. Since /home would be destroyed, antiX reinstall is necessary?

            #46091
            Moderator
            BobC
              Helpful
              Up
              0
              ::

              I have tried creating a swap partition later and it affects other things. The easy solution is to bite the bullet, save your data and reinstall. antiX is a quick install anyway. Consider not making a separate /home partition. Trying to use /home shared between distros can make a mess. With only 2 gb, you should have swap. After saving your data you could test without swap by opening browser sessions until you run out of memory and see how resilient it is.

              #46092
              Forum Admin
              Dave
                Helpful
                Up
                0
                ::

                What about to use antiX live CD and use GParted tool to delete /home partition and recreate it as extended? Then I could create a new logical partition of 2 GB for swap. Since /home would be destroyed, antiX reinstall is necessary?

                That is a valid option.

                You would then need to make a directory with your username in the new /home, copy the contents of /etc/skel/ to /home/username/, then change ownership of the new /home/username/ and contents to your username. You may be better to do the copying on your installed system after making the new /home partition.

                As root

                mkdir /home/my-username/
                cp /etc/skel/* /home/my-username/
                chown -R my-username:my-username /home/my-username
                

                Have you tried shrinking the windows partition more?
                It seems like you are not using much space in that partition.

                Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

                #46098
                Member
                Askic
                  Helpful
                  Up
                  0
                  ::

                  Ok guys, here is the update.
                  In order to avoid reinstall, I have decided to create a swap file. I have resized and increased /root partition with usef of GParted from live CD and yes, it is possible to use unallocated space “from the left”. After that, system booted without any problems. Then I have followed the rest of the tutorial. Everything went seemingly OK.
                  The command $ swapon –show produces the following output:
                  NAME TYPE SIZE USED PRIO
                  /swapfile file 2G 0B -1

                  However, I noticed red line during system boot that swapfile is not activated. I’ll need to investigate that further.
                  in /etc/fstab I have added the line:
                  /swapfile none swap sw 0 0

                  but I’m not sure whether to use tabs or spaces.

                  EDIT:

                  I have moved the line: /swapfile none swap sw 0 0 immediately after / in the fstab file (just like shown in the attached picture), after after new reboot I have a clean boot log file.

                  So, this can be considered solved.

                  • This reply was modified 2 years, 5 months ago by Askic.
                  Attachments:
                  #46101
                  Moderator
                  Brian Masinick
                    Helpful
                    Up
                    0
                    ::

                    I have tried creating a swap partition later and it affects other things. The easy solution is to bite the bullet, save your data and reinstall. antiX is a quick install anyway. Consider not making a separate /home partition. Trying to use /home shared between distros can make a mess. With only 2 gb, you should have swap. After saving your data you could test without swap by opening browser sessions until you run out of memory and see how resilient it is.

                    I always create a decent sized swap partition. I multi-boot, and I am able to use and reuse the same swap partition for many different distributions because only one of them is active at a time.

                    I don’t create a separate /home partition. Instead I copy any files that I constantly use and I simply mount my other distro partitions any time I want to either copy or use a file that is saved in another partition.

                    This works well and it’s pretty easy to access other partitions on the same disk.

                    --
                    Brian Masinick

                    #46146
                    Member
                    seaken64
                      Helpful
                      Up
                      0
                      ::

                      I would re-install. A proper swap partition will be better in the long run. Start XP and use the Disk Manager to shrink your XP partition more. You’ve got enough room for 60GB or more for Linux. Then reboot XP and let XP reset the drive size with scandisk. After verifying XP is working, delete everything other than the XP partition. Next, create an EXTENDED partition for the entire drive space after XP. Next create a Linux Swap partition as a Logical Partition and place it at the extreme right end of the space. Next create your root (/) and /home partitions. (Or keep /home with root (/) and create a FAT32 partition for file sharing). After quitting Gparted restart XP and let scandisk do it’s thing. Now start the LiveUSB antiX installer and choose your / and /home locations, then your swap location. When asked to run grub put it on MBR on the first partion. XP will be added to your grub bootoader.

                      I do this all the time. It is better to work out your install routine than to kludge it together after making a non-ideal choice. Use EXTENDED and LOGICAL partitions with MBR. And make sure to let XP run scandisk as I described. XP will be happy if you set your disk as I described. Good luck! And welcome to antiX.

                      Seaken64

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.