Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: lykkedk on October 29, 2014, 01:14:30 PM

Title: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 29, 2014, 01:14:30 PM
Hi Forum.

While i am working on a script, to choose between; say 2-3 different kernel's and /tce -dir's, i found that copying files in and out from the VFAT mmcblk0p1 partition, is somehow problematic, due to timestamp's, owner of the mounted partition, and so on...

So, i figured out, that having a bigger mmcblk0p1, was the easiest method for me.

I did left some space, after i expanded the mmcblk0p2 partition, when i flashed the piCore.img, a while back. In that space i created mmcblk0p3/EXT4, and copyed the hole mmcblk0p1 (boot, kernel, initrd, config etc... etc..) over, just for having a backup on card, if i messed something up.

I now need to expand my mmcblk0p1 partition, and i am i doubt if it's possible at all ?
Ofcause, i will have to accept a slight smaller mmcblk0p2 partition, but there are plenty of place allready, so no problem :)

My partitions is as this ::

Quote
Disk /dev/mmcblk0: 4008 MB, 4008706048 bytes
4 heads, 16 sectors/track, 122336 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1              33         704       21504   6 FAT16
/dev/mmcblk0p2             705       92258     2929728  83 Linux
/dev/mmcblk0p3           92259      122336      962496  83 Linux


Hoping, i can get some hint's howto do this ?

Regards;
   Jesper.

Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 29, 2014, 01:37:02 PM
It is easy.

- backup content of /mnt/mmcblk0p1
- delete all partitions
- create a new VFAT partition starting at the same sector as deleted 1st partition started in any size
- format this partition (/dev/mmcblk0p1)
- copy files you saved in first step

You are ready, you have a bootable piCore system. Do whatever you want with the remainaing part of the SD card. Create additional partition to hold /tce, swap or to play with funny file systems like xfs, btrfs, ...

What is important do not touch sectors below the starting sector of first partition, it is used by the system.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 29, 2014, 01:57:38 PM
Hi... Thx...

Quote
- backup content of /mnt/mmcblk0p1
- delete all partitions
- create a new VFAT partition starting at the same sector as deleted 1st partition started in any size
- format this partition (/dev/mmcblk0p1)
- copy files you saved in first step

But problem is, that i need my hole setup, on mmcblk0p2 (special homemade tcz's, scripts in home/tc, opt/bootlocal /mnt/mmcblk0p2/tce/onboot... also persistance /etc/fstab, etc... etc...)
Sure, i could write it all up, and make copys... but i was hoping for a easier way ??

Regards;
   Jesper.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 29, 2014, 02:36:33 PM
Even if there is a method to shrink partition with data the first step is to make backup which means copying the whole content. In such case you do the repartitioning. We are not talking about terabytes. Take an USB stick.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 29, 2014, 02:38:22 PM
Well, you can play with dd offset values dd'ng the second partition to file and restoring to different place, etc. Good practice to learn how storage is partitioned, meaning if figures, etc. And how to recover lost data.

:)
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 29, 2014, 03:14:35 PM
:)

Cool.. I will try to make it somehow!

What about mydata.gz, isent that backup of what needed ??
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 30, 2014, 12:20:33 PM
Hi...

I now have created this 'beta' script, which switch between two kernel's, cmdline, config.txt, initrd and set tce=mmcblk0p2/tce-b visa versa /tce

I tried booting, as this, resulting in "ofcause" no ethernet, as openssh, was not "loaded" at boot.

I then copyed openssh + openssl onto mmcblk0p2/tce-b/optional, and put in the line in onboot.lst : openssh.tcz
But still no ethernet  ::)

What am i missing here ?

Regards;
   Jesper.

Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 30, 2014, 01:22:08 PM
Is openssh started in bootlocal.sh?
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 30, 2014, 03:31:45 PM
Hi...

Yes now it is..

Did an extract of my MYDATA.TGZ, kernel B boots now, and i can login via ssh now :)

But i am fighting some permissions, giving me no access to home/tc ;-)

Will look at it tomorrow...

Good evening
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 30, 2014, 03:58:29 PM
Bela'

