Centos 6.9 - Swap space question

Soldato
Joined
18 May 2010
Posts
22,371
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:
Soldato
Joined
21 Jun 2004
Posts
2,789
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
 
Soldato
Joined
10 Oct 2005
Posts
8,706
Location
Nottingham
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?/boot on sda1

(The answer I'm guessing is using LVM)

Can you use an LVM portion as swap

Seems yes.

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.
 
Back
Top Bottom