How To: Partition your Hard Drive.

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
scorp123
Level 8
Level 8
Posts: 2272
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland

Post by scorp123 »

A verbatim copy of what I once posted. And yet I get no credit? That sucks :(
Husse
Level 23
Level 23
Posts: 18677
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Post by Husse »

Poor scorp :)
I'll give you cred :):)
Even if I don't think it is a copy :lol:
But you gave me that copy command :lol:
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
nelamvr6
Level 4
Level 4
Posts: 327
Joined: Sun Jul 08, 2007 8:14 pm
Location: New London, CT USA

Post by nelamvr6 »

Well I appreciate it Scorp, and I'll give you cred too! :D
ElEdwards
Level 3
Level 3
Posts: 139
Joined: Mon Jul 09, 2007 10:58 pm

Post by ElEdwards »

Scorp, you've been more help to me than you'll ever realize!! :)
User avatar
Lolo Uila
Level 5
Level 5
Posts: 576
Joined: Thu Mar 15, 2007 3:40 am
Location: Kapolei, Hawaii

Post by Lolo Uila »

I'm ready to allocate some more space for Linux on my big tower system. I'm currently using a single 80GB drive for Linux, which I will probably still keep for /home, but I'd like to use some of the other drives for space-hungry things like music and video files (the tower has 6 drives totaling 1.5TB of storage).

I've seen talk about creating mount points (partitions) like /home/Videos or /home/Music, but would a /home/Videos mount point automatically be used as storage for things saved to my /home/Videos folder (which is actually /home/trp/Videos in the Linux file system)?

If not (as I suspect) what needs to be done to accomplish this?

Would creating a /home/trp/Videos mount point do it?

I figure I could do it with sim-links. Could fstab be modified for the same result?

Any other way to accomplish this?

Trying to examine my options here and learn a little more, so I appreciate any info and suggestions.

Aloha, Tim

FYI: Current system
80 GB Linux drive (75G actual capacity)
Primary partition
2 GB /
Extended Partition
8 GB /usr
60 GB /home
3 GB /var
2 GB /swap

I'm planning on repartitioning two 320 GB SATA drives (298 GB actual) something like below, but I'd also like to make room for my Linux Music, Videos and Downloads folders in here somewhere.

SATA-1 (Windows boot drive)
36 GB NTFS Windows boot
2 GB Linux /swap
260 GB NTFS Windows data

SATA-2 (Linux boot drive)
2 GB /
16 GB /usr
4 GB /opt
4 GB /var
2 GB /tmp
270GB NTFS Windows data

and I will expand the /home partition to fill the 80G drive.
scorp123
Level 8
Level 8
Posts: 2272
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland

Post by scorp123 »

Lolo Uila wrote:I figure I could do it with sim-links.
I do the exactly same thing here.

I have a /home directory .... and somewhere there is a /data directory. Inside /data there is a directory called after my username which fully belongs to me (it has the same permissions as my home directory), and then underneath it I have directories such as 'Movies', 'Music', 'Photos', and so on.

/data
/data/scorp
/data/scorp/Movies
/data/scorp/Music
/data/scorp/Photos

...

Now, how does that stuff get into my $HOME directory? Sym-Links!

Inside my /home I have this:

/home
/home/scorp
/home/scorp/Documents
/home/scorp/Documents/Movies => /data/scorp/Movies
/home/scorp/Documents/Music => /data/scorp/Music
/home/scorp/Documents/Photos => /data/scorp/Photos

...

So your diskspace-hungry files can absolutely be on another disk partition, that's no problem. Just place your stuff on another mount point inside a directory which 100% belongs to you (not the mount point itself!) and then sym-link to it.
User avatar
Lolo Uila
Level 5
Level 5
Posts: 576
Joined: Thu Mar 15, 2007 3:40 am
Location: Kapolei, Hawaii

Post by Lolo Uila »

Is there a tool that can convert my home partition to primary (from logical) and resize it to fill the entire drive? I was looking through the parted manual and it doesn't appear that parted can do that.

