LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   make a swap partition (https://www.linuxquestions.org/questions/linux-hardware-18/make-a-swap-partition-904961/)

Pedroski 09-25-2011 06:08 PM

make a swap partition
 
I had trouble installing Ubuntu, because I had no swap.

I had sda1 Windows 32GB, sda2 boot 500MB then a lvg with Fedora 15 about 280GB. Fedora didn't ask for a swap, but Ubuntu said the installation will probably fail if there is no swap.

gparted would not touch the lvg, said it couldn't.

How could I have shrunk the lvg and created 2 roughly 140GB partitions and a 2GB swap?

In the end I used the Win install dvd, rewrote everything, which meant of course reinstalling everything!

T3RM1NVT0R 09-25-2011 07:13 PM

@ Reply
 
Hi there,

As you said that you already re-installed everything I can only point out the things that could try next time if it happens:

1. Every linux OS create swap partition. Not sure, when you say Fedora didn't create one.
2. The reason that I can think of why you were not able to shring that lvg because / file system was part of it.
3. You could have tried removing only Linux related partition and created swap partition manually for Ubuntu to use. Ofcourse this would have taken your Fedora install but would have saved Windows install.

syg00 09-25-2011 07:40 PM

LVMs basic premise was that it'd be really nifty if you could expand filesystems by adding new partition(s) easily. Worked fine till people wanted to remove space - especially remove it from LVM altogether like you do. Slight oversight that took too long to fix.
tldp.org has a good LVM howto - go have a read of that.
Fedora would have created a root and a swap logical volume in that vg. Getting Ubuntu installer to recognise that would be an effort.
From the (install) Fedora disk in rescue mode, you'd need to have reduced the size of the root filesystem, reduced the lv, reduced the vg, then the pv. ta-da, lots of unpartitioned space.
Personally I would have moved the swap outside the pv at that point, and then both could use it. As would the Ubuntu installer.

Fedora will happily install without LVM - I'm not a fan in case you didn't guess.

Pedroski 09-25-2011 08:32 PM

I've done a few installs lately, 'cos of problems, and I haven't been presented with the choice of not using lvm. Fedora wants to set up a boot = 500MB and then merrily goes and lvms. Could I tell it not to? I didn't notice that.

syg00 09-25-2011 09:58 PM

I find defaults rarely do what I need - see this. Custom layout lets you set up your own partitions.

Pedroski 09-26-2011 04:39 AM

Yeah, well custom ain't so bright either: I had sda1 32GB Win, sda2 100MB ntfs and free space 139000MB, then a lil swap and sda3 140GB I ran ubuntu onto sda3. It promptly made an lvg and created sda5 and sda 6 (1.6GB swap). Then I put in Fed 15 dvd, say please use free space. It can't, it just says 'not enough free space on disk' even when I tell it to create a lvg it keeps repeating no free space, although there is 139GB free.

I restarted Ubuntu, ran gparted, had to delete my lil swap 2GB then I could create another partition, sda4 I think, I can't remember now 4 I think. Now Fedora is installing on sda4

So swap counts as a partition and you can't have more than 4

syg00 09-26-2011 04:51 AM

Yes swap counts as a partition, but no, 4 ain't the limit.

A little more effort required - by you.

qlue 09-26-2011 09:14 AM

Quote:

Originally Posted by Pedroski (Post 4482399)
you can't have more than 4

You're limited to four primary partitions. An extended partition can have any number of logical partitions

Pedroski 09-26-2011 07:08 PM

That doesn't make sense: I had 130+GB unused space, I tell it to make a lvg, it says there is no space left, ergo, I can't have any number of extended partitions.

Or should I have changed swap to an lvm, then it might have been able to extend into the unused space??

qlue 09-26-2011 07:49 PM

An lvg is made up from existing partitions as near as I can figure it. It is not a true partition but can only exist in the space provided by existing partitions. (someone please correct me if I'm wrong as I've never used lvg)
It's normal to see an hdd with three primary partitions and one extended partition. The extended partition can have many logical partitions and that is where the swap will often be.
(technically, a primary partition is also a logical partition)

qlue 09-26-2011 07:55 PM

Quote:

Originally Posted by Pedroski (Post 4483032)
That doesn't make sense: I had 130+GB unused space, I tell it to make a lvg, it says there is no space left, ergo, I can't have any number of extended partitions.

?

Since an extended partition counts as a primary partition, you could theoretically have more than one. But since an extended partition can house any number of logical partitions, there is no reason to have more than one. Just make your fourth partition fill the empty space and you can put as many logical partitions in it as you need.


All times are GMT -5. The time now is 03:57 PM.