TurnKey Linux Virtual Appliance Library

Setting Up Hard Disks For Mirroring

After doing the installation of the TurnKey File Server 11.3 appliance I realised that I forgot to partition the second disk. What is the name of the partitioning tool used by the TurnKey installer?

I need to partition the second disk before setting up disk mirroring (RAID). Will I need to do anything after partitioning the disk in the way of mounting? I'm not sure if the VIA SATA disk controller has hardware RAID support, is there a straightforward way to find out via the console?

Please bear with me as this is the first time I am setting up RAID in Linux. I'm so used to administering and using Linux desktop PCs that I havn't got much in the way of server side experience, and knowledge.

With the different options

With the different options for partitioning a hard disk in Linux I would prefer to use the same one used by the Turnkey installer. Right now I'm wondering if there is a straightforward way to copy the partition table from the hard disk used during the install to the empty one (hasn't got a partition table).

Bit lost with the command line partitioning tools since each one does the partitioning in a different way which seems alien. Busy guessing which one was used by the Turnkey installer. Attempted to use cfdisk but its output on the partition table for /dev/sda isn't very helpful, especially when trying to create an exact match on /dev/sdb. There doesn't appear to be any options to create each partition based on the start and end blocks with cfdisk so i'm a bit stuck.


Mirroring The System Partition

Got the partition table cloned from /dev/sda to /dev/sdb with sfdisk. After cloning the partition table I attempted to create RAID 1 between /dev/sda1 and /dev/sdb1 using mdadm. Ended up with an error message, see the details below:

 

mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda2 /dev/sdb2

Cannot open /dev/sda1: Device or resource busy


Jeremy's picture

I know nothing about RAID

So can't be of much help with that but personally I use fdisk for partitioning and find it pretty straightforward.

Also keep in mind that by default TKL uses LVM. LVM inconjuction with RAID may add complexity to your config.

As for your issues with mdadm I have no idea...

If you keep in mind that TKL v11.x is Ubuntu 10.04 under the hood you should be able to find info that is relevant.

Not Using LVM

With the partitioning the File Server is not using LVM. Is it possible to mirror a partition that is already mounted (incl the system/root partition)?


Alex Bassett's picture

Ubuntu page for raid

https://help.ubuntu.com/10.04/serverguide/advanced-installation.html

 

here is the ubuntu guide for raid and mdadm for 10.04 .

Follow the installation steps until you get to the Partition disks step, then:

  1. Select Manual as the partition method.

  2. Select the first hard drive, and agree to "Create a new empty partition table on this device?".

    Repeat this step for each drive you wish to be part of the RAID array.

  3. Select the "FREE SPACE" on the first drive then select "Create a new partition".

  4. Next, select the Size of the partition. This partition will be the swap partition, and a general rule for swap size is twice that of RAM. Enter the partition size, then choose Primary, then Beginning.

  5. Select the "Use as:" line at the top. By default this is "Ext4 journaling file system", change that to "physical volume for RAID" then "Done setting up partition".

  6. For the / partition once again select "Free Space" on the first drive then "Create a new partition".

  7. Use the rest of the free space on the drive and choose Continue, then Primary.

  8. As with the swap partition, select the "Use as:" line at the top, changing it to "physical volume for RAID". Also select the "Bootable flag:" line to change the value to "on". Then choose "Done setting up partition".

  9. Repeat steps three through eight for the other disk and partitions.


Advanced Install Guide Not Very Relevant

Unfortunately the guide you have pointed me to isn't very relevant. Have already gone through the TurnKey installer. Need a guide for setting up RAID 1 that solely uses the console, not the Ubuntu Server installer.

Unless there is a way to bring up the TurnKey installer again from the installation then the guide won't be of much use.


No Option To Setup Raid In TurnKey Installer

Ended up reinstalling TurnKey 11.3 (File Server) in order to follow the instructions for doing an Advanced Install but hit a major roadblock. No options in the installer for setting up RAID. Now i'm truely stuck.


Jeremy's picture

Here's what google found

This looks like it is a pretty comprehensive step-by-step guide. It's actually for Debian but should be close enough (hopefully).

http://feeding.cloud.geek.nz/2011/03/setting-up-raid-on-existing.html

Have a crack and see if that works for you.

If a step doesn't work post back and I'm happy to help troubleshoot.

Mirroring Appears To Be Setup

