LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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


Closed Thread
  Search this Thread
Old 06-05-2014, 03:19 AM   #1
karmawheel
LQ Newbie
 
Registered: Jun 2014
Posts: 5

Rep: Reputation: Disabled
squashfs system multiboot from sd/usb


Hello.

For a past few days I'm struggling to create sd card with few root filesystems to choose from on boot. The idea is to convert running system to squashfs file and put it on sd card. Systems should be readonly and any additional files added later should be kept on rw partition mounted on start. Any other files should be kept in RAM and lost after reboot. So partitions should be like this:

1st - vmlinuz, kernel, grub files, os1.squash, os2.squash and so on
2nd - mounted to, for instance to /mnt/ after boot with extra files available across systems (after succeeding booting OS at all )

For testing purposes I'm using vmware, with one HDD with centos 6.5 installed and run from it, and second HDD simulating SD card which is plugged to base OS, then unplugged and run by its own on another virtual machine.

So what I do is:

Rsync running system to /root/sqfs/
Code:
sudo rsync -av --one-file-system --exclude=/proc/* --exclude=/dev/* --exclude=/sys/* --exclude=/tmp/* --exclude=/home/* --exclude=/lost+found --exclude=/var/tmp/* --exclude=/boot/grub/* --exclude=/root/* --exclude=/var/mail/* --exclude=/var/spool/* --exclude=/media/* --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/etc/hosts --exclude=/etc/shadow* --exclude=/etc/gshadow* --exclude=/root/sqfs/ --exclude=/etc/resolv.conf --exclude=/etc/hostname / sqfs/
creating squashfs file from it
Code:
sudo mksquashfs /root/sqfs/ /root/os1.squash -noappend
using fdisk on second HDD to create two primary partitions and make 1st bootable

creating filesystems on them
Code:
mkfs.ext2 /dev/sdb1
mkfs.ext3 /dev/sdb2
mounting partitions and moving squash fs there
Code:
mkdir /mnt/sq1
mkdir /mnt/sq2

mount /dev/sdb1 /mnt/sq1
mount /dev/sdb2 /mnt/sq2

cp /root/os1.squash /mnt/sq1/
copy kernel
Code:
cp /boot/vmlinuz-2.6.32-431.el6.x86_64 /mnt/sq1/vmlinuz
cp /boot/initramfs-2.6.32-431.el6.x86_64.img /mnt/sq1/initrd.img
instaling grub
Code:
grub-install --no-floppy --root-directory=/mnt/sq1/ /dev/sdb1
and editing grub in /mnt/sq1/boot/grub/grub.cfg
Code:
default=0
timeout=5
hiddenmenu
title os1
        kernel /vmlinuz root=live:LABEL=os1.squash rootfstype=auto live_dir=/ ro liveimg nodiskmount nolvmmount rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
        initrd /initrd.img
So I end up with structure like this:
Code:
/mnt/sq1
├── boot
│** └── grub
│**     ├── device.map
│**     ├── e2fs_stage1_5
│**     ├── fat_stage1_5
│**     ├── ffs_stage1_5
│**     ├── grub.conf
│**     ├── iso9660_stage1_5
│**     ├── jfs_stage1_5
│**     ├── minix_stage1_5
│**     ├── reiserfs_stage1_5
│**     ├── stage1
│**     ├── stage2
│**     ├── ufs2_stage1_5
│**     ├── vstafs_stage1_5
│**     └── xfs_stage1_5
├── initrd.img
├── os1.squash
└── vmlinuz
Then after boot an choosing os1 dracut throws warning
Code:
dracut Warning: No root device "block:/dev/mapper/live-rw" found
Most probably I don't use kernel parameters right, can u please give me hint how it supposed be done?
 
Old 06-05-2014, 08:20 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate of https://www.linuxquestions.org/quest...sb-4175507066/
 
  


Closed Thread



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 system multiboot from sd/usb karmawheel Linux - General 3 06-06-2014 03:41 PM
Grub in USB Flash(Squashfs) raj010 Linux - Newbie 1 12-09-2010 11:11 PM
How to update squashfs on embedded system? MrUmunhum Linux - General 1 09-12-2010 05:32 PM
How to update squashfs on embedded system? MrUmunhum Linux - Embedded & Single-board computer 0 09-12-2010 02:28 PM
Regarding squashfs file system and encryption ashok kumar reddy Linux - General 0 11-19-2009 11:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:20 PM.

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
Open Source Consulting | Domain Registration