Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Optimal SSD+HDD setup for router and firewall

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
kjetilk
Posts: 8
Joined: 2014-11-13 15:00

Optimal SSD+HDD setup for router and firewall

#1 Post by kjetilk »

I have a box that sits as a router and firewall, as well as a Varnish cache for the Web servers behind it. That's all it does, really. In it, I have an old 320 GB SATA hard disk, and an old 28 GB SSD. That's plenty, there is only about 10 GB in use, but for now, it all sits on the HDD, I have just put the SSD in there from a box that didn't need it anymore. Now, I'd like to mirror everything between the SSD and the HDD with two objectives: 1) Enhance robustness of the system so that if one disk dies, the system will still run, 2) Improve bootup time so that if the system goes down, it can come back up as quickly as possible.

So, first the open question: What's the best way to do this?

My idea was to create a LVM RAID with a partition from the HDD and the entire SSD for / and set write-mostly on the HDD. Would this give me the benefit of the faster bootup time of the SSD, or would the write-mostly directive take effect too late in the bootup process to have this effect? Does this idea sound sane?

Now, if this is what I should be doing, what are the practical steps I need to take?

I now have

Code: Select all

/dev/sdb1       118G   10G  102G   9% /
(but it is addressed by UUID in fstab). It is a ext4 file system. So, first, I need to resize it to match the size of the SSD, which is /dev/sda.

/proc/partitions says that

Code: Select all

   8        0   29313144 sda
   8        1   29312000 sda1
What should I use for the size of the resized /dev/sdb1? 29312000?

Or, would be better to create a new partition (since I have lots of free space on the HDD), and create a LVM RAID over that new partition and the sda1? It is unproblematic to do that on a running system? Could I then just copy the data from sdb1 onto the new LVM RAID partition? In that case, cp or dd? It is not quite clear to me how I should be defining which device it is suppose to boot from, can I do that in /etc/default/grub? And then, I should install grub on the SSD's MBR, and tell BIOS to boot from the SSD?

So, I'm open to both completely different ideas on how to do this, and to corrections in the details, if my idea is generally OK.

kjetilk
Posts: 8
Joined: 2014-11-13 15:00

Re: Optimal SSD+HDD setup for router and firewall

#2 Post by kjetilk »

I suppose my question was a little too broad, and therefore quite difficult to respond to.

So, narrowing down a bit: If I have a SSD and HDD in a KVM RAID, will I be able to take advantage of the bootup performance of the SSD?

kjetilk
Posts: 8
Joined: 2014-11-13 15:00

Re: Optimal SSD+HDD setup for router and firewall

#3 Post by kjetilk »

I have finally returned to this issue and done most of it. I ended up with an md RAID, created two identically sized partitions, one on the SSD and one on the HDD. I have made the array, and copied everything over with cp -ax.

Then, I updated fstab and now I'm trying to get the array into /boot/grub/grub.cfg so that it boots from it.
I have mostly been following this howto but grub-mkconfig doesn't detect it
I've tried to hack the grub.cfg itself, didn't help and I have set

Code: Select all

GRUB_DEVICE_UUID=30c01ed7-24cd-482e-84d2-785ae3acfd8c
in /etc/defaults/grub.
Now, I'm out of ideas, what am I doing wrong?

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Optimal SSD+HDD setup for router and firewall

#4 Post by acewiza »

Your setup looks rather sub-optimal to me. Establishing a RAID array with partitions on both a conventional HD and an SSD throttles the entire file system down towards the slower speed of the older conventional disk. Looks like a bad idea, to me.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1400
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 175 times

Re: Optimal SSD+HDD setup for router and firewall

#5 Post by steve_v »

acewiza wrote:Establishing a RAID array with partitions on both a conventional HD and an SSD throttles the entire file system down towards the slower speed of the older conventional disk. Looks like a bad idea, to me.
Not ideal, no. Writes will be limited by the performance of the spinning rust. Reads should be pretty quick though.