Btw: do you have an default mydata.tgz, you use for the images ??

Regards;
   Jesper
Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 30, 2014, 04:21:08 PM
Download and check :) For SSH yes.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 30, 2014, 05:54:04 PM
 :)

Sry... Lost it i guess...

Download and check ?..

Regards;
   jesper.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: bmarkus on October 31, 2014, 02:07:38 AM
Download the piCore distribution SD card images and check mydata.gz
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 31, 2014, 06:21:13 AM
Ahh... Okay
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on October 31, 2014, 01:11:47 PM
 :)

Soo...!

While trying, i need a tcz, for creating vfat (mkfs.vfat) -Having hard time finding that ?

does it excist ?

Regards;
   Jesper.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: Rich on October 31, 2014, 01:44:32 PM
Hi lykkedk
Try  dosfstools.tcz
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on November 01, 2014, 02:25:59 PM
Rich, Bela'

Thanks...

I finally made it  :)

Quote
tc@box:~$ df -h /dev/mmcblk0p1
Filesystem                Size      Used Available Use% Mounted on
/dev/mmcblk0p1          286.0M     16.7M    269.2M   6% /mnt/mmcblk0p1
tc@box:~$ df -h /dev/mmcblk0p2
Filesystem                Size      Used Available Use% Mounted on
/dev/mmcblk0p2            2.0G     85.2M      1.8G   4% /mnt/mmcblk0p2

It's a bit geeky  8) to make it work, but i figured out along the way, that mydata.gz, included most, of what i wanted!

So... i now have a working piCore again  :), with a ~300Mb /boot partition.

BACK! to work, with my script, which will make a kind of switchable piCore possible.

I will hereby, tell, what my plan is:

Once one login with SSH, a quistion will be prompted, if one will change kernel (e.g 3.16.3 or 3.17.1 etc... etc.. etc.), then one can choose, to either quit, change kernel or make backup of kernel etc... etc.. etc.! ... also script, will prompt, if you want to tce-load some programs, which one uses only if one login into piCore.
-A bit hard to understand, but i will try to explain here. I normally use piCore, as a squeezebox substitute, playing .flac's, spootyfi, radio and so on, on my everyday normal living  :)... If i do not login, i am only interessted in having my RPI, run at it's minimum work, so that i can enjoy my other geek, interesst, namely do it yourself audio, with my highened class-A amp, preamp etc... etc..  8) - Enjoying music pure.

So what do you guy's think ??? am i crazy ??? - well... no matter what good evening, and rest good weekend

Regards;
   Jesper.


Title: Re: Expanding /mnt/mmcblk0p1
Post by: andriusr on February 21, 2015, 05:11:48 PM
Quote
- backup content of /mnt/mmcblk0p1
- delete all partitions
- create a new VFAT partition starting at the same sector as deleted 1st partition started in any size
- format this partition (/dev/mmcblk0p1)
- copy files you saved in first step
Would it be possible to provide more details how to do this? When I create new larger VFAT partition in mmcblk0p1, the kernel says that it is not aware of the changes. When I reboot the files are not here I guess and system fails to start.
Title: Re: Expanding /mnt/mmcblk0p1
Post by: lykkedk on February 22, 2015, 05:26:25 AM
Quote
- backup content of /mnt/mmcblk0p1
- delete all partitions
- create a new VFAT partition starting at the same sector as deleted 1st partition started in any size
- format this partition (/dev/mmcblk0p1)
- copy files you saved in first step
Would it be possible to provide more details how to do this? When I create new larger VFAT partition in mmcblk0p1, the kernel says that it is not aware of the changes. When I reboot the files are not here I guess and system fails to start.

Hi...

What i needed here, was place for keeping other kernels etc... (initrd), therefore i was at that time, expanding the mmcblk0p1 partition.
Later i figured out howto copy all files from another partition(/dev/mmcblk0p3) instead! - This is much easier :)

http://stackoverflow.com/questions/3643848/copy-files-from-one-directory-into-an-existing-directory (http://stackoverflow.com/questions/3643848/copy-files-from-one-directory-into-an-existing-directory)

Hope i get you the idea ?

RG; Jesper.