Right now i'm at step 5 in Setting up RAID on an existing Debian/Ubuntu installation.

I had shutdown the server for the night and started it up again, and tried to mount /dev/md1 to /tmp/mntroot but ended up with the following message:

mount: you must specify the filesystem type

 

Now i'm wondering why the message has appeared. Need to have /dev/md1 mounted in order to alter the fstab file, otherwise there is no way to test if RAID is working. Even if I do make it to that point there is the issue of getting the GRUB menu to appear. Have tried repeatedly pressing right shift before TurnKey boots but to no avail.


Jeremy's picture

I'm not sure what's happening.

A quick google suggests that something is not quite right. Others with similar message seem to be suffering from some sort of disk corruption, but my searching wasn't exhaustive so perhaps I missed something.

In the instructions it says to change fstab on both drives prior to boot, perhaps that's the issue? Or maybe the instructions are mistaken and you need to mount it as sdx1 in that instance?

All just guesses really...

As for grub stuff, you may need to adjust the grub timeout. Have a search for configuring grub2 and you should find info on how to do that. Otherwise you can probably ensure grub is setup to boot off the RAID prior to reboot.

Also it's probably worth reading the comments of that blog post (if you haven't already) as it looks like there may be some relevant stuff there.

Most Likely The VIA Disk Controller

Did notice during the rsync process that there were some data transfer errors. Been looking at the kernel log via dmesg and spotted a few DMA read errors. Looks as though the VIA disk controller has reared its ugly head again. Below is a section from the kernel logs:

 

May 13 19:45:49 fileserver kernel: [170399.540636]          res 51/84:01:80:08:40/84:00:22:00:00/e0 Emask 0x12 (ATA bus error)
May 13 19:45:49 fileserver kernel: [170399.540642] ata3.00: status: { DRDY ERR }
May 13 19:45:49 fileserver kernel: [170399.540647] ata3.00: error: { ICRC ABRT }
May 13 19:45:49 fileserver kernel: [170399.540660] ata3: hard resetting link
May 13 19:45:50 fileserver kernel: [170399.860064] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
May 13 19:45:50 fileserver kernel: [170399.877391] ata3.00: configured for UDMA/33
May 13 19:45:50 fileserver kernel: [170399.877412] ata3: EH complete
May 13 21:44:07 fileserver kernel: [177497.597939] FAT: bogus number of reserved sectors
May 13 21:44:07 fileserver kernel: [177497.597948] VFS: Can't find a valid FAT filesystem on dev md1.
May 13 21:44:07 fileserver kernel: [177497.598204] qnx4: wrong fsid in superblock.
May 13 21:45:05 fileserver kernel: [177555.000308] ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x100000 action 0x6 frozen
May 13 21:45:05 fileserver kernel: [177555.000318] ata3: SError: { Dispar }
May 13 21:45:05 fileserver kernel: [177555.000326] ata3.00: failed command: READ DMA
May 13 21:45:05 fileserver kernel: [177555.000339] ata3.00: cmd c8/00:00:48:19:06/00:00:00:00:00/e6 tag 0 dma 131072 in
May 13 21:45:05 fileserver kernel: [177555.000342]          res 40/00:01:80:08:40/84:00:22:00:00/e0 Emask 0x4 (timeout)
May 13 21:45:05 fileserver kernel: [177555.000348] ata3.00: status: { DRDY }
May 13 21:45:05 fileserver kernel: [177555.000360] ata3: hard resetting link
May 13 21:45:05 fileserver kernel: [177555.320058] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
May 13 21:45:05 fileserver kernel: [177555.337126] ata3.00: configured for UDMA/33
May 13 21:45:05 fileserver kernel: [177555.337148] ata3: EH complete


Jeremy's picture

Definitely something wrong

Also is it reporting as FAT too!? Or is that another drive?

Two SATA Disks - RAID 1 With Ext4

Puzzled with the FAT message, absolutely bizarre. None of the SATA drives contain a FAT filesystem. Both drives contain the same partition table and use the same file systems, Ext4 and Swap.


Jeremy's picture

All seems very strange...

And TBH I'm out of ideas. Perhaps it's worth posting on the Ubuntu forums? Hopefully someone with more knowledge than me can help you out.

Or on another tangent, perhaps you could investigate mirroring via LVM instead of using RAID? I know it's possible but I've never done it.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)