I have Partition Magic, but it doesn't support the current version of ext3.
Husse
Level 23
Level 23
Posts: 18677
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Post by Husse »

Don't think so but if you want to use the drive entirely for /home it does not have to be a primary. You could just remove the rest and resize the logical to fit (almost) the entire drive (I think) This would however be a bit dangerous as you could loose data in the process
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
User avatar
Lolo Uila
Level 5
Level 5
Posts: 576
Joined: Thu Mar 15, 2007 3:40 am
Location: Kapolei, Hawaii

Post by Lolo Uila »

Yea, I figure I'll just have to brute-force it (backup, repartition, restore, edit fstab). I suppose another option would be to convert back to ext2 and see what Partition Magic can do, then convert to ext3 again when finished (but that may be more trouble than it's worth).

Anyway... I already have backups of both my Windows & Linux drives, so I won't lose anything if something goes wrong. I did a full partition backup last week when I tried to get Linux running on an Intel RAID-0 array. The Linux part went okay, and wasn't even all that difficult. I had Mint booting off of the RAID volume with home in its original partition on my 80G drive. Grub wouldn't boot into my Windows 2000 install, though. Error-15 if I remember right. Googled around and tried everything suggested and just couldn't get Windows booting. Finally gave up and did a partition restore and went back to using the BIOS to change the boot order.

So today I was getting ready to just get rid of the RAID volume and run the drives individually, when I started wondering if something might have been wrong with the MBR of the RAID stripe... Partition Magic couldn't read it (bad MBR), but all of my other software could. At first that made me think it was just a PM issue, but after the grub problems I wasn't so sure.

Since I had partition backups of my 2 boot drives, I decided to just blow the RAID volume partitions away completely and use Partition Magic to set them up again. That went well. I set up my Windows boot partition, along with /, /usr, /var and swap for Linux, and 2 more NTFS data volumes to use up the rest of the space. Then I restored my Windows boot partition from the backup and booted my Mint live CD. From the live CD I reinstalled Mint to the RAID volume (using the dmraid software), and after going through the little contortions needed to get grub installed on the RAID volume I rebooted, and it WORKS! :) I can now dual-boot Mint & Win2K with grub from my Intel SATA RAID volume.

I'm probably still going to get rid of the RAID, but I'm gonna keep it for a week or so and see if I can really notice a worthwhile performance boost. First impression is that boot times are faster, but not dramatically so. Shutdown, however, is super-fast!

Thanks again to everyone helping out here! I have learned a great deal and gained a lot of confidence in Linux, and the helpful people here are largely responsible for that. This really is a great community.

Aloha, Tim
Husse
Level 23
Level 23
Posts: 18677
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Post by Husse »

Interesting....
Unfortunately all (?) raid on consumer mobos is not hardware raid but some mix of soft- and hardware
You get a performance boost from RAID0 but not much (I have tested)
But what you really get is a total loss of data if the raid goes down
But thumbs up for backups :lol:
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Wh1sper
Level 2
Level 2
Posts: 70
Joined: Sun May 20, 2007 7:38 am
Location: Germany
Contact:

Post by Wh1sper »

scorp123 wrote:I'd stay away from ReiserFS ... It crashed several times on me and took all the data with it to Nirvana. If you want reliability I'd go with ext3 or XFS.
Me too. 2 times Reiserfs 3 has blow up the root filesystem. Parts of the open systemfiles like some init.d scripts where part of the directory.
Not funny! and all the wondertools to repair are absolutly useless and make it harm more and more.
(the cause was not found. there was no crash but only init 6)
So I for myself use only extfs3, in future maybe exfs4
Mein Blog fuer Nerten und Linux Strategen http://zockertown.de/s9y/
Wh1sper
Level 2
Level 2
Posts: 70
Joined: Sun May 20, 2007 7:38 am
Location: Germany
Contact:

Post by Wh1sper »

I do not want to enter discussion about to partion the disk(s).
Just giving my thought. I am using this:

/ 10 Gig
/usr/local/ 45 Gig
/home 45 Gig
swap

