brantje

[idea] Update usb stick while running

Recommended Posts

I was thinking, since the usb stick is only used at boot, we could make a script to flash it from within xpenology/dsm.

 

Something like

wget http://example.org/xpenology-latest.img
< code to find the usb stick here >

dd if=xpenology-latest.img of=/dev/

Any ideas?

Share this post


Link to post
Share on other sites

I tried to "live" update my USB stick this morning by unmounting it and using dd to write the .img, but it didn't boot.

Share this post


Link to post
Share on other sites

I have used 'live' updating. I simply extracted the iso to the individual files and overwrite everything on the USB stick, for whatever reason that worked fine and allowed me to boot with DSM 5.2... So far I haven't found anything wrong with that method and I've already asked elsewhere if this will cause trouble and nothing yet.

Share this post


Link to post
Share on other sites

I have had issues with booting after attempting to write the image with dd.

This should work, so I must have done something wrong.

I haven't found a definite answer on exactly what to write to...

dd if=xpenology-latest.img of=/dev/sdg

or

dd if=xpenology-latest.img of=/dev/sdg1

using the comand:

fdisk -l

and searching for FAT16 I think would work for determining the boot partition of the USB stick

Searching the lines above it for "MB" would qualify as a secondary confirmation that this is a small partition.

if the 8011 size is a constant, you could throw that in to the search, too. I don't trust that will remain a constant.

The search should not stop on the first occurrence, just in case someone has more than one small USB drive attached, but should return a list of the likely candidates that someone can use on the command line for the next run to complete the update. which goes back to my question. is it /dev/sdX or /dev/sdX1 for the destination (your X may vary)

Please post your script when complete. I may work on a basic one this weekend, since I hate having to take my box apart to pull the stick for the update. Also don't like having it plugged in on the outside, so a script would be a good solution.

 

There may be other commands you can use to determine the correct volume (Like using "ls" on the matched volumes found by "fdisk -l" filtered for "FAT16" and "MB" to find xpenoboot files)

 

my fdisk -l returns this: (truncated to the relevant partitions)

Disk /dev/sdg: 8011 MB, 8011120640 bytes
4 heads, 32 sectors/track, 122240 cylinders
Units = cylinders of 128 * 512 = 65536 bytes

  Device Boot      Start         End      Blocks  Id System
/dev/sdg1   *           1         256       16352+  e Win95 FAT16 (LBA)

Share this post


Link to post
Share on other sites

A little off-topic, but USB related :

Can I install and run xpenology from a USB stick? like boot from an USB stick and install to another (16 or 32 Gb) USB stick. Just curious, not sure about the utility oh this.

Share this post


Link to post
Share on other sites
A little off-topic, but USB related :

Can I install and run xpenology from a USB stick? like boot from an USB stick and install to another (16 or 32 Gb) USB stick. Just curious, not sure about the utility oh this.

 

Getting onto the second USB stick might be a problem if the installer doesn't see it as a usable destination.

Having said that, if you have an old hard small hard drive (40GB-120GB) that you can install it to, you may be able to use dd to copy it to a USB drive, but you will likely have to edit which drives are marked as 'internal' and 'external' by DSM. Search for topics on hiding the USB drive from DSM or changing ESATA from being seen as external, and that will get you in the ballpark for what you need to do.

 

Best case, you may not need to do any of that. It will have to be a separate thumb drive. DSM wont let you install into all that unused partition space on your USB drive. I can see this being useful as a mini-appliance that has low storage requirements, and low energy foot print requirements.

Share this post


Link to post
Share on other sites