LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to create 5 primary partitinos (more than 4 as a matter of fact ) (https://www.linuxquestions.org/questions/slackware-14/how-to-create-5-primary-partitinos-more-than-4-as-a-matter-of-fact-943651/)

vectrum 05-07-2012 05:57 AM

How to create 5 primary partitinos (more than 4 as a matter of fact )
 
How to create more than four primary partitions in order to create the following file systems in their own respective partitions; /, /boot, /usr, /var, /tmp, /tmp and /opt and /home.

Does LVM allow it? Or is it only possible in non-pc
system?

Thanks..

wildwizard 05-07-2012 06:00 AM

Can't be done

This is why the extended partition and logical partitions exist.

vectrum 05-07-2012 06:10 AM

Thanks.

I know that but want to know how did they install unix in
the system where every file system had got its own partition.

syg00 05-07-2012 06:12 AM

Quote:

Originally Posted by wildwizard (Post 4672263)
Can't be done

Wanna bet ?. That is just a convention. Other scenarios are possible, but require other tools than normally used. Look up gpt for instance.
Quote:

This is why the extended partition and logical partitions exist.
This is indeed true for what have been come to be known as "MBR partitions". Just about everyone has historically used this structure.

wildwizard 05-07-2012 06:16 AM

Quote:

Originally Posted by vectrum (Post 4672275)
Thanks.

I know that but want to know how did they install unix in
the system where every file system had got its own partition.

http://uw714doc.sco.com/en/man/html.7/vtoc.7.html

Now did you really want the answer?

the_gripmaster 05-07-2012 06:24 AM

Quote:

Originally Posted by vectrum (Post 4672260)
How to create more than four primary partitions in order to create the following file systems in their own respective partitions; /, /boot, /usr, /var, /tmp, /tmp and /opt and /home.

Does LVM allow it? Or is it only possible in non-pc
system?

Thanks..

It is definitely possible to create more than 4 primary partitions. Just use GPT instead of msdos partition table. However, what you are trying to do can be done with just 2 primary partitions.

1st primary partition of ext3/4: /boot
(512MB should be good enough for /boot)
2nd primary partition of LVM: this will hold the other partitions separately

First create 2 primary partitions using fdisk or parted. Then

Code:

mkfs.ext4 /dev/sda1
For the LVM:

Code:

pvcreate /dev/sda2
vgcreate vgmain  /dev/sda2
lvcreate -L 4G -n lvroot vgmain && mkfs.ext4 /dev/vgmain/lvroot
lvcreate -L 10G -n lvusr vgmain && mkfs.ext4 /dev/vgmain/lvusr
lvcreate -L 8G -n lvvar vgmain && mkfs.ext4 /dev/vgmain/lvvar
lvcreate -L 4G -n lvtmp vgmain && mkfs.ext4 /dev/vgmain/lvtmp
lvcreate -L 4G -n lvopt vgmain && mkfs.ext4 /dev/vgmain/lvopt
lvcreate -L 10G -n lvhome vgmain && mkfs.ext4 /dev/vgmain/lvhome

The /boot is better placed outside the LVM. After creating the partitions you need to make the appropriate entries in the /etc/fstab of course.

Ilgar 05-07-2012 06:36 AM

LVM is possible, but "logical partitions" can also be used for what vectrum wants. You don't need a partition to be a primary one to use a different filesystem on it.

tronayne 05-07-2012 07:39 AM

You can fiddle around and make more than four primaries but... why? Three primaries and some number of logical partitions accomplishes what you want to do without the need to fiddle and twiddle when you get around to updating or reinstalling or whatever may come up. Maybe the only thing you have to worry about is how much the drive heads are flying around to read or write although that's more or less moot nowadays.

I use nine partitions: /root, /swap, /home /usr/local, /opt, /var/lib/mysql, /var/lib/virtual, /spares and /var/lib/psql. I do it so that I do not have to back off large-scale data bases (in /var/lib/mysql and /var/lib/psql), virtual machines (in /var/lib/virtual -- do not want to have to reinstall Windows!), additional applications (/opt), additional utilities, all my user's stuff (/home) and other software (/usr/local) when I upgrade to a new release of Slackware (all you do is not format the partitions you want to "save" when assigning the partition names to fstab during installation -- gives me a "clean" install rather than going through all the trouble of upgrading). I've never needed a /boot partition for anything I know of (it's in /root, why fiddle?), I don't do /usr because that's were all the system libraries live and, well, that works for me.

You can, of course, add additional drives (just make sure they get mounted at the right time so the the thing'll boot, eh?). I have kept the data bases on separate drives but anymore I just let 'em live in their own logical partitions and life (so far) is good. Everything works if you let it.

Hope this helps some.

vectrum 05-07-2012 02:35 PM

Thank you very much for the suggestions. One thing I should have mentioned that when I referred to a primary
partition, I actually wanted to mean physical partition
because if I was able to set up aforementioned file systems in separate physical partitions then, in case of any particular file system damage, other file systems wouldn't be affected as this is not the case in logical partitions where a corrupt logical partition will destroy other logical partitions.

wildwizard told me 'Now did you really want the answer?'
Yes, Your link has reminded me of setting up solaris and freebsd sys(many slices inside a partition). Thanks for providing the empirical knowledge.

LVM solution is really nice. Master's solution without any gripe. :) Thanks.

tronayne: Here is my scenario. Why I have had to fiddle with boot partition. I have got two hdds, sda and sdb. I installed win, solaris and linux 100mb boot partitions in three primary partitions in sda(sda1, sda2, and sd3) and installed freebsd, slack and linux swap in three primary partitions, sdb1, sdb2 and sdb3. My boot manager is lilo (I could have used soalaris' grub)and it couldn't boot if I place boot in sdb so I have had to keep /boot in sda.

I don't know whether that was possible to make solaris, freebsd boot from logical partitions. My entire partition scheme was faulty I suppose but I can't make it from scratch due to the admin level hitch.

You have created nine partitions!
How did you do it?
Are all these primary partitions?
Are all in a single hdd?
Thanks again.

TobiSGD 05-07-2012 02:52 PM

Quote:

Originally Posted by vectrum (Post 4672696)
Thank you very much for the suggestions. One thing I should have mentioned that when I referred to a primary
partition, I actually wanted to mean physical partition
because if I was able to set up aforementioned file systems in separate physical partitions then, in case of any particular file system damage, other file systems wouldn't be affected as this is not the case in logical partitions where a corrupt logical partition will destroy other logical partitions.

Where did you get that from? Logical partitions are physical partitions, they are just organized differently.

To clarify that: Due to limitations of the old MS-DOS style partition table you can not create more than 4 primary partitions when using this style (when using GPT instead you can create many more). One of these primary partitions can be an extended partition. Extended partitions are nothing more than a way to overcome the partition tables limitation with creating a container for more physical partitions, called logical partitions. There are only two things that are different for a logical partition compared to a primary partition:
1. They have to be in an extended partition.
2. There data (read: start-sector, end-sector, ID, ..) is not stored in the partition table in the MBR.

Nonetheless, they are physical partition, a corrupted logical partition has the same chance of corrupting other partitions as a primary partition.

vectrum 05-07-2012 03:32 PM

Thank you. I need a time out as I discard the concept about logical partition. It might be possible that I came to know from a dos community when I learnt to install dos. I hadn't got any chance to install *nix.

Can I boot linux from a logical partition?

TobiSGD 05-07-2012 03:35 PM

Without any problem.

tronayne 05-08-2012 07:04 AM

Quote:

You have created nine partitions!
How did you do it?
With cfdisk, see below.
Quote:

Are all these primary partitions?
No. See below.
Quote:

Are all in a single hdd?
Yes.

Well, I don't have multiple Linux distributions, just Slackware (hmm. "just?" Well, go with the best, methinks). I do have two virtual machines, XP and Win7, and those are in the partition mounted to /var/lib/virtual. Right now, in this box, there is only one drive -- the other box has two (both 500G).

There are only three primary partitions -- as explained above by TobiSGD, you can only have four primaries (and no logical) or three primaries plus X number of logical.

I use the cfdisk utility to set up disk drives (it uses ncurses to display all the drive information and permit easy editing). cfdisk is on the Slackware installation CD-ROM/DVD and you use it to partition your drive before you execute setup to install Slackware.

The display looks like this:
Code:

                            cfdisk (util-linux 2.19)

                              Disk Drive: /dev/sda
                      Size: 500107862016 bytes, 500.1 GB
            Heads: 255  Sectors per Track: 63  Cylinders: 60801

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    sda1                    Primary  ext4                            15998.17
    sda2                    Primary  swap                            15998.17
    sda3                    Primary  ext4                            20003.89
    sda5                    Logical  ext4                            20003.89
    sda6                    Logical  ext4                            20003.89
    sda7                    Logical  ext4                            20003.89
    sda8                    Logical  ext4                            100002.96
    sda9                    Logical  ext4                            100002.96
    sda10                  Logical  ext4                            188087.48




    [ Bootable ]  [  Delete  ]  [  Help  ]  [ Maximize ]  [  Print  ]
    [  Quit  ]  [  Type  ]  [  Units  ]  [  Write  ]

                  Quit program without writing partition table

Of course you can, logged in as root or su - or sudo, look at your drive(s) with cfdisk on a running system -- you don't want to fiddle around and try to edit a drive on a running system (except a new one you're formatting and partitioning), but you can look at any drive with
Code:

su -
cfdisk /dev/sda

cfsisk (and fdisk) are standard utilities installed in /usr/sbin; they're not to be used by any but root. When you've partitioned a drive using either of them, you need to add entries in /etc/fstab for it (which is done during Slackware installation because you partition fist, then run setup and you're asked for the partition information).

The primary-logical thing is a hangover from olden days and Miserydos, partition tables and MBRs and who knows what all. Keep in mind that your partitions, whether they're called primary or logical start and end at specific addresses on the drive and have a specific size. You don't really care what the addresses are (that's taken care of by the controller and system software) and utilities such as df and du will tell you how much storage space you've got available and how much you've used. And when you run out of space in a given partition, well, then you'll find out that it really is physical space and holy toot, what do I do now.

Hope this helps some.

saulgoode 05-08-2012 09:04 AM

If you use either EFI or UEFI instead of BIOS then you are not limited to just four primary partitions. The upper limit is not a fixed number, but is typically more than 128 partitions.

dfwrider 05-08-2012 10:51 AM

There are reasons to have separated file system areas. Some of those reasons go away, when we're talking about a system without multiple physical drives, and without NFS mounts.


All times are GMT -5. The time now is 07:42 AM.