[SOLVED] Installed to SSD; license file on a USB drive?


Recommended Posts

I have unRAID installed to an SSD just fine. I installed the drive in my windows computer, booted, copied the files to it, and ran make_bootable.bat with the -f flag. Easy-peasy. What I'd like to know is how I can go about purchasing a license while unRAID is installed this way. Can I mount the flash drive with the license file on it somehow? I love the speed and capacity I get from installing it to a real hard drive.

 

Edit! Here's how to do it:

To be honest, as much as I like unRAID, I'm not a fan of the licensing scheme. It works pretty well, but the issue of worn out/dead flash drives bothers me. Sure, not many people have had problems, but I don't want to add my name to that list. I also like the speed of reading and writing to an SSD. Boot times are noticeably faster, if only by a few seconds. Thus I was left with finding a way to have a registered USB thumbdrive, but load the OS from the SSD. Here is my saga...

 

There have been some posts on doing this another way, but after trying it, I wasn't happy. It still saved user passwords to the thumbdrive and not the SSD, and probably some other things I didn't notice.  The reason is that before you ever get a chance to have your /boot/config/go script run, unRAID has already copied things from /boot/config/, like user accounts, the root password, etc. There is only one way around this. Modify the startup scripts to swap out /boot/config from the thumbdrive with the one from your SSD, BEFORE unRAID has copied anything from it.

 

You have to make a custom bzroot image in order for this to work correctly. Using the info from this post, I modified the /etc/rc.d/rc.M script to move /boot/config (which belongs to whichever drive is installed in your system and labeled 'UNRAID') to /licflash, and then mount the SSD to /boot. Then I repacked everything back up in to a bzroot image, popped it on my SSD in place of the stock one, and enjoyed having my registered version of unRAID load from an SSD.

 

Step by step:

 

Download the cpio package from here and save it to your computer. Stick your thumbdrive with a fresh unRAID install on it and boot it up. Browse to your flash share and copy the package file there. You might also want to get vim as well, to make file editing easier. I tried nano but something was broken. vim worked right away.

 

ssh or telnet in to your unRAID installation. and install the cpio package.

 

cd /boot
installpkg cpio-2.5-i486-3.tgz

 

Now we need to make a directory to work in. I didn't want to actually use a hard drive for this, and since this was a stock unRAID install on the thumbdrive, it didn't start my array because it didn't see the disks assigned.

mkdir /mnt/disk1
mkdir /mnt/disk1/bz-mod
cd /mnt/disk1/bz-mod

 

Uncompress the stock filesystem image...

 

zcat /boot/bzroot | cpio -i -d -H newc --no-absolute-filenames

 

...and install cpio to it. You dont HAVE to, but if you decided to further modify your custom image later, you wont need to re-install cpio. I would also install vim again, because it gets used a lot if you like to tweak things. At this point you could also install any other packages you want to be permanently installed. As stated in the link above, the ROOT= line is important, we want the package installed in to what will eventually end up as our bzroot image again, in this case everything in /mnt/disk1/bz-mod

ROOT=/mnt/disk1/bz-mod installpkg /boot/cpio-2.5-i486-3

 

This is where it gets fun. Using your preffered text editor, open up /etc/rc.d/rc.M and add this to the beginning:

 

mkdir /licflash
mount --move /boot /licflash
mount -o noatime,nodiratime,umask=0,shortname=mixed -t vfat /dev/disk/by-label/FLASH /boot

 

You also need to comment out this line. As far as I can tell, /etc/fstab doesn't ever change, so you shouldn't need this here. If I'm wrong someone please let me know where I can see fstab being dynamically updated at boot so I can adjust my strategy. Thanks :)

 

make this:

 

# Mount any additional filesystem types that haven't already been mounted:
mount -a -v 2> /dev/null | grep -v "already mounted"

 

look like this, by commenting the second line. It is a little ways down the rc.M script:

 

# Mount any additional filesystem types that haven't already been mounted:
#mount -a -v 2> /dev/null | grep -v "already mounted"

 

This is assuming you have your SSD (or whatever you want to boot the OS from) labeled as FLASH. You licensed thumbdrive has to be labeled UNRAID, so it cant be that. FLASH seems good to me :)

 

Save that file and it's time to put everything back in to a single image.

 

cd /mnt/disk1/bz-mod
find . | cpio -o -H newc | gzip > /boot/test.gz
sync

 

you should have test.gz in your /boot directory. Copy it over to your SSD. You can either pull it off the tower/flash share on to another computer, then put it on the SSD that way, or mount your SSD like this:

 

mkdir /ssd
mount /dev/disk/by-label/FLASH /ssd
cp /boot/test/gz /ssd

 

You want your test.gz file to replace the stock bzroot file from the unRAID installation you download and extract to your thumbdrive. Rename the stock one, and then rename yours to bzroot.

 

mv bzroot bzroot.bak
mv test.gz bzroot

 

You should be good to go now. unRAID will boot from SSD and automatically mount your thumbdrive labeled 'UNRAID' at /boot. The modification you made to the /etc/rc.d/rc.M script will move the thumbdrive from /boot to /licflash, and mount your SSD drive at /boot. unRAID will then continue loading. Make sure to put a copy of your key file in the /boot/config folder on your SSD. Any changes made to your system will be made on the SSD and not on the flash. The best part is you don't even need anything on your thumbdrive! It just needs to be installed in the system and have the label of 'UNRAID' It doesn't get any easier than that on that poor old flash chip :)

