[INSTALLATION] Install using 2 partitions

Guides written by the community, for the community, and only guides!

[INSTALLATION] Install using 2 partitions

Postby crimsonredmk » Sun Jul 03, 2011 5:35 pm

This has been requested many times. As you may know, U-Boot only supports booting from ext2 partitions, which are fine for flash drives and USB sticks.

But what about hard drives? Journals on those are pretty much required. This guide is meant for those users booting from spinning hard drives that want a small /boot partition and have the rest of their drive journaled using (in this example) an ext4 filesystem.

First off, make the partitions. Use whatever tool you like, even GParted on another computer. Make the first partition big enough so you'll feel comfortable. I'd go with at least 256MB just to have dsome room, but there's nothing wrong with making it bigger or smaller. The kernels themselves are pretty small, but leave room for upgrades, backups, system maps, etc. Format it as ext2.

Next, format the rest of the drive as ext4 (or ext3, or any popular Linux-supported filesystem).

Once you're all set, download the rootfs and extract it to the bigger, second partition. Then, move the /boot folder to the first partition.

Next, open up the /etc/fstab file on the 2nd partition (since that's where it is, right?). Add lines for your setup like this, but leave the existing proc and other lines:

Code: Select all
/dev/sda1   /boot        ext2    defaults,noatime     1 2
/dev/sda2   /            ext4    noatime              0 1


That should be it. Unmount everything, plug the drive into the device and hope for the best! Ask relevant questions below, suggest changes, and so on.
Remember, Arch Linux ARM is completely donation-supported, and is totally awesome.
crimsonredmk
Site Admin
 
Posts: 433
Joined: Wed Dec 30, 2009 5:17 pm
Location: #archlinux-arm on irc.freenode.net

Re: [INSTALLATION] Install using 2 partitions

Postby corbo » Sat Oct 22, 2011 6:19 pm

This should work with no uboot modifications?
corbo
 
Posts: 15
Joined: Sat Oct 22, 2011 6:17 pm

Re: [INSTALLATION] Install using 2 partitions

Postby hydro » Sat Oct 22, 2011 7:24 pm

No, it won't work without uBoot modifications.
Code: Select all
fw_setenv usb_scan_1 'usb=0:1 dev=sda2'
fw_setenv usb_scan_2 'usb=1:1 dev=sdb2'
fw_setenv usb_scan_3 'usb=2:1 dev=sdc2'
fw_setenv usb_scan_4 'usb=3:1 dev=sdd2'
fw_setenv usb_rootfstype ext4

This is probably the easiest solution. Different approaches can be found here and here.
Also note that after you have moved the /boot folder to the first partition and booted the plug, the kernel image will be located in /boot/boot/uImage, but when you update the kernel, the new image will be installed in /boot/uImage, i.e. in the root folder of the first partition. If you do not move the new image to /boot/boot/uImage, then uBoot will still start the old kernel.
My suggestion is not to move the /boot folder to the first partition, but only to move the contents of the /boot folder to the first partition, then change to the root folder of the first partition and create a link
Code: Select all
ln -s . boot

This way uBoot will always load the currently installed kernel image.
I also don't think using ext4 with journal should be limited to hard drives, as I have already mentioned here.
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: [INSTALLATION] Install using 2 partitions

Postby WarheadsSE » Sun Oct 23, 2011 2:08 am

So the instructions should have read "move the contents of the /boot folder to the first partition"
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6727
Joined: Mon Oct 18, 2010 2:12 pm

Re: [INSTALLATION] Install using 2 partitions

Postby hydro » Sun Oct 23, 2011 1:21 pm

Either
move the contents of the /boot folder to the first partition and create the symlink in the first partition
or
move the /boot folder to the first partition and after every subsequent kernel update copy files from /boot/ to /boot/boot/ .
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: [INSTALLATION] Install using 2 partitions

Postby pentolino » Mon Oct 31, 2011 10:35 pm

Hi I'm trying to boot a dockstar off a two partitions drive; I have a similar layout than the one proposed here, but I have the two partition swapped (i.e. first is the etx4 one, then the ext2 /boot).
How should I configure usb_scan? I tried with:

usb_scan_1=usb=0:0 dev=sda1
usb_scan_2=usb=1:0 dev=sdb1
usb_scan_3=usb=2:0 dev=sdc1
usb_scan_4=usb=3:0 dev=sdd1

but it doesn't seem to work.
It does boot fine using a single partition pen drive.
I tried to use netconsole with no luck, can't see anything, when I start netconsole it exits right away and no message is displayed (maybe I'm doing something wrong).
pentolino
 
Posts: 16
Joined: Sun Feb 27, 2011 10:31 am

Re: [INSTALLATION] Install using 2 partitions

Postby hydro » Mon Oct 31, 2011 10:52 pm

Code: Select all
fw_setenv usb_scan_1 'usb=0:2 dev=sda1'
fw_setenv usb_scan_2 'usb=1:2 dev=sdb1'
fw_setenv usb_scan_3 'usb=2:2 dev=sdc1'
fw_setenv usb_scan_4 'usb=3:2 dev=sdd1'
fw_setenv usb_rootfstype ext4
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: [INSTALLATION] Install using 2 partitions

Postby pentolino » Tue Nov 01, 2011 12:42 pm

Thanks, this works :-)
Since I can't find where to RTFM about usb_scan, why don't we try to put some general docs here?
If I get it right the meaning of those variables is: look for /boot in first USB device, second partition (and so on, but always second partition), if you find it there, then tell the kernel / is /dev/sda1 (or sdb1, sdc1, sdd1, depending on where boot was found), then the kernel will use /etc/fstab to know about filesystem structure.
I also noticed that netconsole didn't work because I didn't put a fixed ip address (dhcp is not working or at least non as I expected - maybe it just gets a different ip than the one I have on my dnsmasq); no problem since it's ok for me to put a fixed address. It helped me a lot to find what issue I still had :-)
pentolino
 
Posts: 16
Joined: Sun Feb 27, 2011 10:31 am

Re: [INSTALLATION] Install using 2 partitions

Postby DocSavage » Sun Dec 18, 2011 11:23 pm

I found one thing missing from the fw_setenv list (at least in my case)

fw_setenv usb_root=/dev/sda2

-Andy
DocSavage
 
Posts: 2
Joined: Sun Dec 18, 2011 9:55 pm

Re: [INSTALLATION] Install using 2 partitions

Postby hydro » Mon Dec 19, 2011 12:40 pm

Setting usb_root directly has no effect, because its value is determined by the usb_scan script (which reads the modified usb_scan_N strings).
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Next

Return to Community Guides

Who is online

Users browsing this forum: No registered users and 1 guest