You are not logged in.
EDIT: I have hosted the initramfs image on http://eeepc.fire.prohosting.com/. If you download it, then you can skip steps 4-7 below.
UPDATED 2008/9/10: The initramfs image I have hosted now also support 900 and later models.
EDIT 2009/3/14: There is another set of instructions for doing this without Puppy Linux in thread #37 of this post. You will be working solely on the command line within EeePC Linux with that method.
I have worked out this solution to mount a 4G SD card as part of the filesystem of my Eeepc Linux, in particular as the USER partition of the unionfs instead of the default /dev/sda2. So, now I have plenty of free space in my Eeepc Linux (and my next step would be to install win2k on /dev/sda2).
The steps here are actually quite similiar to the steps for booting Xandros from USB. But BEWARE: Any mistake may render the default Xandros not usable and end up having to restore from DVD image. Take your own risk in testing this steps!
What you will need:
(i) a SD card (minimum 2G)
(ii) A Linux on USB (I am using my default Xandros booting from a USB card reader, you can also try with Puppy Linux).
[NB. Another possibility would be a Linux on CD, but then you will need an external CDROM]
The commands below are for working with default Xandros booting from USB. If you are using Puppy Linux, there will be some notable difference:
(i) Puppy Linux see the SSD as IDE, so /dev/sda1 and /dev/sda2 will appear as /dev/hdc1 and /dev/hdc2, and /dev/sdb1 will appear as /dev/sda1. Verify this for yourself on your system. You will have to change the device names in the commands below accordingly.
(ii) In Puppy Linux, the user is already by default "root". But for default Xandros, you will need to change user to root to run all the commands below:
sudo bash
Also in default Xandros, better do it on konsole (File Manager > Tools > Open Console Window) as you can copy and paste commands there.
(iii) Same for the File Manager in Puppy Linux, already root. For default Xandros, run a superuser File Manager with:
sudo XandrosFileManager
Here are the steps:
1) Backup your existing USER partition (/dev/sda2) to an USB flash disk (Optional)
dd if=/dev/sda2 | gzip > /mnt/media/xxx/xxx/eeepc-sda1.img.gz
Replace /mnt/media/xxx/xxx with the path of your USB storage device as you can see it in your File Manager.
2) Prepare your SD card - fdisk and format to ext3
cfdisk /dev/sdb New > Primary > Enter > Write > "yes" > Quit mke2fs -c -L USER /dev/sdb1 tune2fs -j /dev/sdb1
3) Copy all data from your existing USER partition (sda2) to your new USER partition (sdb1)
cd /mnt mkdir sda1 sda2 sdb1 mount -t ext3 /dev/sda2 /mnt/sda2 mount -t ext3 /dev/sdb1 /mnt/sdb1 cd /mnt/sda2 cp -ax * /mnt/sdb1
4) Create a temp dir in /boot of sdb1 and unpack the initramfs image there:
mount -t ext2 /dev/sda1 /mnt/sda1 cd /mnt/sdb1/boot mkdir temp cd temp gunzip < /mnt/sda1/boot/initramfs-eeepc.img | cpio -i
5) Modify "init":
EDIT: Thanks to the insight of Russell, we can actually load the USB modules from within the filesystem instead of copying them into the initramfs image.
kwrite init
Look for these lines:
mount -t ext2 -o ro $ROOT /mnt-system
if [ $? -ne 0 ] ; then
echo Could not mount OS on $ROOT. Starting debugging shell....
/bin/busybox sh
fiAdd the following lines just after it to USB modules at bootup:
#load USB modules VERSION=`cat /proc/version | cut -f3 -d" "` insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/core/usbcore.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/host/ehci-hcd.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/host/uhci-hcd.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/storage/libusual.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/storage/usb-storage.ko > /dev/null #loop scanning for usb devices while ! grep -q "sdb1" /proc/partitions; do sleep 1; done
Also change all sda2 to sdb1. Save and quit.
6) Create device sdb1 in /dev of the temp dir:
cd /mnt/sdb1/boot/temp/dev mknod -m 660 sdb1 b 8 17
[NB. don't substitute "sdb1" in the mknod command even if you are using Puppy Linux]
7) Now pack the initramfs image and move it to /mnt/sda1/boot:
cd /mnt/sda1/boot mv initramfs-eeepc.img initramfs-eeepc.img.orig cd /mnt/sdb1/boot/temp find | cpio -H newc -o | gzip -9 > ../initramfs-eeepc.img cd ../ mv initramfs-eeepc.img /mnt/sda1/boot
8) Edit the file scanuser.sh:
cd /mnt/sda1/sbin cp scanuser.sh scanuser.sh.orig kwrite scanuser.sh
Replace all "sda2" with "sdb1".
9) Do the same for formatuser.sh:
cd /mnt/sda1/sbin cp formatuser.sh formatuser.sh.orig kwrite formatuser.sh
Replace all "sda2" with "sdb1".
EDIT: This step is not necessary!
10) Give exec permission to your SD card as per this thread.
11) Reboot.
The beauty of this method is that all the changes are permanent and upgrading your SD card to a even bigger capacity in the future (when price is more attractive) is very easy. You only need to repeat steps 2 and 3 for your new SD card.
So time for a beer?
Last edited by albkwan (2009-03-14 9:14:29 am)
Offline
This is a nice alternative to removing unionfs. I have an 8G SDHC card showing up soon. If I have trouble removing unionfs I may go this route instead and if I need to read an SD card I can just use my cheap USB external card reader. Thanks for posting this!
Offline
This sounds like what I have been looking for. But I am such a noob with Linux, I need to make sure I understand exactly what you've done and if it is what I need. I put xp on my ssd and would like to intall/run xandros from my 8g sd card. I will leave the sd card in all the time. Does this procedure preclude using the sd card for anything else? Can you partition a card and have xandros on part of the card and put some of your other windows type program files on the card in another partition? That would be the best of all worlds for me.
Offline
lcangler wrote:
I put xp on my ssd and would like to intall/run xandros from my 8g sd card. I will leave the sd card in all the time. Does this procedure preclude using the sd card for anything else? Can you partition a card and have xandros on part of the card and put some of your other windows type program files on the card in another partition?
You should use the technique given in the wiki http://wiki.eeeuser.com/xandrosbootfromusb for what you have described instead. But since xandros is gone from your ssd you'll need something like puppy linux or eeexubuntu on usb stick to execute the commands. It's possible to partition the sd card in the way you have described to share between xandros and xp. I'm doing something similiar from a USB hard disk.
Last edited by jasonp (2008-01-01 8:35:23 pm)
Offline
Another application of this modification has come to my mind:
With the USER partition all on a SD card, you can share your eeepc with members of your family, or lend out to students at school. Every user only need to have his/her own SD card, insert it into the eeepc and boot it.
Then every user can have the freedom to install programs he/she like, store their personal data, without the need to config different user profiles ... etc on the limited space of the SSD.
And the best thing of this approach is that it is fully upgradeable and you don't need to worry about wearing of the SSD (which is now read only). Any sign of disk read/write error on the SD, you just buy a new SD and move all your data there.
Offline
I am new to all this but I think I understand. With this method, I could install Xandros and XP on an 8GB SD cardd and boot into either? The added benefit is that I could install any apps that I want for Xandros (on the SD card) without worrying about running out of space like he default Xandros?
Do I have that right?
Thanks for all your help
Offline
cyril wrote:
I am new to all this but I think I understand. With this method, I could install Xandros and XP on an 8GB SD cardd and boot into either? The added benefit is that I could install any apps that I want for Xandros (on the SD card) without worrying about running out of space like he default Xandros?
Do I have that right?
Thanks for all your help
Exactly.
Also, this will solve the limited disk space problem of 2G eeepc.
Offline
albkwan,
Thank you! I had posted a request for this a couple of days ago, and you have come through! I've copied your HowTo (so I can find it again!) and will be trying it tonight.
Offline
How is the procedure described in this link http://wiki.eeeuser.com/xandrosbootfromusb different from the procedure that albkwan developed. I thought there was some issue trying to run xandros from an sb card and that albkwan's procedure fixed this. Can someone explain this for me before I do anything stupid??
Offline
lcangler wrote:
How is the procedure described in this link http://wiki.eeeuser.com/xandrosbootfromusb different from the procedure that albkwan developed. I thought there was some issue trying to run xandros from an sb card and that albkwan's procedure fixed this. Can someone explain this for me before I do anything stupid??
Both steps are written by me. There is not much difference - Only where to mount the USER partition.
The issue that come when booting Xandros from an SD card (i.e. /dev/sdb) comes from udev that mounts removable USB devices. This happens after the system has completely boot up (after X windows is running).
Tonight, while redoing it all over again, I come to a situation when the system has completely boot up, I check and found that /dev/sdb2 has been mounted read/write. But after a few seconds, it becomes read only!
This does not occur at every boot up and it never happen to a USB flash disk (i.e. /dev/sdc), But sometimes it happens. I think the solution should be changing the udev rules to disable udev from re-mounting this SD card again.
In my old system, I have something like this. But since I have format everything (due to a silly mistake), I have to do it all over again!
EDIT: It's too late now. I need some good sleep tonight!
Last edited by albkwan (2008-01-02 10:32:21 am)
Offline
Thanks albkwan. When you do it again and I am sure will get it going, can you edit your original procedure and repost with one writeup. Linux is so new to me, I get confused trying to paste together different procedures and trying to land on the last one that worked. One other question that was unclear, if I follow your procedure... normally booting XP from SSD and using SD for program and data file access (office, etc.) nothing will change for that right? When I want to run xandros, I get to choose to boot linux from SD card and off it goes. That would be sweet.
Offline
lcangler wrote:
Thanks albkwan. When you do it again and I am sure will get it going, can you edit your original procedure and repost with one writeup. Linux is so new to me, I get confused trying to paste together different procedures and trying to land on the last one that worked. One other question that was unclear, if I follow your procedure... normally booting XP from SSD and using SD for program and data file access (office, etc.) nothing will change for that right? When I want to run xandros, I get to choose to boot linux from SD card and off it goes. That would be sweet.
I will repost the steps later. Last night, I was redoing it with Puppy Linux. I found that Puppy Linux has more GUI tools, which I think will be much easier for Window users (not acquainted with Linux) to follow.
As for the dual boot thing, I am also planning to install win2k on my /dev/sda2 partition (the original USER partition). After I get that working, I will also post the steps.
Offline
albkwan wrote:
Another application of this modification has come to my mind:
With the USER partition all on a SD card, you can share your eeepc with members of your family, or lend out to students at school. Every user only need to have his/her own SD card, insert it into the eeepc and boot it.
Then every user can have the freedom to install programs he/she like, store their personal data, without the need to config different user profiles ... etc on the limited space of the SSD.
And the best thing of this approach is that it is fully upgradeable and you don't need to worry about wearing of the SSD (which is now read only). Any sign of disk read/write error on the SD, you just buy a new SD and move all your data there.
Russel has done something similiar and included support for using USER as an encrypted container with LUKS and as a ram disk.
http://slofith.org/projects/eeepc/
Last edited by jasonp (2008-01-03 2:14:55 am)
Offline
jasonp wrote:
albkwan wrote:
Another application of this modification has come to my mind:
With the USER partition all on a SD card, you can share your eeepc with members of your family, or lend out to students at school. Every user only need to have his/her own SD card, insert it into the eeepc and boot it.
Then every user can have the freedom to install programs he/she like, store their personal data, without the need to config different user profiles ... etc on the limited space of the SSD.
And the best thing of this approach is that it is fully upgradeable and you don't need to worry about wearing of the SSD (which is now read only). Any sign of disk read/write error on the SD, you just buy a new SD and move all your data there.Russel has done something similiar and included support for using USER as an encrypted container with LUKS and as a ram disk.
http://slofith.org/projects/eeepc/
Just take a look at Russel's init file. Indeed, he has done it in an even smarter way:
There is actually no need to copy the USB modules into init, they can be loaded from within the root filesystem after mounting /mnt-system. This will require fewer changes to the initramfs image. I will test it and update the steps above.
The other thing I like very much is booting with a ramdisk when no SD card is available - just like a Linux on CD!
Offline
Hi,
Great thread.
I'm a linux newbie but if I understand this correctly it means that when I install my apps via apt-get they will be placed on my SD card, preserving that valuable SDD card space.. My question is more about the steps taken to achieve this. I think I understand most of it but the mknod command loses me. What exactly is that being used for? A google search threw up what the command is for. Creating some special file. But it doesnt explain why its required here. If anyone could shed some light on that I'd be greatful ![]()
I assume that this elborate process is mainly to auto mount the SD card early enough in the boot process so its available (for mounting) and then sdb1 is mounted at /mnt-user instead of sda2. Is that right?
Well sorry for probably asking dumb questions but in helping me to learn linux i'd like to understand this entire process a little more fully ![]()
thanks
Offline
Hard disks are block devices in Linux. They are special files in the Linux filesystem which need to be created by the mknod command. To help the kernel to identify them, each device is assigned a major and minor number. The scsi disk0 is conventionally assigned a major number of 8. Only the minor number changes for sda, sdb, sdc, and so on.
For the 1st partition on the 1st scsi disk, i.e. /dev/sda1, the major and minor numbers are 8 and 1;
...
For the 16th partition on the 1st scsi disk, i.e. /dev/sda16, the major and minor numbers are 8 and 16;
For the 1st partition on the 2nd scsi disk, i.e. /dev/sdb1, the major and minor numbers are 8 and 17;
...
For the 16th partition on the 2nd scsi disk, i.e. /dev/sdb16, the major and minor numbers are 8 and 32;
...
For the 1st partition on the 3rd scsi disk, i.e. /dev/sdc1, the major and minor numbers are 8 and 33;
...
and so on.
For more information, you can read the manual page and info page of the command mknod, or refer to Linux kernel documentation.
man mknod info mknod 'q' to quit
Offline
Thanks for that. I also looked http://lwn.net/Articles/210046/ and read about creating an initramfs and now its all becoming clear :-)
oh yes, this helped understand the process too ![]()
http://www.tldp.org/HOWTO/Bootdisk-HOWTO/buildroot.html
damn, i'm starting to love linux.. god bless the eeePC ![]()
Last edited by majic (2008-01-10 11:38:23 am)
Offline
OK if I am not mistaken, this moves everything from the SSD storage to the SD card, correct? Or does this "add" the available storage space of the SD card to the root file system in general?
Offline
It moves it to sd, if you want something that just adds sd as storage through unionfs thats not hard either. In fact I'm already working an a set of scripts and programs that will automate that for you ![]()
Offline
Very nice.
I did a little more reading about UnionFS after I last posted. Ideally, for me at least, I would a) keep the "recovery" partition (which I understand to be the "bottom layer" of the UnionFS tree in the EeePC); b) use the rest of the free space on the internal SSD as the "second layer" of the UnionFS tree; and c) when the SSD is full (or near full) start using the space on the SD card.
It seems this would create the scenario that the SD card would need to be kept in at all times. Also, I don't even know if this kind of set up is possible (it seems perfectly possible, but automatically switching to SD card space rather than SSD card space may not be possible).
In any case, please leave updates on these scripts you're working on.
Last edited by ERamseth (2008-01-10 1:49:33 pm)
Offline
Well my scripts won't need to change the ssd to work. They will be used to make an image file on your sd/flash drive/external harddrive and it will make the drive bootable. When you boot the drive it will mount the image and your partitions to union (As you configure it) This way your "added storage" only affects the system if its inserted.
Offline
Hmm.
I guess what I am concerned about is not using the SSD at all. I mean really... I paid for the SSD didn't I? haha
Offline
@Oatz
Sounds nice. Hope you post them soon ![]()
Offline
ERamseth wrote:
... and c) when the SSD is full (or near full) start using the space on the SD card.
It seems this would create the scenario that the SD card would need to be kept in at all times. Also, I don't even know if this kind of set up is possible (it seems perfectly possible, but automatically switching to SD card space rather than SSD card space may not be possible).
you could do something like this with an LVM device spanning the internal ssd and the sdhc devices, though you're right about the card having to be left in at all times. (the 2 devices are logically turned into a single larger device - removing the SD card afterward would be roughly equivalent to removing half of the hard drive from your normal computer)
albkwan wrote:
Code:
#load USB modules ... insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/storage/usb-storage.ko > /dev/null #need time to register things sleep 8
you can replace the hardwired "sleep 8" here with something like -
while ! grep -q $USER /proc/partitions; do sleep 1; done
where $USER is the partition you're waiting for. This looks every second in /proc/partitions (the kernel's list of available block devices) for a device, and waits until it's found. this way you'll continue booting as soon as the kernel has found your device, instead of just saying "it ought to be available within 8 seconds".
albkwan wrote:
For the 1st partition on the 1st scsi disk, i.e. /dev/sda1, the major and minor numbers are 8 and 1;
...
and so on.
also, /proc/partitions will tell you the exact major/minor device id for any detected device. "cat /proc/partitions" to see every block device your kernel is aware of, whether or not a node exists for it under /dev/...
Offline
ERamseth wrote:
Hmm.
I guess what I am concerned about is not using the SSD at all. I mean really... I paid for the SSD didn't I? haha
I am doing this because:
1) The 4G SSD is too small for a full modern Linux distribution. If I install all the apps I am using on my Linux desktop, I will run out of free space. With a 4G SDHC mounted as USER partition, I will have an additional 4G - 1.5G = 2.5G free space. Then I'll be much well off.
2) I want to make use of the 2nd partition (1.5G) to install win2k for dual boot with the default Xandros because I have some windows only software that cannot run in wine.
3) Like this, I can have different versions of the default Xandros on different SDHCs: One for daily use, one for testing this or that, another one hopefully with a low latency kernel, JACK server and many music softwares (they are big!) to make a multimedia workstation.
Offline