![]() |
SlugOS.TurnupToRAID HistoryHide minor edits - Show changes to markup March 08, 2009, at 05:31 PM
by --
Deleted line 142:
March 08, 2009, at 05:16 PM
by -- Final cleanups.
Changed lines 216-217 from:
After reconnecting the missing device, the data on it is outdated, and needs to be updated. We use mdadm to do tell the kernel to begin that process. First, we use the "dmesg" command to figure out what the device name is (it may not be /dev/sdb1, as it originally was since the kernel can assign any device name it wishes): to:
After reconnecting the missing device, the data on it is outdated, and needs to be updated. We use mdadm to tell the kernel to begin that process. First, we use the "dmesg" command to figure out what the device name is (it may not be /dev/sdb1, as it originally was since the kernel can assign any device name it wishes): Changed line 264 from:
to:
Don't worry about the fact that /proc/mdstat still lists sdb1 as a failed member of the array; that will be cleaned up at the next reboot. March 08, 2009, at 05:12 PM
by --
Changed line 105 from:
to:
Changed line 143 from:
to:
Changed lines 182-183 from:
The easiest way to check on the health of your RAID storage is to look at the contents of /proc/mdstat: to:
The easiest way to check on the health of your RAID storage is to look at the contents of /proc/mdstat. This is the normal, steady-state (note the "UU"): Changed line 188 from:
to:
Added lines 199-264:
Here's what it looks like when the cat has played with the USB cables, and one of the two USB storage devices is completely disconnected: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) # cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[2](F)
124544 blocks [2/1] [U_]
unused devices: <none>
#
(:tableend:) After reconnecting the missing device, the data on it is outdated, and needs to be updated. We use mdadm to do tell the kernel to begin that process. First, we use the "dmesg" command to figure out what the device name is (it may not be /dev/sdb1, as it originally was since the kernel can assign any device name it wishes): (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) # dmesg | tail -16usb 1-2: configuration #1 chosen from 1 choice scsi2 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 4 usb-storage: waiting for device to settle before scanning scsi 2:0:0:0: Direct-Access I-Stick2 IntelligentStick 2.00 PQ: 0 ANSI: 2 ready sd 2:0:0:0: [sdc] 249344 512-byte hardware sectors (128 MB) sd 2:0:0:0: [sdc] Write Protect is off sd 2:0:0:0: [sdc] Mode Sense: 03 00 00 00 sd 2:0:0:0: [sdc] Assuming drive cache: write through sd 2:0:0:0: [sdc] 249344 512-byte hardware sectors (128 MB) sd 2:0:0:0: [sdc] Write Protect is off sd 2:0:0:0: [sdc] Mode Sense: 03 00 00 00 sd 2:0:0:0: [sdc] Assuming drive cache: write through sdc: sdc1 sd 2:0:0:0: [sdc] Attached SCSI removable disk usb-storage: device scan complete # mdadm /dev/md0 --add /dev/sdc1mdadm: re-added /dev/sdc1 # cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[2] sda1[0] sdb1[3](F)
124544 blocks [2/1] [U_]
[====>................] recovery = 22.9% (28800/124544) finish=0.2min speed=7200K/sec
unused devices: <none>
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sda1[0] sdb1[2](F)
124544 blocks [2/2] [UU]
unused devices: <none>
#
(:tableend:) March 08, 2009, at 04:52 PM
by --
Deleted line 138:
March 08, 2009, at 04:51 PM
by --
Changed lines 76-77 from:
Use the mdadm command to create the metafisk (/dev/md<n>) device. Basically the mdadm command will write a signature to the two partitions we give it that mark the partitions as members of a metadisk, then creates the necessary in-kernel medadisk device. We will then be able to work with the metadisk device. to:
Use the mdadm command to create the metadisk (/dev/md<n>) device. Basically the mdadm command will write a signature to the two partitions we give it that mark the partitions as members of a metadisk, then creates the necessary in-kernel medadisk device. We will then be able to work with the metadisk device. Added line 135:
Added line 137:
Added line 139:
March 08, 2009, at 04:49 PM
by -- continued
Changed lines 131-137 from:
How is it Doing?The easiest way to check on the health of your RAID storage is to look at the contents of /proc/md (:table border=0 width=80% bgcolor=#ddeedd:)
(:cell:)
to:
TurnupDoing the turnup operation is slightly complicated by a bug in the busybox mount command. Cut and paste the following command exactly as it appears, in order to create a patched copy of the turnup utility that will "dodge" the busybox bug: Added line 135:
sed s/' UUID="$uuid" '/' "$device" '/ </sbin/turnup >/tmp/turnup-patched Added lines 137-152:
Then in order to do the turnup, run the patched version instead, as illustrated below: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# mount# sed s/' UUID="$uuid" '/' "$device" '/ </sbin/turnup >/tmp/turnup-patched# sh /tmp/turnup-patched memstick -i /dev/md0/tmp/turnup-patched: umounting any existing mount of /dev/mtdblock4 turnup: copying root file system 17159 blocks done rootdir=/tmp/rootfs.1285 table='/tmp/flashdisk.1285/etc/device_table' # Changed lines 155-194 from:
to:
Reboot. Once you hear the three-beeps indicating that the boot is complete, login and verify that the root ("/") is mounted on /dev/md0: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) # mountrootfs on / type rootfs (rw) /dev/root on /initrd type jffs2 (ro) /dev/md0 on / type ext3 (rw,noatime,errors=continue,data=ordered) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) /dev/md0 on /dev/.static/dev type ext3 (rw,noatime,errors=continue,data=ordered) udev on /dev type tmpfs (rw,size=2048k,mode=755) tmpfs on /var/volatile type tmpfs (rw,mode=755) tmpfs on /dev/shm type tmpfs (rw,mode=777) usbfs on /proc/bus/usb type usbfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) # (:tableend:) How is it Doing?The easiest way to check on the health of your RAID storage is to look at the contents of /proc/mdstat: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
124544 blocks [2/2] [UU]
unused devices: <none>
#
(:tableend:) March 08, 2009, at 04:38 PM
by --
Changed lines 99-100 from:
Write the New Filesystem and Turnupto:
Write the New FilesystemMarch 08, 2009, at 03:15 PM
by --
Changed lines 82-83 from:
to:
March 08, 2009, at 03:14 PM
by --
Changed lines 82-83 from:
@@# '''mdadm --create --auto=yes /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1'''@@\\ to:
March 08, 2009, at 03:14 PM
by --
Deleted lines 81-82:
March 08, 2009, at 03:13 PM
by --
Changed line 41 from:
to:
Changed lines 56-58 from:
to:
Changed line 70 from:
root@frankenslug:~# to:
Changed line 82 from:
to:
Added lines 84-87:
@@# '''mdadm --create --auto=yes /dev/md0 --level=1 --raid-devices=2
/dev/sda1 /dev/sdb1'''@@ Added lines 89-98:
Continue creating array? ymdadm: array /dev/md0 started.
# mdadm --detail --scan >/etc/mdadm.conf# Changed line 107 from:
to:
Added lines 109-129:
mke2fs 1.38 (30-Jun-2005) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 31232 inodes, 124544 blocks 6227 blocks (5.00%) reserved for the super user First data block=1 16 block groups 8192 blocks per group, 8192 fragments per group 1952 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. March 08, 2009, at 03:05 PM
by -- Continue
Changed lines 33-34 from:
For this example, we will be using a pair of similar (but not identical) USB memory sticks. We'll use them as they came from the manufacturer -- meaning a single partition, formatted as FAT or FAT32?. to:
For this example, we will be using a pair of similar (but not identical) USB memory sticks. We'll use them as they came from the manufacturer -- meaning a single partition, formatted as FAT or FAT32. Changed lines 74-77 from:
Create the MetaDisk?Use the mdadm command to create the MetaDisk? (/dev/md<n>) device. Basically the mdadm command will write a signature to the two partitions we give it that mark the partitions as members of a metadisk, then creates the necessary in-kernel medadisk device. We will then be able to work with the metadisk device. to:
Create the MetadiskUse the mdadm command to create the metafisk (/dev/md<n>) device. Basically the mdadm command will write a signature to the two partitions we give it that mark the partitions as members of a metadisk, then creates the necessary in-kernel medadisk device. We will then be able to work with the metadisk device. Added lines 80-109:
(:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# mount(:tableend:) Write the New Filesystem and TurnupNow all that remains is to use the standard mkfs.ext3 utility to initialize the filesystem on the new metadisk, and turnup to it in the normal fashion: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# mount(:tableend:) How is it Doing?The easiest way to check on the health of your RAID storage is to look at the contents of /proc/md (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# mount(:tableend:) March 08, 2009, at 03:01 PM
by --
Changed lines 74-75 from:
Network SetupThe first thing to do is to finish the network setup. The "turnup to:
Create the MetaDisk?Use the mdadm command to create the MetaDisk? (/dev/md<n>) device. Basically the mdadm command will write a signature to the two partitions we give it that mark the partitions as members of a metadisk, then creates the necessary in-kernel medadisk device. We will then be able to work with the metadisk device. It is entirely possible to work with nothing but a set of partitions that are "marked" in this manner; using the correct arguments, mdadm can re-assemble a metadisk by scanning the available storage devices for metadisk components -- and indeed, SlugOS uses this technique as its preferred way to boot. However, certain things are a lot easier if we create a config file for mdadm that describes the setup, in a more-or-less human-readable format. We can actually have mdadm write its own config file after we have created the metadisk. We'll continue with the example: March 08, 2009, at 02:53 PM
by -- Initial Creation
Added lines 1-75:
(:table border=0 width=40% bgcolor=#ddeebb:) (:cell:) This article pertains to:
(:tableend:) This article demonstrates how to setup a simple RAID-1 (mirrored) external rootfs with SlugOS. Prerequisites
Why?Reliability. The primary reason that simple RAID-1 (mirroring) has been provided in the base SlugOS image is so that users concerned about failures of their USB flash-memory stick can rest easily. It is not intended to improve performance. In fact, due to the limitations of the I/O subsystem on the NSLU2, it is expected that using mirroring can be a significant performance drop. Also, it should be noted that RAID-1 is not non-stop technology. It merely protects the data already on the storage devices by having multiple copies; there is no guarantee that a failing device will not fail in a manner that will crash the host operating system. Never-the-less, this solution is simple enough, and storage has become inexpensive enough, that using RAID-1 with SlugOS is likely to become a very common option. Prepare the NSLU2 and Flash the Base FirmwareBegin by removing all USB devices from the NSLU2, and flash a fresh copy of SlugOS using your favorite method. Boot the device, login via ssh, and do the basic network setup using "turnup init" in the normal fashion. See InstallandTurnupABasicSlugOSSystem for details, if necessary. Prepare the External StorageFor this example, we will be using a pair of similar (but not identical) USB memory sticks. We'll use them as they came from the manufacturer -- meaning a single partition, formatted as FAT or FAT32?. To begin, we simply plug both devices into the NSLU2. Make sure you have no other storage devices plugged in -- not only would that be completely unnecessary, it would be error-prone as well. SlugOS will detect the new devices, and you should see both automagically mounted in /media. Step one is to unmount those partitions, as we cannot work with them if they are busy: (:table border=0 width=80% bgcolor=#ddeedd:) (:cell:) root@frankenslug:~# mountrootfs on / type rootfs (rw) /dev/root on / type jffs2 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) /dev/root on /dev/.static/dev type jffs2 (rw) udev on /dev type tmpfs (rw,size=2048k,mode=755) tmpfs on /var/volatile type tmpfs (rw,mode=755) tmpfs on /dev/shm type tmpfs (rw,mode=777) usbfs on /proc/bus/usb type usbfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /media/sda1 type vfat (rw,sync,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8) /dev/sdb1 on /media/sdb1 type vfat (rw,sync,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8) root@frankenslug:~# umount /dev/sda1root@frankenslug:~# umount /dev/sdb1root@frankenslug:~# mountrootfs on / type rootfs (rw) /dev/root on / type jffs2 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) /dev/root on /dev/.static/dev type jffs2 (rw) udev on /dev type tmpfs (rw,size=2048k,mode=755) tmpfs on /var/volatile type tmpfs (rw,mode=755) tmpfs on /dev/shm type tmpfs (rw,mode=777) usbfs on /proc/bus/usb type usbfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) root@frankenslug:~# (:tableend:) Network SetupThe first thing to do is to finish the network setup. The "turnup |