LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Partition puzzle (https://www.linuxquestions.org/questions/linux-general-1/partition-puzzle-174765/)

davoman 04-26-2004 01:29 PM

Partition puzzle
 
Okay heres one for ya: :confused:
(bare in mind this all stems from me not understanding how to make a swap -file-)

Code:

Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/hda3              3781448  3245688    340572  91% /
/dev/hda5              6144828  1762652  4382176  29% /mnt/ntfs
/dev/hda2              5403332  2457376  2945956  46% /fatso
/dev/hda4              4522380    424064  3868588  10% /home

There you see 4 primary partitions. /dev/hda4 is my home files partition with a few gigs free.

Presently I have no swap partition, and its teh sux. How can I claim some of the space of the /dev/hda4 partition and use it for a swap partition? (files are tar'd up on my FAT partition)

Removing /dev/hda4 and creating a smaller partition results in the remaining space being classed 'unusable'.

I understand one can have only 4 primary partitions. Help, help, and help again. :cry:
*NB How can I have these 10 million programs without a swap device set?:scratch:
:newbie:

TigerOC 04-26-2004 02:43 PM

Create a new directory on /fatso ?backup and then do cp -a /home /fatso/?backup. Then unmount and cfdisk /dev/hda4 create another /home partition and a swap partition from /dev/hda4 then format the new partition for home. Mount /dev/hda4 as /mnt and do cp -a /fatso/?backup /mnt. Edit your fstab to reflect the new swap partition and reboot.

davoman 04-26-2004 03:14 PM

Sweet thanks for your help but....

Thats what I origionally tried. I backed up my home documents onto my FAT partition.

And when I deleted the hda4 partition in an attempted to create 2 smaller ones, I was only allowed to make 1, with the rest of the space marked 'unusable'.

Perhaps an 'extended' partion with 'logical drives'? Or is that only relevant for MSDOS?

Or what about making a swap file. How does one accomplish that?

Boow 04-26-2004 04:42 PM

make a logical partition then make a swap partition in it.

WhatsHisName 04-26-2004 05:05 PM

Yes, you can set up the swap and ext3 partitions as logical partitions within an extended partition to keep the primary partition count down. I do this routinely with PartitionMagic, but I am sure there are linux routines that can do it for you (parted?), too.

Two points to remember:

(1) The linux ext3 partition will not boot when you convert it to a logical partition. The boot loader will be pointing to the old partition number, not the new one. You will need to update the boot loader to point to the right partition. If you use GRUB, make a GRUB command line boot disk beforehand, so that you can boot to GRUB command line and fix the problem. This problem is really easy to fix using the GRUB boot disk.

(2) If anyone is thinking about converting their preexisting swap and ext3 partitions to logical partitions, remember that you need to modify the /etc/fstab entry for the swap partition to point to the new partition number.

michaelk 04-26-2004 06:29 PM

Re: Partition puzzle
 
Quote:

Originally posted by davoman


Code:

Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/hda3              3781448  3245688    340572  91% /
/dev/hda5              6144828  1762652  4382176  29% /mnt/ntfs
/dev/hda2              5403332  2457376  2945956  46% /fatso
/dev/hda4              4522380    424064  3868588  10% /home

There you see 4 primary partitions. /dev/hda4 is my home files partition with a few gigs free.

Removing /dev/hda4 and creating a smaller partition results in the remaining space being classed 'unusable'.

I understand one can have only 4 primary partitions. Help, help, and help again. :cry:
*NB How can I have these 10 million programs without a swap device set?:scratch:
:newbie:

Any partition ID >=5 has to be a logical partition. Therefore, /dev/hda1 is your extended whcih is considered a primary and contains /dev/hda5. To see how the entire disk is formatted log in as root:
fdisk -l (thats a small L)

You are correct that you can only have 4 primaries and that resizing one will only leave you will space you can not use. To create additional partition you will need to resize the extended partition and then create another logical drive for swap.

Are you sure you do not have a swap partition? Take a look at the /etc/fstab file. swap partitions are not mounted like / and /home and not get displayed with the df command. Also look at the output of the free command. If total swap is greater then zero then you do indeed have swap space. And if you do have swap how much is being used.

If you do not have a swap partition you can create a swap file. If this speeds things up then you might want to consider resizing paritions etc. If not then you might want to look elsewhere.

http://www.justlinux.com/nhf/Filesys..._Swapping.html

If you think your PC is running slow how much RAM do you have. What desktop are you running i.e. KDE etc. What speed is your PC etc...

driftingremains 04-26-2004 07:22 PM

Linux is very tricky with partitions, I usually used partition magic for situations like that.

davoman 04-26-2004 08:35 PM

Okay guys thanks for your help. You guys are teh ruelz.
I will download this 'parted' tool.

I will try this:

*Remove the hda4 partition.
*Create an extended partition with and 2 logical paritions inside it.

I haven't been able to do it with cfdisk so I'll reply again with my results.


All times are GMT -5. The time now is 04:18 PM.