This is a redo of the previous post, with which a had a few annoying problems.
First, the symbolic links in /opt/lib on NTFS were broken on next boot (converted into plain files) generating the "file too short" errors when running ipkg command - a fix I guess would be to duplicate the .so libraries to replace the symlinks.
Then later I ran into a very odd issue with Subversion, where the repository created on NTFS would be seen as corrupted. Creating a repository temporarily in /tmp would verify ok, moving it to NTFS would have the error again.
While here, we will also prepare a shutdown script to un-mount and disconnect the loop device.
First, the symbolic links in /opt/lib on NTFS were broken on next boot (converted into plain files) generating the "file too short" errors when running ipkg command - a fix I guess would be to duplicate the .so libraries to replace the symlinks.
Then later I ran into a very odd issue with Subversion, where the repository created on NTFS would be seen as corrupted. Creating a repository temporarily in /tmp would verify ok, moving it to NTFS would have the error again.
bash-3.2# cd /home/system/GoFlex\ Home\ Personal/tmp/ bash-3.2# svnadmin create test bash-3.2# svnadmin verify test svnadmin: E160004: Corrupt node-revision '0.0.r0/17' svnadmin: E160004: Missing cpath field in node-rev '0.0.r0/17'Although I don't feel too comfortable with the complexity of the new setup, we will follow the good work done on OpenStora Forums (here), where pippone is suggesting to use a Linux partition image on the HDD and mount it as a loop device. So here we go...
* * *
Create Linux partition image
We will create a 1GB image (to hold /opt and the SVN files later on) - this will be visible through \\goflex_home\GoFlex Home Personal (system account), although when mounted it will be in use so you won't be able to delete it by accident. If you want to hide it, start the filename with a dot (.).
bash-3.2# cd /home/system/GoFlex\ Home\ Personal/ bash-3.2# dd if=/dev/zero of=ext3_linux_partition.img bs=4k count=256000 256000+0 records in 256000+0 records out 1048576000 bytes (1.0 GB) copied, 15.6834 seconds, 66.9 MB/s bash-3.2# losetup /dev/loop0 "`pwd`/ext3_linux_partition.img" bash-3.2# losetup -a /dev/loop0: [0800]:15206 (/home/system/GoFlex Home Personal/ext3_linux_partition.img) bash-3.2# mkfs.ext3 /dev/loop0 mke2fs 1.39 (29-May-2006) [...] bash-3.2# mkdir /home/0loop0 bash-3.2# mount /dev/loop0 /home/0loop0/ bash-3.2# df -h /home/0loop0 Filesystem Size Used Avail Use% Mounted on /dev/loop0 985M 18M 917M 2% /home/0loop0 bash-3.2# ls -la /home/0loop0 total 20 drwxr-xr-x 4 root root 4096 May 18 18:37 . drwxr-xr-x 14 root root 1024 May 18 17:39 .. drwx------ 2 root root 16384 May 18 17:35 lost+foundWhat we did so far was to create the partition image, setup it up as a loop device and mount it into /home/0loop0. This is not permanent, the mount will be lost with the next boot.
Persisting the changes
To make this permanent, the same thread is suggesting to change the /etc/init.d/eo-bootfinish script. But on a second look, the start and stop sections allow for additional external scripts, and that's where we're going to create them. I've named the script with a digit prefix so we can control the order in which they are running - later on we are going to add a command to start svnserve and we want to make sure the partition is mount first.
bash-3.2# cd /etc/oe-initscripts/oe-bootfinish/start.d/ bash-3.2# cat > 0_loop0 << EOL losetup /dev/loop0 "/home/system/GoFlex Home Personal/ext3_linux_partition.img" mount /dev/loop0 /home/0loop0/ EOL bash-3.2# cat 0_loop0 losetup /dev/loop0 "/home/system/GoFlex Home Personal/ext3_linux_partition.img" mount /dev/loop0 /home/0loop0/ bash-3.2# chmod a+x 0_loop0
Issue a reboot and check it once back on:
bash-3.2# df -h /home/0loop0 Filesystem Size Used Avail Use% Mounted on /dev/loop0 985M 18M 917M 2% /home/0loop0
While here, we will also prepare a shutdown script to un-mount and disconnect the loop device.
bash-3.2# cd /etc/oe-initscripts/oe-bootfinish/stop.d/ bash-3.2# cat > 9_loop0 <<EOL umount /home/0loop0 losetup -d /dev/loop0 EOL bash-3.2# cat 9_loop0 umount /home/0loop0 losetup -d /dev/loop0 bash-3.2# chmod a+x 9_loop0
Try running it directly to see if it does the job (/home/0loop0 is now the original directory on NAND, the mount is gone, notice Filesystem value):
bash-3.2# /etc/oe-initscripts/oe-bootfinish/stop.d/9_loop0 bash-3.2# df -h /home/0loop0 Filesystem Size Used Avail Use% Mounted on ubi0:rootfs 212M 161M 51M 77% /
Relocate /opt to external partition image
bash-3.2# df -h /opt Filesystem Size Used Avail Use% Mounted on ubi0:rootfs 212M 161M 51M 77% / bash-3.2# mv /opt/ /home/0loop0/ bash-3.2# ln -sv /home/0loop0/opt/ /opt create symbolic link `/opt' to `/home/0loop0/opt/' bash-3.2# df -h /opt Filesystem Size Used Avail Use% Mounted on /dev/loop0 985M 18M 917M 2% /home/0loop0
Installing the package manager (finally...)
bash-3.2# cd /opt bash-3.2# wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ipkg-opt_0.99.163-10_arm.ipk [...] 18:41:31 (80.4 KB/s) - `ipkg-opt_0.99.163-10_arm.ipk' saved [74474/74474] bash-3.2# tar xvf ipkg-opt_0.99.163-10_arm.ipk ./debian-binary ./data.tar.gz ./control.tar.gz bash-3.2# tar xvf data.tar.gz ./ ./opt/ [...] bash-3.2# rm control.tar.gz data.tar.gz debian-binary ipkg-opt_0.99.163-10_arm.ipk bash-3.2# mv opt/* . bash-3.2# rmdir opt bash-3.2# ls /opt bin etc lib share bash-3.2# /opt/bin/ipkg -version ipkg version 0.99.163 bash-3.2# echo src cs08q1armel http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable >> /opt/etc/ipkg.conf bash-3.2# /opt/bin/ipkg update Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/Packages Updated list of available packages in /opt/lib/ipkg/lists/cs08q1armel Successfully terminated.
Hi Dan Dar3, I previously tried pippone's approach but never got as far as mounting the file as a loop device. If the ext3_linux_partition.img file is on an NTFS system then losetup fails. It throws a 'ioctl: LOOP_SET_FD: Invalid argument' error.
ReplyDeleteHow did you get around that?
Hi Conor,
ReplyDeleteI haven't done anything special, maybe we have different versions of the product (?) - the external disk seems to be mounted as UFSD.
About GoFlex Home (web interface, bottom-left)
2.7.1-391
# uname -a
Linux axentraserver.xyz.seagateshare.com 2.6.22.18 #14 Wed Oct 27 15:41:03 EDT 2010 armv5tejl armv5tejl armv5tejl GNU/Linux
# mount | grep system | grep Personal
/dev/sda on /home/system/GoFlex Home Personal type ufsd (rw,nls=utf8,uid=48,gid=100,fmask=0,dmask=0,force)
Hi Dan,
ReplyDeletethanks - the problem was that my disks weren't mounted. We have the same product and your instructions have worked beautifully.
Thanks Conor, glad to hear it worked out!
ReplyDeleteEverything goes smoothly until the final step of the section on relocating /opt to the external partition image.
ReplyDeleteInstead of 'df -h /opt' outputting:
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 985M 18M 917M 2% /home/0loop0
It outputs this instead:
Filesystem Size Used Avail Use% Mounted on
ubi0:rootfs 212M 162M 50M 77% /
Until this time all commands have returned the output shown in your tutorial.
'/home/0loop0/' now contains '/opt' and 'ls -F /' shows that it's link exists.
'uname -a' shows we have the same firmware.
I don't know what to check next, do you have any advice?
Ok, this is the part with relocating /opt. You've confirmed that /opt was moved to /home/0loop0, I think there might be a problem with the link. Instead of using 'ls -F /' use 'ls -ld /opt' to actually see where it's pointing. Does it error if you 'cd /opt'?
Delete'ls -ld /opt' produces:
Deletelrwxrwxrwx 1 root root 17 May 28 16:04 /opt -> /home/0loop0/opt/
Nope, the link worked:
root@axentraserver:/# cd /opt
root@axentraserver:/opt#
Thanks for the quick reply Dan!
That sounds odd - I guess easiest thing would be to doubt df following links, so maybe check with 'df -h .' in both /opt and /home/0loop0/opt/, do they give you the same result? ubi0, 212M size and 50 MB free? Cause if both do the same, it's probably because you missed some of the earlier steps or didn't work as expected. /dev/loop0 should be associated with the image file on HDD (/dev/sda0) and mounted into /home/0loop0/. Did you manually create '/home/system/GoFlex\ Home\ Personal/' or have you created the 'system' account through the web interface?
DeleteThose did give me the same result (212M size and 50 MB free).
DeleteTo check I started the process all over again:
http://pastebin.com/uPHEizCG
I didn't follow the steps in the original tutorial first, I just started with this one.
I didn't manually create those directories, they were created when I set up the 'Administrator'-type account when I first got the device.
Thanks for sending the paste, I think I know where the problem is, and it's my fault how I wrote it in the article. I went into talking about the stop script right after the start script and told you to test it too soon, which will unmount the loop device, and didn't mention that you will need to start it again with the other script or simply restart the device from the web interface. Without that /home/0loop0/ is unmounted and it's looking at the flash. I will change the article to say to restart the device and to check that image is mounted first (although I hate going back and doing that in the Blogger post editor :-) Hope it fixes your problem though.
DeleteYIIEEWWW!!
DeleteAfter running the startup script it worked exactly as it should!
I've wanted to get this thing configured this way for YEARS!
Thank you very much Dan, I really appreciate your assistance!
Glad it worked, Gordon, enjoy! :-)
Deletehi Dan,
ReplyDeletei'm facing an error after this command
/opt/bin/ipkg -version
-bash: /opt/bin/ipkg: cannot execute binary file: Exec format error
i'm stuck here.
Let's try getting some more information out of your system, can you please run these commands and reply with their outputs:
Delete# uname -a
# ls -ld /opt/bin/ipkg
# file /opt/bin/ipkg
Hello,
ReplyDeleteNow the source of OpenStora is available here : https://github.com/Sigri44/OpenStora
Thanks :)
Smart, it's a crucial community resource, so that's excellent!
DeleteHi Sigri44,
DeleteThank you for saving it and for letting us know!