LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2009, 03:07 PM   #1
mzsade
Member
 
Registered: Sep 2009
Distribution: Linux Mint 9, Linux Mint 17.2(xfce), LMDE2(Mate), Debian Jessie minimal (with standalone OBox)
Posts: 299

Rep: Reputation: 34
Smile [SOLVED]Change extended to primary and repartition and rename


Hi, I used to have Windows on /dev/sda1 which i deleted, and my Linux mint /(root) named /dev/sda5 as part of an extended partition, which i would like to change to a primary. I have moved it at the end (Screenshot) in the hope of creating extra partitions in the following order(I am quite pleasantly surprised to find that my system has remained unscathed in the process):
1) /swap>>>2GB
2) /boot>>>256MB
3) /usr >>>10GB
4) /opt >>> 5GB
5) /var >>>10GB
6) /home>>>remainder less the space occupied by / (root)
7) /(root)>>20.27

I have scoured innumerable links on optimal partitioning and from what little i grasped, this is the scheme, that i think, will provide for maximum speed, frequent installing and removing of apps., prevention of fragmentation (i know it doesn't matter much in Linux), and mainly, prepare for the installation of a new release every year or so. I am still not clear about several things, chiefly, 1) how do i create, mount and name these additional partitions in my existing system, 2) when i install a new release in my / partition, will it automatically install the swap, boot, etc in the existing places for the same, or will everything be included in the / partition, including /home, because i hope to use the old home to store my data.

You will have seen that am a little fuzzy even about what exactly it is that i want to do, and any guidance will be greatly appreciated, especially corrections to my half-baked scheme.
Attached Thumbnails
Click image for larger version

Name:	Screenshot.jpeg
Views:	18
Size:	110.1 KB
ID:	1505  

Last edited by mzsade; 09-25-2009 at 12:31 AM.
 
Old 09-15-2009, 03:59 PM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by mzsade View Post
Hi, I used to have Windows on /dev/sda1 which i deleted, and my Linux mint /(root) named /dev/sda5 as part of an extended partition, which i would like to change to a primary. I have moved it at the end (Screenshot) in the hope of creating extra partitions in the following order(I am quite pleasantly surprised to find that my system has remained unscathed in the process):
1) /swap>>>2GB
2) /boot>>>256MB
3) /usr >>>10GB
4) /opt >>> 5GB
5) /var >>>10GB
6) /home>>>remainder less the space occupied by / (root)
7) /(root)>>20.27
NOOOOO!!! Don't do this. There is a reason drives are as large, cheap and fast as they are, and there is a reason that modern filesystems automatically adjust themselves to the sizes of directories and files. By adopting this plan, you undermine the very reason for the existence of modern filesystems.

Please take the advice of someone who has been using Linux for 17 years and many Unices before that. Create at most three partitions:

/ (root filesystem) about 20 GB (changes over the years)

swap (twice the size of RAM)

/everything_else

The idea of "everything else" is that it can contain all your personal stuff, plus any large programs you decide to install apart from normal system programs, basically ... everything else.

Now -- when a new version of your Linux distribution comes out, you can install it on the "/" partition without disturbing the big archive located on "everything_else". You don't have to perform an upgrade, instead you can erase the root partition and install fresh because your data and programs are located out on the "everything_else" partition.

The scheme you describe above has another very bad side effect -- it won't boot. This is true because the /usr, /boot, /tmp and /var directories must be located on the root partition (for a complete boot). The reason for that is that the system needs access to files on these directories before it can mount the partitions listed in /etc/fstab.

Imagine your shock when you realize that the /boot partition cannot be mounted until the kernel is running, and the kernel cannot load until the /boot partition is mounted. I believe this is called "catch-22" or something.

Conclusion? Don't ... do ... this.
 
Old 09-15-2009, 08:21 PM   #3
mzsade
Member
 
Registered: Sep 2009
Distribution: Linux Mint 9, Linux Mint 17.2(xfce), LMDE2(Mate), Debian Jessie minimal (with standalone OBox)
Posts: 299

Original Poster
Rep: Reputation: 34
Thank you very much for the warning. So should that everything else be /home, and if not, how do i create it during installation, and what would be it's mount point?
Also, how do i reclaim my empty space and change my existing mess into a pristine installation, where there are no extended partitions, and partitions are named and located in the correct order, i.e. as dev/sda1, dev/sda2 and so on...?

I should add here that i do not intend to dual boot or anything of that sort again, so i do not need to include additional provisions for that.

Last edited by mzsade; 09-15-2009 at 08:29 PM.
 
