1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Centos 6.9 - Swap space question

Discussion in 'Linux & Open Source' started by opethdisciple, Feb 17, 2018.

  1. opethdisciple

    Capodecina

    Joined: May 18, 2010

    Posts: 16,963

    Location: London

    I am playing round with swap space and just created a new machine and purposely left 700Mb free on the hard drive.

    After the machine starts I cannot find anyway to 'see' this free 700Mb on the disk.

    df doesn't show it, fdisk doesn't show it.

    How do I partition this 'phantom' 700Mb as swap?

    ---

    (Only playing on a test system)

    Also... fdisk. Never got my head round it.

    I have two partitions sda1 and sda2. sda1 was boot and sda2 was lvm.

    So I deleted sda2 and repartitioned it.

    Saved the changes, rebooted and then the system failed to boot. :confused:

    How on earth do you repartition a system which is live?

    (The answer I'm guessing is using LVM)

    Can you use an LVM portion as swap?

    Seems yes.
     
    Last edited: Feb 17, 2018
  2. celliott

    Mobster

    Joined: Jun 21, 2004

    Posts: 2,771

    Location: Berkshire

    You don't have to use LVM but its a good idea and makes things easier later on, just remember /boot needs to be on a regular partition.

    /boot only contains your bootloader and the kernel. It sounds like the bulk of the OS may have been on a logical volume which you deleted, hence it couldn't boot.

    If there really is space free you should be able to create a new partition with either fdisk or parted, they are easy when you are used to them. Perhaps you could paste the output of fdisk -l /dev/sda so we can advise
     
  3. stopper

    Wise Guy

    Joined: Sep 17, 2010

    Posts: 1,762

    With 16gb of ram (in your sig) you shouldn't need a swap partition anyway. I never bother with it.
     
  4. memyselfandi

    Sgarrista

    Joined: Oct 10, 2005

    Posts: 8,192

    Location: Nottingham

    I would expect the system to fail to boot if you deleted the LVM partition on sda2 as you probably deleted everything except /boot on sda1. I know on our standard build at work we use sda1 and 2 in this way with swap in a logical volume (I would still define swap no matter how much memory you have ... Red Hat do have some documented rules on it which would be relevant to CentOS as well). Make sure that sda1 is not to small ... that can cause all sorts of problems.

    Using LVM means you can grow the logical volume, or add more, easily as needed.

    If you meant you left space in addition to sda1 and 2 then it would have been there but you would have to look carefully in fdisk as it wont just show it as "free space" in a list.