Jump to content


Half Success: Mount SD partition as /usr/local


6 replies to this topic

#1 albkwan

    ExtrEmE User

  • Members
  • 1,440 posts
  • LocationHong Kong

Posted 06 October 2008 - 04:49 PM

Last weekend, I have bought a 16 GB SDHC and I decided to separate it into a few partitions and mount /home and /usr/local on it. After repeated testing and failures, I have managed to find a reasonably easy and decent solution to mount /usr/local. But mounting /home, though successful, lead to system cannot shutdown. So, it is only half success.
[NB. I think the problem is because the partition /home is always busy and cannot be umounted. So, the same will apply to /var - also cannot be mounted if mounted this way.]

I think this should work on any EeePC model, but I would like more people to test and report on this (and also sort out the problem with mounting /home) before putting this into the wiki.

========================================

Here is a brief summary of how I did this on my 4G. In this example, I am mounting sdb5 with a volume label USRLOCAL to /usr/local/.

1) Backup /sbin/fastinit and edit the file either with a hex editor or with this sed command:
sed -i 's@mkdir -p /dev/shm/network@  /sbin/mountdrv.sh      @' /sbin/fastinit
Basically, I take out this command from fastinit and replace it with a command to run a script that runs this command + mount the SD partition.

2) EDIT: Download this script and save it to /sbin/mountdrv.sh
[NB. This script will load USB modules to seek and mount a partition in /usr/local according to its volume label and also will take care to automatically create device if necessary. If you want to mount to /usr or /opt, just change it in the script.] [EDIT 2009/8/16: Changed download link to www.mediafire.com.]

Check and make sure both /sbin/fastinit and this script /sbin/mountdrv.sh have exec permission.

3) Umount the new partition in your SD, format it to ext3 and give it a volume label, e.g. with sdb5 mounted in E:
umount /media/E:
sudo mke2fs -L USRLOCAL /dev/sdb5
sudo tune2fs -j /dev/sdb5
4) Now mount sdb5 again and copy everything from existing /usr/local/ to sdb5. You should do it with a Root File Manager.

5) Reboot into rescue mode (or from another Linux) and rename /usr/local to say /usr/local_old. Then make a new empty directory /usr/local/. For example, if you do this in rescue mode:
mount /dev/sda1 /mnt-system
mv /mnt-system/usr/local /mnt-system/usr/local_old
mkdir /mnt-system/usr/local
umount /mnt-system
Wait a few seconds, then press [ctrl]-[alt]-[del] to reboot.
[NB. After you have confirmed this works, then you can delete the old /usr/local_old folder.]

Now I end up with sdb5 mounted in /usr/local, and the Device Detection Dialog show up no more for the SD.
EDIT: I have found that doing this, usbstorageapplet is disabled at system startup. Even though I left other USB sticks plugged in. They won't get mounted. I have to take it out and plug it in again and then usbstorageapplet works again. So effectively, I have get ride of the annoying popup for left in USB devices at system startup.

Actually, a more decent way is to also modify /sbin/scanuser.sh and formatuser.sh to include this new /usr/local partition. But let's leave it after everything is confirmed.

albkwan

Edited by albkwan, 16 August 2009 - 03:10 PM.

EeePC 4G white,
Default Xandros (Easy Mode + icewm start menu) on 1st SSD/2nd 16GB SSD added/SD/USB/
http://eeepc.fire.prohosting.com/
http://eeepc-albkwan.blogspot.com/

#2 albkwan

    ExtrEmE User

  • Members
  • 1,440 posts
  • LocationHong Kong

Posted 07 October 2008 - 01:39 PM

UPDATE: With more testing today, I have further modified the mountdrv.sh script (as EDIT above) and now I can confirm this method works for both with and without unionfs and also with the factory initramfs image.

Edited by albkwan, 07 October 2008 - 01:50 PM.

EeePC 4G white,
Default Xandros (Easy Mode + icewm start menu) on 1st SSD/2nd 16GB SSD added/SD/USB/
http://eeepc.fire.prohosting.com/
http://eeepc-albkwan.blogspot.com/

#3 manders

    New member

  • Members
  • 5 posts

Posted 16 November 2008 - 05:37 AM

I'm completely new to Linux and the Eee PC, so please excuse if this is a n00b question. How does this process differ from what you describe in your thread HOWTO - Mount SD card as part of the unionfs? What does this process accomplish?

I'm willing to test anything out. Although I'm not very experienced with Linux, I'm not afraid to tinker with it.

#4 albkwan

    ExtrEmE User

  • Members
  • 1,440 posts
  • LocationHong Kong

Posted 16 November 2008 - 03:23 PM

I think this approach is mainly useful to those who have already removed with unionfs, especially for those who have a 4G 1st SSD + 16G or more 2nd SSD. Because with default Xandros, new software installation can only go to the 1st SSD. If you install a lot of programs, it is possible you fill up the 4G 1st SSD. Then you will need extra disk space to be mounted as part of the root filesystem.

Although this method also works for unionfs. I think it is better to use the other method if you are still keeping unionfs. Because like this, the new partition mounted will be outside of the unionfs and then you will have a mixed system - some under unionfs and some out of it.
EeePC 4G white,
Default Xandros (Easy Mode + icewm start menu) on 1st SSD/2nd 16GB SSD added/SD/USB/
http://eeepc.fire.prohosting.com/
http://eeepc-albkwan.blogspot.com/

#5 manders

    New member

  • Members
  • 5 posts

Posted 16 November 2008 - 04:41 PM

Thank you for the explanation. My exact problem is that I've run out of space to install programs. I'd like to keep the unionfs for ease of reverting to factory settings. It sounds like the other option, Mouting the SD as part of the unionfs is a better solution for me.
Thanks!

#6 albkwan

    ExtrEmE User

  • Members
  • 1,440 posts
  • LocationHong Kong

Posted 17 November 2008 - 12:22 PM

Quote

Thank you for the explanation. My exact problem is that I've run out of space to install programs. I'd like to keep the unionfs for ease of reverting to factory settings. It sounds like the other option, Mouting the SD as part of the unionfs is a better solution for me.
Thanks!
If you have a 2nd SSD in your EeePC, you can create a partition out of the 2nd SSD and use the same method to mount this new partition as the USER partition of the unionfs. I have adapted the initramfs image to allow for this. The new initramfs image can be found here.
EeePC 4G white,
Default Xandros (Easy Mode + icewm start menu) on 1st SSD/2nd 16GB SSD added/SD/USB/
http://eeepc.fire.prohosting.com/
http://eeepc-albkwan.blogspot.com/

#7 kendav

    New member

  • Members
  • 1 posts

Posted 31 December 2008 - 01:35 AM

ok guys I have a question. I am a novice to linux but have been doing well at figuring things out. I have followed these instructions and it works on my 900 with just a 4GB SSD. I have it going to an 8GB SD card. I tried to follow these steps but for the entire usr folder and it does not work. I have recovered without restoring, but was wondering what I screwed up on. I edited the script in the 3-4 places that refer to the /usr/local to just /usr and it does not work. any help would be greatly appreciated. as an FYI even with the unedited script it still showed some errors at bootable but was still workable.

thanks in advance





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users