Old 09-15-2009, 09:13 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
There is no reason why /boot can not be on a separate partition. In fact Redhat's default installation created 3 partitions (/boot, / and swap) since version 7 if I can remember that far back. The latest versions of Fedora default installation require a separate /boot partition since it automatically creates an LVM for / and swap which you can not boot from.

I see no reason why you can not create the desired scheme but I typically suggest keeping things simple like /boot ,/, /home, swap and maybe a data partition. Also the 2x rule of thumb for swap is outdated. It really depends on what you do with the PC and what apps you run.

You can not create more then 4 partitions without an extended partition with a legacy MBR DOS drive. So what is your current partition layout?
 
Old 09-15-2009, 09:18 PM   #5
tidww01
LQ Newbie
 
Registered: Dec 2005
Posts: 19

Rep: Reputation: 0
There are times...

There are times when a setup as you described can and maybe should be used. But not on your machine and not into different partitions. If you are concerned about a single filesystem filling up uncontrollably then you might want to look at Logical Volume Manager. With it, only the filesystem will fill up and not the system won't crash. The app probably will, but not Linux. It's also useful if you need a filesystem that is larger than a single disk drive. But the comments noted are correct, you only want to use lvm on large systems.
 
Old 09-15-2009, 10:02 PM   #6
mzsade
Member
 
Registered: Sep 2009
Distribution: Linux Mint 9, Linux Mint 17.2(xfce), LMDE2(Mate), Debian Jessie minimal (with standalone OBox)
Posts: 299

Original Poster
Rep: Reputation: 34
Thanks for all the feedback--i am sorry if i exasperate you, but i am now even more unsure of what i need to do. And what about my existing system, how do i modify/refine it and reclaim the unallocated space?
 
Old 09-16-2009, 01:56 AM   #7
mzsade
Member
 
Registered: Sep 2009
Distribution: Linux Mint 9, Linux Mint 17.2(xfce), LMDE2(Mate), Debian Jessie minimal (with standalone OBox)
Posts: 299

Original Poster
Rep: Reputation: 34
Change extended partition to primary and rename in the correct order

Okay, the screenshot is what my partition table looks like. I went to partition editor, created a new ext3 partition in the unallocated space and labelled it data. When i went to Nautilus, i found it as 126GB media named data. Now this contained a locked 'lost & found' directory which i could not open. So i did a chmod u+x and created a sub-folder called "rest". However, when i tried to copy my files from my backup DVD into it i found that i lacked the permissions. So i tried a chmod u+x on it, this time it didn't work (why?) Next, i right-clicked it and opened it as root, changed permissions, and then pasted the contents of my backup DVD into it. So far so good, i have now reclaimed my unallocated space and am able to read/write into it. Any advice and corrections as to the procedure i followed up to this point would be most welcome.

Now the final hurdle: How do i convert the hash that i have made of my system into a well ordered and located partition scheme where my extended partition is changed to a primary partition and /dev/sda6 becomes /dev/sda1, /dev/sda7 becomes /dev/sda2, and my root install /dev/sda5 becomes /dev/sda3 and they are all contiguous as a whole?
Attached Thumbnails
Click image for larger version

Name:	Screenshot-1.jpeg
Views:	13
Size:	80.3 KB
ID:	1506  
 
Old 09-16-2009, 04:06 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by lutusp View Post
NOOOOO!!! Don't do this. There is a reason drives are as large, cheap and fast as they are, and there is a reason that modern filesystems automatically adjust themselves to the sizes of directories and files. By adopting this plan, you undermine the very reason for the existence of modern filesystems.
Your advice is a bit odd for someone that's that experienced with varied unix-like OSes. There's nothing wrong in doing some extra partitioning, the needs of each person are different, if there was a universal optimal-for-everyone scheme then it would always be the default.

Quote:
The scheme you describe above has another very bad side effect -- it won't boot. This is true because the /usr, /boot, /tmp and /var directories must be located on the root partition (for a complete boot). The reason for that is that the system needs access to files on these directories before it can mount the partitions listed in /etc/fstab.

Imagine your shock when you realize that the /boot partition cannot be mounted until the kernel is running, and the kernel cannot load until the /boot partition is mounted. I believe this is called "catch-22" or something.
I have no idea what your sources are, but really, having separate partitions for /usr, /var and /boot is not strange, is not uncommon, and is not a bad thing. In fact, it's very common in servers because it eases backups, it allows you to mount noexec partitions where nothing should be run, and it allows for a much fine grained control of the underlying fs's and other few things that can be very significative in scenarios where every bit of performance matters.