Link to comment

While it boots from the ssd, once it is done expanding the files to ram, it will mount the USB flash drive . It will then look for a licence key on the flash drive. It will still save all the configuration files on the flash disk

I am actually doing this on my esxi box with a 8gig virtual drive on my ssd.

 

While the boot is fast, you won't get any performance boost.

It would make more sence to use the ssd for a cache drive.

Otherwise it is honestly a waste of a good ssd IMO.

 

I don't reboot my server enough to care about 12 seconds instead of 45 seconds.

Updating the ssd will be intresting also when you update unraid versions

Link to comment

See this thread.

I am hoping to use a SSD for /boot myself.

http://lime-technology.com/forum/index.php?topic=3846.msg34151#msg34151

 

Another choice if you decide is to use the SSD as a cache or APPS drive.

 

grub4dos can actually boot from a reiserfs drive, so you would not need syslinux on a FAT/FAT32 FS anymore.

 

Another option is to put multiple partitions on the SSD with partition 1 being reiserfs for the cache and another partition being FAT/FAT32 for the syslinux boot.

 

At the very least booting will be faster, but any access to the USB key would be at that speed.

Link to comment

I tried that. Booted from thumbdrive, moved /boot and mounted the ssd, ran the go script. Unraid started up as being unlicensed :(

I think you may boot from either flash drive.  The one LABELED as UNRAID must have GUID referenced in the key file.  It is normally mounted at /boot.  You can move it and mount another as illustrated in the other thread.  The other drive, the one you will be using for everyday reads/writes must have a different label.

 

The /boot/config directory must have the .key file itself.  (although I think it can also be at /boot )

 

Edit: for clarification.

Link to comment

The licensed drive is labeled unraid and the ssd is flash. I even tri booting the licensed drive, manually moving /boot to /licflash, then mounting the ssd at /boot and running emhttp. No dice. Any idea how or at what point unraid looks for the key file?

as far as I know, as it is starting emhttp.    The .key file must be in /boot/config, (although I think it also looks in /boot if it does not find one in /boot/config)

The corresponding GUID must exist for the USB drive labeled UNRAID (all capital letters)

Link to comment

Possibly, but I would think that might upset things, since the configs are stored in /boot/config. I could swear I literally single stepped through what those scripts do manually without getting it to work, but I'm going to try doing just that once I get home tonight to make sure.

Link to comment

Got it all figured out. Had to tweak the bzroot image but all is well. I don't even have any files on my thumbdrive. It's just labeled 'UNRAID' and sits in the system completely un-used  8)

 

Details in first post.

Congratulations on getting everything figured out.

 

Tis a lot of work to go through for little (in my opinion) benefit.  Unless you are planning on running a full slackware build of unRAID I don't see the point in trying to do this.  Once unRAID loads it is in RAM, save for a few writes to the flash for share updates and shutdown.

Link to comment

I see a benefit in not having to write to the /boot thumb drive for extra packages.

Then you can store logs and other files on the new /boot area without having to worry about ruining your flash.

 

the super.dat is updated everytime you stop and start the array.

if it were the only file being updated, then the flash would last a pretty long time.

But with all the new enhancements we bring along, the flash can wear out.

 

I've had to sd cards weer out in my unraid setups over the years.

 

Ideally I would like for a flash drive guid to be present in the system and not require /boot to be mounted on it.

Then we can do things like CF on P-ATA port or SSD on SATA port.

 

Perhaps this could be made an option with a syslinux command line boot parameter.

Link to comment

I see a benefit in not having to write to the /boot thumb drive for extra packages.

Then you can store logs and other files on the new /boot area without having to worry about ruining your flash.

 

the super.dat is updated everytime you stop and start the array.

if it were the only file being updated, then the flash would last a pretty long time.

But with all the new enhancements we bring along, the flash can wear out.

 

I've had to sd cards weer out in my unraid setups over the years.

 

Ideally I would like for a flash drive guid to be present in the system and not require /boot to be mounted on it.

Then we can do things like CF on P-ATA port or SSD on SATA port.

 

Perhaps this could be made an option with a syslinux command line boot parameter.

 

This! This is basically why I did what I did, and how it works now. It's not that involved to modify a new image when it comes out either, thankfully.

Link to comment
I see a benefit in not having to write to the /boot thumb drive for extra packages.

Then you can store logs and other files on the new /boot area without having to worry about ruining your flash.

 

the super.dat is updated everytime you stop and start the array.

if it were the only file being updated, then the flash would last a pretty long time.

But with all the new enhancements we bring along, the flash can wear out.

 

I've had to sd cards weer out in my unraid setups over the years.

 

Ideally I would like for a flash drive guid to be present in the system and not require /boot to be mounted on it.

Then we can do things like CF on P-ATA port or SSD on SATA port.

 

Perhaps this could be made an option with a syslinux command line boot parameter.

 

I'm pretty sure the moving of the mount point of the UNRAID flash drive ends up doing. 

 

True the UNRAID flash gets read to run the go script, but after it transfers control to the go2 script on the FLASH, it nothing more happens to it - you could probably unmount it at that point. 

 

I just checked mine, and no files have been modified since 2009.  The benefit is you don't have to repackage anything, just drop new versions on the FLASH (booting) drive.  Although I haven't tried with version 5, so perhaps that breaks it.

 

Anyways, it's great to have another cleaner method.  Thanks for the write up.

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.