Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

mounting a spare flash drive.

Featured Replies

Hi,

 

I recently added a second USB Flash drive on the server to serve as my webserver location.

 

I thought it would be simple to mount it but it's giving me problems.

 

First thing I did was check the device name, it's sdg.

 

I formatted it reiserfs and typed the following;

 

mkdir /mnt/www

mount /dev/sdg1 /mnt/www

 

I test it and it works just fine. I can access all of the files and everything is working great.

 

The next thing I did was add the lines above in my go script;

 

top of the script is;

 

# Start the Management Utility
/usr/local/sbin/emhttp &

#sleep
sleep 300

#########MOUNTING USB FLASH########
mkdir /mnt/www
mount /dev/sdg1 /mnt/www
#######END MOUNTING USB FLASH#####
.......

 

What it does instead though is mount my UNRAID flash drive, sure enough I check the the USB Flash changed from SDG to SDF... So i made the adjustments and restarted... same problem, the flash drive moved back to SDG...

 

I was under the impression that a device will not change "dev" is it's not physically moved... How can I adjust my "go" script to ensure that the spare flash drive will always be mounted?

 

thanks

 

Give the flash drive a label (like your boot drive called UNRAID) and use the label to mount the drive to the correct place.

You are not correct in that the devices "never" change, they do, especially if you plug in new hardware.  They can change from one boot to another based on which device presents itself first to the OS.  It is exactly that reason why unRAID used the volume label of "UNRAID"

 

You can never assume ANY disk is /dev/sda, /dev/sdb, etc..  Plugging in (or un-plugging) a new disk could change all the disks assigned devices, including your hard disks.

 

When mounting the drive you might also want to specify a few options to keep it from wearing out earlier than otherwise from "reading" it, since reading anything on the drive, including accessing directories will actually write the affiliated "access time".  There will be many more "writes" to the drive than you might think and since flash drives have a finite number of writes before they wear out, you'll find yourself with a failed drive earlier than you might otherwise.

 

Something like this:

mkdir /mnt/www

mount -t vfat -o noatime,nodiratime /dev/disk/by-label/YOUR_LABEL /mnt/www

 

Joe L.

  • Author

beautiful;

 

reiserfstune -l WWW /dev/sdg1

changed my go to:

mkdir /mnt/www
mount /dev/disk/by-label/WWW /mnt/www

 

Rebooting the server, keeping my fingers crossed :)

  • Author

Hey Joe,

 

thanks for that modification, it will help preserve my flash stick just a little bit longer.

 

I do have another unrelated question you might be able to help me with.

 

Essentially, i'd like to setup a cron job to copy the contents of the flash drive on to the unraid folder.

 

i have never worked with cron before and i'd also like to ensure that it is there after every reboot. How can I go about it?

 

For example I want to copy the contents of /mnt/www to /mnt/user/stuff/flash.backup every night.

Hey Joe,

 

thanks for that modification, it will help preserve my flash stick just a little bit longer.

 

I do have another unrelated question you might be able to help me with.

 

Essentially, i'd like to setup a cron job to copy the contents of the flash drive on to the unraid folder.

 

i have never worked with cron before and i'd also like to ensure that it is there after every reboot. How can I go about it?

 

For example I want to copy the contents of /mnt/www to /mnt/user/stuff/flash.backup every night.

Easier than you might think

 

Put two lines like this at the end of your "config/go" script.

echo "test -d /mnt/user/stuff/flash.backup && cp -R /mnt/www /mnt/user/stuff/flash.backup" >/etc/cron.daily/copy_www.sh

chmod +x /etc/cron.daily/copy_www.sh

 

executable scripts in /etc/cron.daily are run once per day at 4:40AM

 

You'll need to make sure /mnt/user/stuff/flash.backup exists as a directory of course.

 

Joe L

  • Author

Hey Joe,

 

thanks for that modification, it will help preserve my flash stick just a little bit longer.

 

I do have another unrelated question you might be able to help me with.

 

Essentially, i'd like to setup a cron job to copy the contents of the flash drive on to the unraid folder.

 

i have never worked with cron before and i'd also like to ensure that it is there after every reboot. How can I go about it?

 

For example I want to copy the contents of /mnt/www to /mnt/user/stuff/flash.backup every night.

Easier than you might think

 

Put two lines like this at the end of your "config/go" script.

echo "test -d /mnt/user/stuff/flash.backup && cp -R /mnt/www /mnt/user/stuff/flash.backup" >/etc/cron.daily/copy_www.sh

chmod +x /etc/cron.daily/copy_www.sh

 

executable scripts in /etc/cron.daily are run once per day at 4:40AM

 

You'll need to make sure /mnt/user/stuff/flash.backup exists as a directory of course.

 

Joe L

 

Great! thanks, it was simple enough. I tested it and it worked fine.

 

Since there is also a session folder in there that gets files deleted/updated I just updated the cron file to an rsync;

 

rsync -a --delete-after /mnt/www/ /mnt/user/stuff/BCKUP/

 

the test runs proved to go much faster and i'm fairly certain the cron will get it done. I'll wait till tonight and find out

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.