Why /usr/local ?
I do not want install big games again and again after reinstall
I place my self made stuff always in /usr/loca/bin
why /home ? This is anwered more then one time.

why no /boot? I am using grub, so why?
why not /tmp /var ... because, this is my personal computer, no need for this and for not having lvm this is a very effective way to waste space.
And more partitions = more trouble :)

If possible I am using lvm, which I am greatly miss by default at linuxmint.
debian etch is doing this much better
(btw. I am working for a very large company, too I'm dealing with a sun cluster, there is be a use for /opt /serv /var ... but at home I have a fileserver with nfs... :)
Mein Blog fuer Nerten und Linux Strategen http://zockertown.de/s9y/
immyls

Re: How To: Partition your Hard Drive.

Post by immyls »

Along the lines of how to partition:

Can you mount multiple drives to the same mount point? ie. hda3 mounted to /home and also hdb1 mounted to /home?
User avatar
Fred
Level 10
Level 10
Posts: 3337
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: How To: Partition your Hard Drive.

Post by Fred »

immyls,

More accurately, you mount partitions, not physical drives. If the partition includes the entire drive then yes, you have also mounted the drive. There are some storage system setups that include more than one drive in a partition also. But what you mount is the partition.

You can mount a partition within the file system. For an example. Let's say you have a partition, sda5, that has music on it. Also, let's say you have a partition, sda6, that has pictures on it. You could make a folder in /home/Your_username called Music. And another called Pictures. Then mount sda5 to /home/Your_username/Music and sda6 to /home/Your_username/Pictures. You would then have a folder in your /home that would be called Music that would contain all your music on sda5 and another folder in your /home that would contain all your pictures on sda6.

Hope that answers your question.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
atlef
Level 4
Level 4
Posts: 306
Joined: Sun Nov 18, 2007 8:20 am
Location: Stavanger NORWAY

Re: How To: Partition your Hard Drive.

Post by atlef »

It is good that I found back to this post, as I just remembered reading it, but couldn't for the love of me figure out where it was.
Thanks for the tips and suggestions made here. It has made my computing a little less of a hassle when I do upgrades/reinstalls and installs every so often.

Here is my set-up as fdisk -l sees it.
fdisk -l says wrote:$ sudo fdisk -l /dev/sda

Disk /dev/sda: 320.0 GB, 320072933376 bytes
240 heads, 63 sectors/track, 41345 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0xed3eed3e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 35 264568+ 7 HPFS/NTFS vista's (/boot)
/dev/sda2 36 41345 312303600 5 Extended
/dev/sda5 36 7145 53751568+ 7 HPFS/NTFS vista (/) mounted in /media/vista
/dev/sda6 7146 41345 258551968+ 7 HPFS/NTFS other (/usr) mounted in /media/vistabckup

$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe89ce89c

Device Boot Start End Blocks Id System
/dev/sdb1 17 9154 73400985 7 HPFS/NTFS W2 (/home) mounted in /media/vistadoc
/dev/sdb2 * 1 16 128488+ 83 Linux /boot
/dev/sdb3 9155 14593 43688767+ 5 Extended
/dev/sdb5 9155 9652 4000153+ 83 Linux /
/dev/sdb6 9653 10150 4000153+ 83 Linux /usr
/dev/sdb7 10151 10399 2000061 83 Linux /var
/dev/sdb8 10400 14460 32619951 83 Linux /home
/dev/sdb9 14461 14593 1068291 82 Linux swap / Solaris

Partition table entries are not in disk order (I am aware of this one)
atlef.
wesireal
Level 1
Level 1
Posts: 26
Joined: Fri Apr 04, 2008 5:42 pm

Re: How To: Partition your Hard Drive.

Post by wesireal »

This thread is titled; How to partition your hard drive. It is everything but............

It is a thread where everyone is looking to prove that his/her partition scheme is better than everybody else's.

PLEASE is there a tutorial that actually teaches one to partition the hard drive and all schemes be damned? :evil:
Husse
Level 23
Level 23
Posts: 18677
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: How To: Partition your Hard Drive.

Post by Husse »

to partition the hard drive and all schemes be damned?
Theoretically impossible :)
What/how ever you do it is a scheme :)
Take a look at this wiki
http://www.linuxmint.com/wiki/index.php ... _partition
As so often written by yours truly and supposes you dual boot with XP
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
wesireal
Level 1
Level 1
Posts: 26
Joined: Fri Apr 04, 2008 5:42 pm

Re: How To: Partition your Hard Drive.

Post by wesireal »

I have already read the wiki.It presents grand schemes and then tell to use Gparted.I have not been able to find a tutorial on how to use gparted, without it I do not know where to begin!!!!!!!!
User avatar
Fred
Level 10
Level 10
Posts: 3337
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: How To: Partition your Hard Drive.

Post by Fred »

wesireal,

Below is a pretty good How-To for Gparted. There are others if you take the time to Google for them. I have recommended this one before with pretty good results.

http://www.howtoforge.com/partitioning_with_gparted

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
AK Dave
Level 6
Level 6
Posts: 1042
Joined: Wed May 14, 2008 3:39 pm
Location: Anchorage, AK USA

Re: How To: Partition your Hard Drive.

Post by AK Dave »

Usually swap should be at the beginning. There is some logic in the idea that swap should be in the "middle" or at least very close to /usr if that is a seperate partition, but ultimately swap should be either at the start or close to the data you'll be accessing the most so that the drive head is either close to "home" (not to be confused with /home) when accessing swap or doesn't have to move far from the data surge that is causing the swap.

When I partition a system with a seperate /boot, swap is the very next partition in line followed by the root filesystem.

That said, I think that the partition plan detailed above is needlessly complicated for a single-user single-drive home system. I submit that seperating /boot, /var, and /usr on a home system on a modern linux system doesn't offer any real advantages over a single-partition OS install with seperate partitions only for "data" and swap. If you have multiple drives, distributing the filesystem across multiple drives offers some performance advantage but arraying multiple drives in a raid does this even better.

Do you have specific application reasons to actually need seperate partitions for /var and /usr?

There are some security advantages to a seperate /home and it offers some advantages for OS upgrades.

Also, never never never us a journaling file system for a /boot partition, and you don't need it for a / partition either. You have more file system overhead and you needlessly delay your cold boot time with random file system checks. For a single partion install, a journaling file system is good if and only if you routinely churn through different software packages, installing and removing. If you can be trusted to have a stable install, a nonjournaling filesystem for the OS install is acceptable and "lighter".

This is suggestion #1:
Primary (sda1) ext2 /boot 128meg
Primary (sda2) swap swap 2gig
Primary (sda3) ext3 / 12gig
Extended
- Logical (sda5) ext3 /home 1gig
- Logical (sda6) ext3 (the rest of the drive)

This is suggestion #2:
Primary (sda1) swap swap 2gig
Primary (sda2) ext3 / 12gig
Primary (sda3) ext3 /home 1gig
Extended
- Logical (sda5) ext3 (the rest of the drive)

Why in #2 do I have an Extended partition when none is needed? Subdividing an Extended partition is simpler than playing with Primary partions. If you trust that your partition table will be stable, then use a Primary for this last partition.

The advantage to a seperate /home is keeping your .config files for various software from distro to distro. The disadvantage is the same as the advantage. By partitioning seperately for your user data (typically: video, music, isos, downloads) you make it easy to backup this junk, even easier to backup /home, and you simply create symlinks between the data partition and /home/user for folders that you want directly accessable. This also makes it much much easier to share multimedia or other big file libraries between different users. This also makes it much easier to encrypt, hide, or otherwise make invisible files that you don't want visible.

I suggest layout #2, and further suggest that you configure TWO seperate 12gig "/" partitions. Use one for your primary OS install. Use the other with grub for an alternate OS install, or a "dirty" OS install to field test software packages. It is a very good thing to be able to test drive software in a "safe" environment.
Post Reply

Return to “Tutorials”