LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-05-2008, 09:46 PM   #1
SnowSurfAir
Member
 
Registered: Mar 2003
Distribution: Redhat 9
Posts: 459

Rep: Reputation: 30
Use squashfs as / ?


Hello all,

I have been just experimenting on my computer to test out some stuff for a planned system that I have. Anyway, I have a kernel that supports squashfs, it can mount squash file(like something.sqsh) as well as squash hard drives.

This is my drive setup:
Code:
/dev/sdb1: /boot
/dev/sdb2: swap
/dev/sdb3: /
/dev/sdb5: /home
/dev/sdb6: squashed /
so what I did was this:

Code:
mksquashfs / /home/root.sqsh
cd /home
dd if=root.sqsh of=/dev/sdb6
sdb6 mounts and everything just fine, but now I am trying to get it to boot from that partition with grub, i.e. use that as the / filesystem readonly.

This is my menu.lst

Code:
# general configuration:
timeout   5
default   0
color light-blue/black light-cyan/blue

# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

# (0) Arch Linux
title  Arch Linux
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-uuid/b3ca895f-ad9e-43d1-ac6b-1c2f117cea32 ro vga=773
initrd /kernel26.img

title Squashfs
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-uuid/b788e27a-3f47-4e6e-96ae-f4a08a1bc0f9 ro rootfstype=squashfs
initrd /kernel26.img

# (1) Arch Linux
title  Arch Linux Fallback
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-uuid/b3ca895f-ad9e-43d1-ac6b-1c2f117cea32 ro
initrd /kernel26-fallback.img
So when I select Squashfs grub says: cannot mount selected partition. So I dont know if I am doing this right or if I am just making a rather large hole in the wall with my head, but if you could tell me what I am doing wrong or were I can find a guide for this kindof thing, that would be much appreciated. Thank you, Levi
 
Old 06-06-2008, 08:29 AM   #2
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
grub cannot load a kernel and initrd stored on a squashfs partition, you need to create a separate /boot partition then the rest can be in squashfs
 
Old 06-06-2008, 02:06 PM   #3
SnowSurfAir
Member
 
Registered: Mar 2003
Distribution: Redhat 9
Posts: 459

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by datopdog View Post
grub cannot load a kernel and initrd stored on a squashfs partition, you need to create a separate /boot partition then the rest can be in squashfs
Yeah that is how I have it. There is a /boot partition at /dev/sdb1 and then the squashed / partition is at /dev/sdb6. I dont know if I have the right options loaded for it to boot or what but it says it cant mount the partition.

edit: wait, does that mean that I have to change the root option to be (hd0,0)?

edit edit: Ok, now i gots it booting, but I get a kernel panic, it says:
Code:
kinit: cannot open root device sdb6(8,22)
kinit: init not found
Kernel panic - attempting to kill init.
Or something like that for the kernel panic part...Any suggestions.

Last edited by SnowSurfAir; 06-06-2008 at 02:26 PM.
 
Old 06-06-2008, 02:31 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,349

Rep: Reputation: 49
Quote:
Originally Posted by SnowSurfAir View Post
edit: wait, does that mean that I have to change the root option to be (hd0,0)?
It looks like the root option (for grub) is already (hd0,0), as it should be. That's fine. That tells grub where to find /vmlinuz26and /kernel26.img. Clearly, those two files are in the proper place on (hd0,0), since the first boot option works.

However, I'm guessing that squashfs support is not built into kernel26.img. Certainly, squashfs support is available in the "main" OS. However, that's only available AFTER booting into the "main" OS. Grub doesn't know how to mount squashfs and even if it did it wouldn't directly help the initial ramdisk boot up.

Basically, here's the boot sequence:

1) Minimal GRUB loads from main boot record, looks for "big" GRUB on (hd0,0). It loads up "big" GRUB (stage 1.5).

2) "big" GRUB loads up with the menu and stuff. It loads up the kernel and initial ram file system.

3) Initrd.img. This is a lightweight linux OS running entirely in RAM from a tmpfs ramdisk. It gets hardware up and running, binds them up into the "main" OS, and then hands everything over to the "main" OS.

4) The "main" OS takes over with its "init" script. Among other things, it will now look at /etc/fstab and mount file systems other than root and the device file systems already brought up by initrd.img.

The point where it's breaking down, I suspect, is within the inital ramdisk bootup. I think that the kernel26.img you've built does NOT have squashfs built into it.

I'm not familiar with rebuilding the initrd.img in Arch, but I expect that's where you'll need to go to fix this.
 
Old 06-06-2008, 02:41 PM   #5
SnowSurfAir
Member
 
Registered: Mar 2003
Distribution: Redhat 9
Posts: 459

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by IsaacKuo View Post
The point where it's breaking down, I suspect, is within the inital ramdisk bootup. I think that the kernel26.img you've built does NOT have squashfs built into it.

I'm not familiar with rebuilding the initrd.img in Arch, but I expect that's where you'll need to go to fix this.
Yeah that is what I was a thinking. I will browse the arch forums and try to figure out it. Do I need the squashfs support built into the kernel as well? Right now I have it built as a module because the option is not like available in a kernel rebuild. Thank you for all the information, Levi.
 
Old 06-06-2008, 03:41 PM   #6
SnowSurfAir
Member
 
Registered: Mar 2003
Distribution: Redhat 9
Posts: 459

Original Poster
Rep: Reputation: 30
Got it working. Just had to rebuild my initrd.img to include squashfs. Took me like 3 seconds. Just in case someone is searching for this: you can find out how to do this for archlinux at:

http://wiki.archlinux.org/index.php/...ing_mkinitcpio

Thank you again for all of you helping me. Now I get to tinker around with it! yay.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQUASHFS error... theherkman Linux - Newbie 4 12-08-2010 09:47 AM
SquashFS Problems zcrxsir88 Linux - General 10 02-27-2008 09:36 PM
How to modify squashfs file ? kkpal Linux - Newbie 0 01-16-2008 01:39 AM
openwrt: jffs2 or squashfs almost000 Linux - Newbie 1 07-11-2007 02:07 PM
squashfs Vookimedlo Linux - Software 0 07-21-2004 02:02 PM


All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration