WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: automatically mount /dev/sda1 with vm-scsi to achieve persistence  (Read 2626 times)

Offline beetle

  • Newbie
  • *
  • Posts: 11
automatically mount /dev/sda1 with vm-scsi to achieve persistence
« on: September 19, 2011, 12:02:47 PM »
Hello all, my new challenge is to make my setup work on vmWare/vSphere. I can do it on VirtualBox but it is more tricky with the vm-scsi*package.

I managed to have the  vm-scsi* package installed but not to automatically mount /dev/sda1.

I think I need directions for actions early in the boot process to mount /dev/sda1 and make TC point into the filesystem to achieve persistence. I may be wrong but I think I'm pretty close!

Could I get help at achieving persistence on a setup where I need to mount the vmWare hdd drive early in the boot process?

Your help appreciated!

-Beetle

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 541
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #1 on: September 19, 2011, 02:53:33 PM »
I use it this way, and it's why I created the extension. My solution for a .iso image is to use the qremaster script to load the extension earlier in the boot process. Basically, the vm-scsi extension is placed in /opt/tce within a cpio archive, which is the designated path for extensions that must be loaded early in the boot process.

Alternatively, you can use an IDE drive in your virtual machine which removes the need for the vm-scsi extension.

Offline beetle

  • Newbie
  • *
  • Posts: 11
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #2 on: September 22, 2011, 08:02:52 AM »
Hi danielibarnes, I appreciate you help.

I looked into your script to figure what are the minimum steps required.

I did the following:

1/ generate a cpio archive with the vm-scsi extension files and put it on the hdd
Code: [Select]
find vm-scsi*|cpio -o -H newc|gzip -2 >  /mnt/sda1/boot/vm-scsi.gz
2/ adapt the initrd with initrd=/boot/tinycore.gz,/boot/vm-scsi.gz
Code: [Select]
vi /mnt/sda1/boot/extlinux/extlinux.conf
It did not work the first time, the 2 vm-scsi files (the .tcz and the .tcz.md5.txt) expanded in the root ('/') and were not loaded. I could manually load those with tce-load.
I retried making sure the path would be /opt/tce but it did not work either (I did not even find the files!).

Maybe you can guide me in what I do wrong?

Many thanks in advance.

-Beetle
« Last Edit: September 22, 2011, 08:06:33 AM by beetle »

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 541
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #3 on: September 22, 2011, 09:50:13 AM »
Are you installing Tiny Core to /dev/sda or trying to boot from a Tiny Core .iso image? If you installed Tiny Core to /dev/sda then it is a bit tricky:

mkdir -p /tmp/vm/opt/tce/
tce-load -w vm-scsi-2.6.33.3-tinycore.tcz
cp $(cat /opt/.tce_dir)/optional/vm-scsi-2.6.33.3-tinycore.tcz* /tmp/vm/opt/tce/
echo vm-scsi-2.6.33.3-tinycore.tcz > /tmp/vm/opt/tce/onboot.lst
cd /tmp/vm/
find|cpio -o -H newc|gzip -9 > /mnt/sda1/boot/vm-scsi.gz

The edit the initrd exactly as you describe (assuming you are using extlinux as your bootloader).

If you want to create a Tiny Core .iso image with the vm-scsi drivers, execute:

sh qremaster vm-scsi-2.6.33.3-tinycore.tcz tinycore.iso vm-scsi.iso

where "tinycore.iso" is your original Tiny Core image. Copy the .iso image as necessary and boot from it.
« Last Edit: September 22, 2011, 09:58:54 AM by danielibarnes »

Offline beetle

  • Newbie
  • *
  • Posts: 11
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #4 on: September 23, 2011, 08:41:10 AM »
Thanks again, the installation part works great.

But somehow it is not automatically loaded. I still need to manually load it.

I tried adding lst=/opt/tce/onboot.lst in APPEND of extlinuxconf without success.

Maybe I need to modify onboot.lst that is in the tinycore.gz instead ? In which case I would need to rebuild it, maybe with the help of a remastering script?

There's gotta be an easier way..

-Beetle

PS: yes, I'm trying to boot from sda and have persistence there. I don't have IDE available in the vSphere I use. If all else fails I might try to have an iso that is resident in the vSphere server for the vm to have it available permanently. Currently, the iso is virtually loaded in the CDROM tray manually on the client side: it is unloaded as soon as the client disconnects, and somehow it always disconnects overnight. As of now, I no longer need to iso since the vm-scsi is available in the vm. It is just not automatically loaded and I don't know how to use a startup script in that scenario since my data & scripts (on sda) are not yet available at boot time.

...that one tiny part that is missing...

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 541
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #5 on: September 23, 2011, 09:09:49 AM »
Quote
But somehow it is not automatically loaded.

Sorry, there was an error in my text. Note bolded change:

mkdir -p /tmp/vm/opt/tce/optional/
tce-load -w vm-scsi-2.6.33.3-tinycore.tcz
cp $(cat /opt/.tce_dir)/optional/vm-scsi-2.6.33.3-tinycore.tcz* /tmp/vm/opt/tce/optional/
echo vm-scsi-2.6.33.3-tinycore.tcz > /tmp/vm/opt/tce/onboot.lst
cd /tmp/vm/
find|cpio -o -H newc|gzip -9 > /mnt/sda1/boot/vm-scsi.gz

Quote
I don't have IDE available in the vSphere I use.

I'm not sure what you mean. The CD-ROM is IDE, and it is easy to add an IDE hard disk to a virtual machine.

Quote
Currently, the iso is virtually loaded in the CDROM tray manually on the client side

Is that a requirement or just your current implementation? The virtual machine can boot directly from an .iso image.
« Last Edit: September 23, 2011, 12:05:00 PM by danielibarnes »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 7779
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #6 on: September 23, 2011, 09:46:36 AM »
Do mkdir the dir too ;)
The only barriers that can stop you are the ones you create yourself.

Offline beetle

  • Newbie
  • *
  • Posts: 11
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #7 on: September 23, 2011, 11:50:45 AM »
Well...

I adapted my setup script with the '/optional/' folder but still, it would not automatically load the module.

I tryed playing around with the /opt/bootlocal.sh to force a mount there. It complained (dmesg) about being root, I then tried "su tc": not complains but no success...

I finally succeeded by forcing the tce-load inside /home/tc/.profile

From that point I can continue on my own, I can run my scripts from /dev/sda1 as required.

It is just sad that I can not explain why I could not load the module via an "official way"

Thanks for you help, it was greatly appreciated.


Quote
I'm not sure what you mean. The CD-ROM is IDE, and it is easy to add an IDE hard disk to a virtual machine.

I just digged into it and you're right, I could have created a disk on IDE which is not the default option.

Wow... could have been much more simpler!

Quote
Quote
Currently, the iso is virtually loaded in the CDROM tray manually on the client side

Is that a requirement or just your current implementation? The virtual machine can boot directly from an .iso image.

vSphere & vmWare ESXi is new to me. Maybe I can create an ISO file inside the server's "Datastore" but I did not dig into that.


Thanks a lot!



-Beetle

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 541
Re: automatically mount /dev/sda1 with vm-scsi to achieve persistence
« Reply #8 on: September 23, 2011, 12:09:13 PM »
Quote
Maybe I can create an ISO file inside the server's "Datastore" but I did not dig into that.

You can right-click on "datastore1" and select "Browse Datastore." From there, you can copy a .iso image to the server.