Then again, I'm not sure why one would bother - a second 32G SSD can be had for the price of a few beers.


As for the grub configuration, the default entry in my autogenerated grub.cfg contains:

Code: Select all

        set root='mduuid/274480ee700f77bdfc40fc2ab55af40f'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/274480ee700f77bdfc40fc2ab55af40f'  a3c7dfb0-fa1e-425a-8666-52e8100f639f
        else
          search --no-floppy --fs-uuid --set=root a3c7dfb0-fa1e-425a-8666-52e8100f639f
And my /boot RAID1 is as:

Code: Select all

/dev/sdi1: UUID="274480ee-700f-77bd-fc40-fc2ab55af40f" UUID_SUB="0c7c3c4b-1cb6-a982-3d37-505b1d06fc06" LABEL="damnation:0" TYPE="linux_raid_member" PARTUUID="ebb78f95-01"
/dev/sdk1: UUID="274480ee-700f-77bd-fc40-fc2ab55af40f" UUID_SUB="067e19b9-09a0-9795-83e2-b1e8ffc433fa" LABEL="damnation:0" TYPE="linux_raid_member" PARTUUID="9d7fae4f-01"
/dev/md0: LABEL="Boot" UUID="a3c7dfb0-fa1e-425a-8666-52e8100f639f" TYPE="ext2"
So it looks to me like everything was set up correctly without any manual editing here. Grub was simply installed to both disks with dpkg-reconfigure grub-pc.

IIRC, I actually tested this by pulling a disk after I first set it up.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

kjetilk
Posts: 8
Joined: 2014-11-13 15:00

Re: Optimal SSD+HDD setup for router and firewall

#6 Post by kjetilk »

Thanks a lot for the replies!

The point here is really read performance, and specifically bootup performance. The system does very, very few writes, and once it is running, it doesn't really do any reads either :-) From then, it all happens in RAM. The system is built from old parts and somebody else's mistakes (they got me 16 GB of RAM, but the wrong type, so I got the right type without having to return it), and I like it that way, I don't see any reason why I should spend more on hardware that already performs well above what it needs to. If I get a little more bootup performance and a little more redundancy by this exercise, it is all I could ask for. :-)

Unfortunately, I'm not getting it when I autogenerate... I guess I need to dig deeper.

User avatar
acewiza
Posts: 357
Joined: 2013-05-28 12:38
Location: Out West

Re: Optimal SSD+HDD setup for router and firewall

#7 Post by acewiza »

kjetilk wrote:The system is built from old parts and somebody else's mistakes (they got me 16 GB of RAM, but the wrong type, so I got the right type without having to return it), and I like it that way, I don't see any reason why I should spend more on hardware that already performs well above what it needs to.
I too run some very old hardware where my tightwad utilitarian approach to those things comes into play. I also find it difficult to discard ANYTHING. Not a hoarder by any stretch, but I can see how some people get into that. I do however try to keep my personal workstation, core server and routing and security stuff fairly current. Old hardware simply becomes increasingly unreliable and failure-prone the older it gets, so nothing really important runs on it here.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.

kjetilk
Posts: 8
Joined: 2014-11-13 15:00

Re: Optimal SSD+HDD setup for router and firewall

#8 Post by kjetilk »

I'm now ready to declare "mission accomplished". The system boots on the RAID in about 20 seconds, which is quite a lot faster than before. :-)

The main obstacle was getting the grub config right. An attempt to autogenerate it failed, and a naive attempt to hack the grub.cfg failed too, but I found that the FS UUID and the UUID that is in the hints grub uses are not the same. Then, I hacked grub.cfg, managed to boot onto the RAID array and then use update-grub to autogenerate.

The motherboard and the RAM of this box is new, and the PSU isn't terribly old either, but the two disks are fairly old. Now that I have bit of redundancy, it feels pretty good though. It is just the network for my house, nothing very critical. :-)

Post Reply