LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   What is the best partitioning scheme for a multi-disks HTPC or HDMI configuration? (https://www.linuxquestions.org/questions/linux-hardware-18/what-is-the-best-partitioning-scheme-for-a-multi-disks-htpc-or-hdmi-configuration-762751/)

cippalippa 10-18-2009 07:32 AM

What is the best partitioning scheme for a multi-disks HTPC or HDMI configuration?
 
This post is about best partitioning scheme and doesn't consider (yet) different filesystems or format options, nor (yet) which distro to install. The configuration is under scrutiny is NOT for gaming or for simple desktop usage, but for HTPC and HDMI usage.

Hallo all, I have a spare motherboard around and I want to build a media center based on free software and licensed codecs, GNU/Linux distributions and one or more iterations of what have been done for the living room linux enjoyment.
My questions revolve around the need to optimize the resources without adding expenses, and I want to ask you suggestions about the partitioning scheme first.
Details: the mobo is a P5ADZ-E Premium, equipped with Pentium IV 631, 4 Gb of RAM on two sticks and it will sport a GF 9600 with 1 Gb of memory; the PSU is either a 540 or 630 Watt item. Audio, USB, Firewire, Gigabit, SATA and PATA, all is on-board with no expansion (maybe a DVB card could be included on either the PCI or PCI-e bus). You can see the specs to make up your metrics.

I have the following disk at hand now:
- 2 Samsung HD753LJ/750 and 1 HD103UJ/1000
- 1 ST3500320AS 500
- 1 Raptor WD1500ADFD/150
- 2 cheap SATA150 disks for 40Gb sucked up somewhere
- 2 PATA ST400832A/400.

Now, if you readers are cognoscenti, imagine the workload of a heavy AV configuration: the huge screen on which I assume huge things get going, streamed or not but surely 1080p, and the torrents running, the internet radio too, a DVD playing on the LAN, if possible someone connected from another room to the mobo's 802.11g should be able to play music or videos. Yes, that Flash thing as well... Additionally, a disk could be plugged for Redmondism, therefore Virtualbox or VMware or Wine should be called in to resurface needed content from a Microsoft past.
The motherboards was never used, the CPU was. The 755 socket gives me the choice of a dual Celeron but I preferred to go HyperThreading instead to retain the whole shebang of that ISA instructions. No RAID is intended because a 3 Ghz processor with HT is supposed to do most of the above in 4 Gb of RAM using onboard SATA, LVM is preferred instead to consolidate the space on the big Samsungs, and to create other volumes where needed.

What is the best disks' usage for a low-latency oriented partitioning scheme?
In my intention the Raptor is the disk where very fast thing have to happen, like transcoding and AV heavy stuff ( about which I know very little). The small SATA150 might be deployed for the only goal of creating a DMZ in case of big LAN, or any Internet paranoid settings: the PATA is big enough and handy anyway.
So I need to set root & family in the smartest way, and my options are laid down like this:

/boot / PATA 400Gb
swap /home SATA 750/1000Gb
/opt SATA150 150Gb Raptor
/DMZ SATA150 40Gb

or:

/boot / /home SATA 1Tb
/usr SATA 750Gb
swap /var SATA 750Gb
/Raptor SATA150 150Gb
/DMZ SATA150 40Gb

or just:

/boot /everything SATA 1Tb
/everything SATA 750Gb
/everything SATA 750Gb
swap /var PATA 400Gb
/Raptor SATA150 150Gb

This configuration is expected to do at least 3/4 things at a time reading on all disks and delivering data to more than one location. If you check the specs of the mentioned components you can have an idea of what these not-so-recent disk are able to do in terms of density and cache and rotation and so on: does it still matter, with such big Samsung, to separate / and /usr, or /opt, or home?
Do you think that my worry is theoretical (in fact, I still haven't installed anything) and the motherboard, the GPU and the CPU do have enough juice to stand and deliver audio, video, torrents and DVB without messing with head contention, bus contention, sequential reads or else?
Thanks for the help, ask for more details if needed.

Ennio

xeleema 10-19-2009 03:10 AM

"Cognoscenti" enough?
 
Yeah, since you seem to be leaning towards a heavy I/O configuration, here's what I would suggest;

1. Partitions smartitions. You don't have to worry about how big one filesystem is going to be, you should be concentrating on how much I/O you can pull/push to the disks, which means;

2. Get a RAID. It sounds like RAID 10 would suite your needs very well, however you'll need 4 or more disks of the *same* size. (The sacrafices we make so we can watch DVDs over the LAN....sigh.)
Go to Wikipedia, and read up.

3. Once you have a RAID setup. Use LVM2 to manage your filesystems.
Basically, you can resize filesystems as needed (you will have to unmount them), because the filesystems will live on "logical volumes" inside at least one "volume group". However this means that you're going to have to;

4. Decide on a Linux distribution. However, you may want to also find out how to;

5. Configure multiple NIC interfaces to act as one, so you can do as much as possible over your network.

As for the "partition layout" here's what I would recommend;

md0 (Software RAID 0 - Mirror)
Size: 100mb (Not a typo, that's Megabytes)

Comprised of one 100mb partition, stuck at the front of both SATA 750GB disks, mirrored for redundancy.

md10 (Software RAID 0 - Mirror)
Size: 749.9Gb
Comprised of one partition from both SATA 750GB disks, that takes up the remaining space on the disks. Also Mirrored for redundancy.
Mounted as: /boot
Purpose: Used to boot. Also stores your kernels and initrds. Not mounted during normal operation, to protect it from users, and keyboard seizures.

vg0 - First Volume Group (LVM2)
Contains one Physical Volume (md10), and houses the following logical volumes;

root - Typically 1Gb
swap - Size equals RAM, or 2GB, whichever is bigger.
usr - Check your Linux distribution for how big this should be.
var - Size equals RAM, or 4GB, whichever is bigger.
opt - Check your Linux distribution for how big this should be.
home - Really up to you, dude.
tmp - Size equals RAM, or 2GB, whichever is bigger.

/mnt/media - However big you want it, used to store complete movies, shows, etc.
/mnt/downloads - used to store downloading and downloaded misc files.

Now, as for your other disks, the 1Tb, the 400gb, and the 150gb.
Save them for another system. *Maybe* use the 1Tb as a "Backup" for your media.

The reason I say you should save your other disks is because you really want to cut down on how many disks are in a system. You'll over-tax the SATA controller, and lose-out on how much I/O you can cram down it's throat.

Things like re-encoding media are typically bottlenecked by CPU, RAM, then disk I/O, so I wouldn't worry about striping things, or having things happen on a "fast" disk.

As for setting up a filesystem for "DMZ"...um, do you mean to store virtualized server instances? (VMware images?).

A bonus to this sort of configuration would be that you could have a 750Gb disk die on you, and never notice. :D

(but seriously, read up on LVM2)

Electro 10-19-2009 07:31 PM

Do not need a multiple partition scheme because you will lose performance. You just need to use multiple hard drives. Multiple hard drives will provide better performance compared to multiple partitions.

I suggest the following setup.

OS Drive:
WD Raptor (assuming used for desktop use)
swap 512 MB
/ to the rest of the drive

Media Drive:
Each hard drive has two partitions which is for swap and LVM
swap 512 MB
Any_Directory [EVMS or LVM2 - Seagate ST400832A 400 GB, Samsung HD103UJ 1000 GB, Seagate ST3500320AS 500 GB, 40 GB SATA150, 40 GB SATA150]

Virtual Machine Drive:
Any_Directory [SW RAID-0 - (2) Samsung HD753LJ 750 GB or (2) Seagate ST400832A 400 GB]

Make sure fstab includes all swap partitions and make sure they have the same priority for instant RAID-0 for swap. Also make sure the swap partitions are in front.

Intel processors does not handle virtual machines well. They provide OK performance. AMD is a lot better in this area.

Since you are using a nVidia that is VDPAU capable, do not need to think about the processor to handle HD videos. If VDPAU is setup properly, it can accelerate MPEG-1, MPEG-2, WMV3, WMV9, H.264, and VC.

A 1000 Mbps is sufficient for anything. Using WiFi to handle HD is going to have problems. WiFi is not always reliable and the speed is poor.

About BitTorrent, limit the amount of total connections or else your computer will stall. By default BitTorrent programs are set to unlimited connections which is a bad thing. Also they are set to unlimited bandwidth which is also a bad thing. Limit your BitTorrent clients to what your Internet connection can handle. Please use BitTorrent clients legally. Using BitTorrent illegally is not what it is designed for. It is written to deliver data legally. I setup BitTorrent clients to serve Linux distributions, but I limit to about four at a time and rotate them. Also I limit to around four per torrent or 16 total. Just to give you an example. It is able to upload 30 or more kilobytes per second instead of a 1 KB or less also with out stressing the Internet connection too much, so I or someone else can use.

Quote:

Originally Posted by xeleema (Post 3724614)
Yeah, since you seem to be leaning towards a heavy I/O configuration, here's what I would suggest;

1. Partitions smartitions. You don't have to worry about how big one filesystem is going to be, you should be concentrating on how much I/O you can pull/push to the disks, which means;

2. Get a RAID. It sounds like RAID 10 would suite your needs very well, however you'll need 4 or more disks of the *same* size. (The sacrafices we make so we can watch DVDs over the LAN....sigh.)
Go to Wikipedia, and read up.

3. Once you have a RAID setup. Use LVM2 to manage your filesystems.
Basically, you can resize filesystems as needed (you will have to unmount them), because the filesystems will live on "logical volumes" inside at least one "volume group". However this means that you're going to have to;

4. Decide on a Linux distribution. However, you may want to also find out how to;

5. Configure multiple NIC interfaces to act as one, so you can do as much as possible over your network.

I disagree completely because you do not know that multiple partitions reduces performance. It is best to use one partition instead of many. For heavy file IO, it is best to spread out each directory to separate hard drives instead of partitions. Partition scheme does not help with huge file IO. Only multiple hard drives for each directory.

There are problems bonding multiple NIC together. One is the network bottleneck. Only one NIC can be used at a time, so two networks have to be setup which costs more money. A 1000 Mbps network is all what is needed. A 1000 Mbps network can serve about 25 people watching HD videos.

Again do not need think about multiple schemes for performance. Just need to understand about hardware and how it is going to be used. Stripping RAID levels are not always good to use.

Setting up swap to be equal or twice or RAM is a bad rule of thumb. A better rule is optimize the kernel through sysctl to minimize the use of swap as much as possible. If swap is used, then upgrade the RAM.

It is hard for me to suggest a RAID-10 setup because there is not enough hard drives with the same capacity. Sure can set partitions equal to the smallest hard drives and then combine, but that will be more complicated to keep going.

cippalippa 10-20-2009 02:13 AM

Hallo HW aficionados, thank you for your replies which give me the chance to point a couple of things.
First I would like to avoid RAID expansions to keep the costs low. I will hopefully sell this machine in Holland, likely in Utrecht, and checking the prices for this target gives me the idea nobody will be willing to pay a P-IV more than 400 Eurobucks.
For this reason I should the use the software RAID offered by the motherboard, option which I didn't favor from the start because I think even a 65nm 3Ghz processor is not enough; if your data and experience suggest you otherwise I will try it.
The second point depends on my historical ignorance: I started GNU/Linux from Debian Potato and an IBM 486DX, and for many years - before passing onto RISC - I didn't evolve that much so that cherrypicking partitions, disks and expansions was mandatory to squeeze the best off the worst. Now that I have some money I bought these pointless and enormous drives, and the GeForce thinking of conferencing, schools, home theater and people want such big big thingies (I go browsing VESA on Debian with a Sun Ultra5 and I feel fine with it, if needed, oh quad-core users...).
In the end, I question the ability of the fast but old - minor density - Raptor to deliver all the juice that my gross interpretation of what I/O is assumes is needed.
Can a SATA150 disks, 10.000 rpm, first disk in the chain, be a satisfied root disk AND be used in its free space as fast-pace space?
If yes, wouldn't it be nice to help a bit that old friend by placing, say, /usr /opt and /var on different partitions on different disks? That was my initial question.
So, given that the 750 and the terabyte Samsungs are not so different in family and specs, I would have three disks whose first 4/6 gigs could be devoted to such partitions. And swap on the PATA 400Gb, with /home on the rest.
All that without RAID, either in HW or SW, only using LVM2 *because I assume the overhead is minor and doesn't cost a thing*.
Eagerly willing to check out as soon your ideas (the machine will be assembled tonight), lads & gents, thank you.

Ennio

cippalippa 10-20-2009 02:29 AM

Electro, about the networking issues... That mobo would by itself give me a second gigabit port but the expansion module is proprietary and I lost it, so I would have to incur in levvying the PCI bus with a 10/100/1000 card. I see that different NICs can be used at the same time, either trunking them into only one pipe or serving other destinations so I don't understand what do you need. Anyway, given that I really think such a sale will only happen for homely usage I don't think there is any need to make up for new network interfaces; saying wireless is just a lame selling point...
Someone who buys such a machine for HTPC needs has a huuuuuue screen somewhere and multi-horned wireless extrascreaming router very close. So the existing RJ45 will say "Gigabit!" and the customer will be happy anyway...
Also, before being operational the system necessarily has to be checked against the HDTV screen, the remote controller (let's cross the fingers with LIRC), eventual extra disks, which Linux implementation of HTPC the customer feels better off with, cabling, etc. There will be all the time and the space to talk the person through a discussion of the so-called "best practices", with responsibility and feet on the ground.


cheers

xeleema 10-21-2009 04:37 PM

Quote:

Setting up swap to be equal or twice or RAM is a bad rule of thumb. A better rule is optimize the kernel through sysctl to minimize the use of swap as much as possible. If swap is used, then upgrade the RAM.
Now that point I will agree on, however, it's not a bad rule of thumb; *something* has to be setup for swap. Demands change, and typically changing swap later will result in "fragmented" swap. Which is just self defeating. On a side note, sysctl is a Red Hat-based command, and cippalippa did mention staying away from distro-specifics.

cippalippa,

In to change how aggressively your system swaps, assuming you run a Red Hat-based distro, perform the following;

Example: You want your system to swap when RAM usage tops 85%:

1. Backup, then edit your /etc/sysctl.conf as root. Change or add the following line;
vm.swappiness = 15


2. Either reboot for the change to take effect, or perform the following;
sysctl vm.swappiness=15
swapoff -a
swapon -a


/me dons my robe and wizard's hat....

Electro,

Quote:

I disagree completely because you do not know that multiple partitions reduces performance.
Logical Volumes != Partitions
I've done the performance metrics on both IDE and SATA configurations in the past. On a 2.6.x kernel. I do know.

Quote:

It is best to use one partition instead of many.
I mention using 2 partitions, one partition on two disks for a mirror of /boot (md0), the other partitions for a RAID device (md10) for the Volume group that the O.S. logical volumes would reside in.
Again, I must point out that logical volumes are not partitions. The common line of thinking is that you don't want to have "one big filesystem for everything" because;
a. Filesystem corruption is a b*tch.
b. Rampant data can flood your filesystem, then you're in a "can't login, can't reboot" situation.
Hence my recommendation for cutting root, swap, usr, var, opt, home, and tmp into logical volumes on a RAID device (stripe or mirror). The /boot directory has to live on a mirror, as Linux doesn't boot stripped devices. And last I checked, using a logical volume for /boot was a huge headache.

Quote:

Partition scheme does not help with huge file IO. Only multiple hard drives for each directory.
If the goal is to sacrifice redundancy over the alter of performance, then md10 could be a stripe, rather than a mirror. And given today's CPUs, software vs hardware RAID wars have long since been a thing of the past. So I've refrained from mentioning them.

Regardless, all RAID functions of any type (0,1,5,10, software, hardware) lose performance when odd-sized disks are involved. More so than "partition scheme [that] does not help with huge file I/O".

Electro 10-22-2009 06:59 AM

Quote:

Originally Posted by xeleema (Post 3727718)
Now that point I will agree on, however, it's not a bad rule of thumb; *something* has to be setup for swap. Demands change, and typically changing swap later will result in "fragmented" swap. Which is just self defeating. On a side note, sysctl is a Red Hat-based command, and cippalippa did mention staying away from distro-specifics.

The utility sysctl is not a Redhat only utility. It is actually a BSD utility. Any Linux distribution have such utility, so it is not a Linux distribution specific. Also the Linux kernel (vanilla) recognizes it.

Setting up swap is not required if using 1 GB of RAM or more. Can always add it later. The rule of thumb on its size is matter of preference. If you think other wise go ahead of with your age old rule of thumb.

Fragmentation always occurs for any file system, so do not worry too much about it. You should worry more if the computer is swapping out memory pages to swap. This will reduce performance to a crawl if swap is used too much.

Quote:

Logical Volumes != Partitions
I've done the performance metrics on both IDE and SATA configurations in the past. On a 2.6.x kernel. I do know.
I did not say anything about logical volumes. Though partitions make up logical volumes.

Multiple partitions on a hard drive loses performance. Throughput or bandwidth suffers as the heads reaches outside the plattors. This is already known. For example, if a hard drive is divided up into thirds, the first partition will have the highest throughput, the second partition will have the second highest throughput, and the third partition towards the end will have the lowest throughput of the two.

If you say that you did throughput tests, then you need to redo them and do them based on partitions because I think you did them based on raw device. A raw device will give you bad results.

Quote:

I mention using 2 partitions, one partition on two disks for a mirror of /boot (md0), the other partitions for a RAID device (md10) for the Volume group that the O.S. logical volumes would reside in.
Again, I must point out that logical volumes are not partitions. The common line of thinking is that you don't want to have "one big filesystem for everything" because;
a. Filesystem corruption is a b*tch.
b. Rampant data can flood your filesystem, then you're in a "can't login, can't reboot" situation.
Hence my recommendation for cutting root, swap, usr, var, opt, home, and tmp into logical volumes on a RAID device (stripe or mirror). The /boot directory has to live on a mirror, as Linux doesn't boot stripped devices. And last I checked, using a logical volume for /boot was a huge headache.
Neither RAID levels will protect the data from file system corruption. I have never gotten file system corruption for five years, but the time it happen was in a worst conditions (immature software, heat, processor load). At the time of file system corruption, all data was retrieved thanks to how XFS works. The only way to protect against file system corruption is the old fashion statement "MAKE THE FUCK'IN BACK UPS." If you have not make any back ups, then you are screwed if you have file system corruption. Though one thing to watch out for is idiot users that delete the wrong files which always does not get the blame before data corruption.

You need to understand about performance before implementing something like RAID-10. What relates to performance is latency and throughput. Throughput only shines if the file size equals to it. Throughput does not matter if the files are small. RAID-10 only helps in transferring or copying large files over the network, video editing, sound editing, large image editing, and virtual machines. It is best to use the Western Digital Raptor for /. A Raptor hard drive has the lowest latency.

About the system over loading is none sense at this point. I have done more on my AMD Athlon 700 MHz with 512 MB of RAM than what cippalippa is going to do. The following was my setup for my AMD system.

AMD Athlon 700 MHz
512 MB SDRAM (4 X 128 MB, PC-133)
Abit KA7-100 (includes Highpoint model HPT370)
IBM 75GXP 20 GB (used for OS, formatting using XFS)
(2) Western Digital JB 120GB /w 8 MB cache

[VIA]
IBM 75GXP 20 GB

[HPT370]
Primary-Master: Western Digital
/dev/hde1 swap 1GB
/dev/hde2 xfs 114GB /mnt/misc

Secodary-Master: Western Digital
/dev/hdg1 swap 1GB
/dev/hdg2 reiserfs 114GB /mnt/vdr (did not care if file system dies)

[/etc/fstab]
/dev/hde1 none swap pri=-1 0 0
/dev/hdg1 none swap pri=-1 0 0


My configuration will work better and be simpler while providing performance. If you have not read it closely, then I will rephrase it with some additions.

[OS Drive]
WD Raptor (assuming used for desktop use)
swap 512 MB
/ 20 GB
/home rest_of_the_drive

[Media or Miscellaneous Drive]
Each hard drive has two partitions which is for swap and LVM
swap 512 MB
Any_Directory [EVMS or LVM2 - Seagate ST400832A 400 GB, Samsung HD103UJ 1000 GB, Seagate ST3500320AS 500 GB, 40 GB SATA150, 40 GB SATA150]

[Virtual Machine Drive]
Any_Directory [SW RAID-0 - (2) Samsung HD753LJ 750 GB or (2) Seagate ST400832A 400 GB]

The swaps should be mounted similar to my fstab file shown earlier. It is hard for me to recommend an easy setup with RAID-10 with out losing performance because a partition at two drives will suffer performance or throughput. However, the Seagate and Samsung drives will hurt performance because of their high latency although they have high throughput which will help transferring big files over the network.

Quote:

root - Typically 1Gb
swap - Size equals RAM, or 2GB, whichever is bigger.
usr - Check your Linux distribution for how big this should be.
var - Size equals RAM, or 4GB, whichever is bigger.
opt - Check your Linux distribution for how big this should be.
home - Really up to you, dude.
tmp - Size equals RAM, or 2GB, whichever is bigger.
The / is bigger than you think. I would not recommend any size for it.

The size for swap is matter of preference. I prefer to start out with around 256 MB. It limits around 2 GB.

The size for /var also unknown. It is best set a size for /var/log, /var/www, /var/spool, /var/ftp if going to place them on separate drive or partitions. I would suggest /var/log be around 256 MB to 1 GB. For /var/www, I would suggest around a few hundred megabytes to a gigabyte depending on the configuration. The directory /var/www does not have to be the source of the site because it can be set to be anywhere on the system. The directory /var/ftp is just like /var/www. Then for /var/spool, I would suggest a few hundred megabytes to a few gigabytes. This directory is the spool for printing documents and mail.

The size for /opt and /usr is iffy. I would not recommend any size because they depend on the maintainer of the program and the user of the system.

The size for /home can be infinite, but the size depends on what are users going to be storing and if they have access to another location.

The size for /tmp is easily can be said. It ranges from a few hundred megabytes to several gigabytes.

If you want to choose directories to isolate problems, I would say /var/log, /tmp, /home. The /boot directory can also be separated.


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