Whether it's going to add anything to the mzsade's experience is another thing, though. I am not going into partitioning schemes unless necessary, because there's already enough of that in the net. I'll just say that most of the space usually goes into /usr, so having a 20gb /usr and 20 / is usually not a good idea.

But having /boot or any other thing in another partition has nothing to do with you being able to boot. That's completely false and misinformed. The system doesn't need anything in these partitions before init(1) takes into scene, and by that time, the kernel is fully booted, the fs drivers loaded, and your disks fully accessible.

About the 2x<your_ram> rule, it's mostly outdated, unless you own a very old system or you are doing something really special. By the time you are swapping an amount equal to your ram to disk in a modern system you system will be completely unusable.




Now, to the topic. mzsade, what the reasoning is behind wanting to convert all the partitions to primary ones? What do you think is going to improve? Why not just have an extended partition with logical drives inside of it? For Linux it's all the same.

Toying with partitions simply because you don't like the cyphers that go on their name is silly, and it's always risky.

Last edited by i92guboj; 09-16-2009 at 04:09 AM. Reason: typo
 
Old 09-16-2009, 04:35 AM   #9
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by mzsade View Post
Thank you very much for the warning. So should that everything else be /home, and if not, how do i create it during installation, and what would be it's mount point?
Also, how do i reclaim my empty space and change my existing mess into a pristine installation, where there are no extended partitions, and partitions are named and located in the correct order, i.e. as dev/sda1, dev/sda2 and so on...?

I should add here that i do not intend to dual boot or anything of that sort again, so i do not need to include additional provisions for that.
Quote:
So should that everything else be /home,
No, actually, for simplicity and reliability the /home directory should be included in the root filesystem (this way, in the event of a partial drive failure, you can still log on). Then you make a bunch of symlinks between your home directory and resources out on the everything_else partition. This allows you to have a robust environment to boot into, but all sorts of ways to store big projects and data elsewhere.

So basically:

/ (filesystem root including /usr, /var, /home and many others, about 20 GB)

swap

/everything_else

This is based on the KISS principle (Keep It Simple, Stupid) and it takes into account that modern storage devices are quite reliable and fast.

Your original scheme, had it worked, would not have been any faster, and it would have been a logistical nightmare because there would always be partitions running out of space while other partitions had plenty of extra space. Also, in a simple scheme like this one, the operating system has to hunt through a lot of directories, while in your scheme, the OS has to hunt through a lot of partitions. So there isn't any net speed advantage.

In this scheme all the free storage space is available in a single large pool, rather than being split into a bunch of mutually inaccessible small chunks.

This scheme is an outgrowth of the very basic premise that programs and data should be stored separately. Programs, system files, the kernel, all that stuff you didn't create, is on the root partition. All your valuable data, your documents, things you did create, are on the /everything_else partition. And you can install a new, different Linux distribution by ERASING the root partition completely, whenever you want, without jeopardizing your data store.

Finally, a new filesystem is coming in right now -- etx4. It has a lot of advantages. But the root filesystem that includes /boot can't be ext4 just yet, only other partitions. The scheme outlined here allows you to take advantage of ext4 in the /everything_else data partition, while accepting that for now, we can't use ext4 for the root filesystem.

During Linux installation, just create a / (root) filesystem partition (about 20 GB), specify that it be formatted, do the same for a swap (twice the size of RAM), then create a single large partition with all remaining space. The first time you create the scheme, format /, swap and /everything_else, but during subsequent installations don't format /everything_else again -- just specify its mount point. That way, your data doesn't have to be reloaded onto the drive when you change distributions or versions (but back up anyway).

There are many occasions when a Linux distributor will recommend a clean install instead of an upgrade. In fact, I always clean-install new versions -- it's just more reliable. But I don't have to work very hard to do this because I have the above-described partition scheme.
 
Old 09-16-2009, 04:43 AM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
You contradict yourself. /home is for personal data mostly, and you say that personal data should stay separated from programs yet you claim that /home should live in /.

There's nothing wrong with having /home as part of /, but having it separate is a good idea if you want to ease the process of reinstalling or upgrading. If you decide you want to change distro you only need to reformat /, and the data in /home will remain untouched, which is not possible if /home is part of /.

Yes, you could create what you call the everything_else partition and then symlink stuff under /home/yourhomedir/, but what's the point? Why not just mount everything_else at /home or /home/yourhomedir? And how does that exactly fit into your "keep it simple" policy at all?
 
Old 09-16-2009, 04:45 AM   #11
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
I have no idea what your sources are, but really, having separate partitions for /usr, /var and /boot is not strange, is not uncommon, and is not a bad thing.
This is a common misconception. Each of these partitions has to get an allocation from the common data store, and if the installer misjudges future needs, he has to take the system offline and start over. The number of possible partition-full failures is equal to the number partitions -- it's as simple as that.

I had this debate a few years ago in another forum. My opponent at that time finally realized my point, and he then suggested the use of symlinks between partitions to get around the problem. I thought that was a rather desperate way to share drive space, compared to not creating the problem in the first place.

In general we're speaking of a desktop system that might also serve a few things, not a full-blown server. The only reason to have multiple partitions is that it allows a reinstallation of Linux instead of an upgrade, without wiping out the separate data store.
 
Old 09-16-2009, 04:57 AM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by lutusp View Post
This is a common misconception. Each of these partitions has to get an allocation from the common data store, and if the installer misjudges future needs, he has to take the system offline and start over. The number of possible partition-full failures is equal to the number partitions -- it's as simple as that.
So you make provisions for buggy installers... It's not about the installer, please, concentrate on the topic. HE (the original poster) is here for a reason, HE is not accepting the defaults of teh installers, HE is asking US about the issue at hand, and not about how convenient the defaults of his installer are.

I'd say instead understand what's going on and do the thing yourself (and if not ask here, which is what he is doing).

About the partitions filling, yes, that's right of course. Running with a single partition will solve that, but has other problems. Both sides have problems. The original poster is the one to decide what fits him better.

Quote:
I had this debate a few years ago in another forum. My opponent at that time finally realized my point, and he then suggested the use of symlinks between partitions to get around the problem. I thought that was a rather desperate way to share drive space, compared to not creating the problem in the first place.
Good for you, but I am not an opponent, and I am not continuing with that line of discussion since it's not helping the thread. I only want to inform the original poster, I am not interested in arguing. You simply were claiming things that are not true about being unable to boot and about that being not possible at all, and the original poster has the right to know that that's not true, and that it's a very normal and a broadly tested functionality that a lot of servers and desktops use.

Most distros do separate /boot by default, and a lot of others do so with /home and /usr. Which completely nullifies your claim that it will break your boot process.

I usually recommend going with at least /, swap and /home (or as you say, "everything_else" ), the rest is up to the user. Under some loads it's perfectly fine to split other directories to prevent some issues and to fix another ones. If he want's to go the simple route he can as well use a single partition and forget even about the swap file (an sparse file can be used later at very little extra cost). Let him decide.

Last edited by i92guboj; 09-16-2009 at 04:58 AM.
 
Old 09-16-2009, 04:58 AM   #13
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by michaelk View Post
There is no reason why /boot can not be on a separate partition. In fact Redhat's default installation created 3 partitions (/boot, / and swap) since version 7 if I can remember that far back. The latest versions of Fedora default installation require a separate /boot partition since it automatically creates an LVM for / and swap which you can not boot from.
This is simply false. The present Fedora installation imposes no such requirement, and the user must volunteer for such a thing if he is so inclined. Speaking as someone who reinstalls Fedora from scratch on a six-month basis.
 
Old 09-16-2009, 05:06 AM   #14
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by i92guboj View Post
You contradict yourself.
Yes, perhaps. Except that if the location of /home doesn't get mounted for some reason (like a bad edit of /etc/fstab), the user won't be able to log on. As home directories have become more and more a storage place for KDE and Gnome configurations, most of which are incomprehensible to the average user, I have begun thinking of them more as system and less as personal.

Nevertheless, this does represent somewhat of a contradiction, and the argument can be made that /home should be out on the data partition, in the simplified scheme we're discussing.
 
Old 09-16-2009, 05:12 AM   #15
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by i92guboj View Post
So you make provisions for buggy installers... It's not about the installer, please, concentrate on the topic.
This implies that there is an optimal choice of partition sizes that can avoid the problem of individual partitions filling up while others still have free space. But the only way to avoid the problem of one partition filling up while others have free space is not to create the partitions in the first place. That is the topic. My reply to the OP was based on that simple fact -- unreliability is inherent in a system with many small partitions.
 
  


Reply

Tags
partitioning



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partitioning; safe to add a primary when already having primary and extended/logical? Wim Sturkenboom Linux - General 2 08-16-2009 12:10 PM
Tool to change partition from primary to extended without prior deleting? JZL240I-U Linux - Software 9 10-20-2008 01:41 AM
partitions -- primary vs. extended pH* Linux - General 1 04-06-2004 01:56 PM
Primary and Extended Partitions Flossie Linux - Newbie 2 03-16-2004 12:25 PM
Primary and Extended Partitions batman Linux - Software 1 10-18-2000 01:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration