Hi,
I was looking for a way to properly extant the 4GB install imaged of Emoncms to my fill my 8GB SD.
I looked and find tutorials about it for Raspberry, but its all start by deleting partition 2 and partition 3 with fdisk to permit to extend partition 1.
I realized (after a first try) that partition 3 is used by mounts for mysql and maybe other things in /home/pi/data
fstab :
/dev/mmcblk0p3 /home/pi/data
So I was wondering what will be the best practices to extand the partition in the emoncms SD image environnement.
Regards.
Re: RaspB+ and SD card Extend
When using fdisk normally you delete a partition and recreate it without the data being deleted, having the 3rd partition may complicate the procedure but the theory and the commands should be the same, you just have to accommodate the extra partition. (Bra1n made some notes about expanding partitions in this thread)
Probably the easiest way of dealing with the "data" partition if it's causing an issue, is to move (delete and recreate) just the "data" partition to create a gap for the 2nd partition to be increased into. reboot and then increase the size of the 2nd partition as a second stage.
The fstab shouldn't need editing, but if you want you can comment out that line while moving the "data" partition, the temporary absence of the "data" partition will prevent SQL and emonCMS from working but they should be fine once you have finished and "data" is accessible again.
You will also need to run
after moving the partitions to expand the file system to the size of the 2nd partition.
Paul
Re: RaspB+ and SD card Extend
Hi thanks pb66,
I tried this way.
-Stop mysql service
- copy and backup /home/pi/data/* (and preserve rights and owners)
- fdisk, and delete the data partition
- fdisk and delete the root partition
- fdisk recreate the root partition with the space used before by root + data
- fdisk create a new partition with the and of the 8GB SD (the last 4GB)
- save and reboot
- sudo resize2fs /dev/mmcblk0p2
- reboot
I have :
Command (m for help): ^Cpi@raspberrypi ~ $ sudo fdisk /dev/mmcblk0 -l
Disk /dev/mmcblk0: 7861 MB, 7861174272 bytes
4 heads, 16 sectors/track, 239904 cylinders, total 15353856 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b5098
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 7626751 3751936 83 Linux
/dev/mmcblk0p3 7826752 15353855 3763552 83 Linux
But I have still the same error, when trying to run :
sudo service mysql start :
pi@raspberrypi ~ $ sudo service mysql start
df: `/home/pi/data/mysql/.': No such file or directory
df: no file systems processed
[FAIL] /etc/init.d/mysql: ERROR: The partition with /home/pi/data/mysql is too full! ... failed!
An idea ?
Re: RaspB+ and SD card Extend
I think you should do this in 2 steps rather than all in one, postpone extending and expanding partition 2 until 3 is working.
You could try creating a new data partition first and then copy the partition using dd before deleting the old partition, I believe the partitions are dynamically numbered so the newly created " 4th " partition will still be "mmcblk0p3" once the 3rd partition is deleted.
1) create 4th partition using fdisk
2) copy the third partition to the 4th partition using
3) delete 3rd partition, reboot and test.
Then if it was successful extend and expand the 2nd partition.
Paul
Re: RaspB+ and SD card Extend
Thanks Paul !
Now it's working.
But I have now a new question related to what I'm trying to do (I maybe would have ask before, anyway...)
I can't figured out where are stored the data-point exactly ?
I see nothing in the sql-table , only the feeds config entries but not the feed contents.
I heard about a "timestore" stuff (don't know how is package the SD image) but I didn't find it.
I also read a thread about calculating how much storage realtime feeds takes...
My question is, does those data values or stored in the third partition ?
Because, my initial purpose was of course to add storage for that partition and not another....
Thanks.
Re: RaspB+ and SD card Extend
Only the data framework is stored in MYSQL, ie the things that do not readily change, whilst the actual feed data is contained in folders. Try;/var/lib/phpfiwa/var/lib/phpfina
/var/lib/phptimeseries
/var/lib/timestore
PaulSee correct answer from Paul#2 in next post!
Paul
Re: RaspB+ and SD card Extend
Normally that's where you would find them, but on the SD card image the feed data is in folders on the data partition, as the main partition is read only, see "create data repositories for emoncms feed engines" the image build guide gives you details of what's put where.
Paul
Re: RaspB+ and SD card Extend
Hi, i'm a noob
and i'm experiencing the same problem, i tried the steps you mentioned above, but no result. Any help?
Why does the expand file system option in raspi-config not work?
Thanks
Re: RaspB+ and SD card Extend
Because it doesn't know how to cope with the 3rd partition.
Certainly, but you'll need to expand a little!
Paul
Re: RaspB+ and SD card Extend
Paul, I made all the steps you mentioned, but the disk partition numbers didn't dynamically changed, so I have 1 2 and 4 now. Is there any methods to change the numbers?
Re: RaspB+ and SD card Extend
Did you reboot ? The partition numbers are allocated at boot, in sequence, so I would of thought by very definition you can only have a 4th if there is a 3rd.
Re: RaspB+ and SD card Extend
Yes, I rebooted. I don't know what to do now, I'd tried many ways, but the way you suggested is not working right in my case.
Re: RaspB+ and SD card Extend
Here are my steps (briefly):
pi@raspberrypi ~ $ sudo service mysql status
[info] MySQL is stopped..
pi@raspberrypi ~ $ sudo fdisk /dev/mmcblk0
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 5785599 2831360 83 Linux
/dev/mmcblk0p3 5785600 7626751 920576 83 Linux
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): p
Selected partition 4
First sector (2048-15759359, default 2048): 10000000
Last sector, +sectors or +size{K,M,G} (10000000-15759359, default 15759359):
Using default value 15759359
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 5785599 2831360 83 Linux
/dev/mmcblk0p3 5785600 7626751 920576 83 Linux
/dev/mmcblk0p4 10000000 15759359 2879680 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
pi@raspberrypi ~ $ sudo reboot
Re: RaspB+ and SD card Extend
The steps you have shown above only shows adding a 4th partition, which is just the first step.
After rebooting you should have 3 partitions (1, 2 & 4 but now labeled as 1, 2 & 3) and there should be enough room to increase the size of partition 2 (into where 3 was before it was deleted to make a hole), once you have increased partition 2 using fdisk, you will need to run " sudo resize2fs /dev/mmcblk0p2 " remember to use " rpi-rw " again after rebooting to ensure you are not in read-only mode.
Paul
Re: RaspB+ and SD card Extend
I did all steps and now I have:
/dev/mmcblk0p1 = 56Mb - 36% used
/dev/root = 2.7Gb - 100% used
/dev/mmcblk0p4 = 2.6Gb - 2% used
*** /dev/root = /dev/mmcblk0p2
When I try to increase /dev/mmcblk0p2:
Any idea? How can I solve this? It appear not able to extand /dev/root.
Re: RaspB+ and SD card Extend
You haven't completed all of the stages
After rebooting you should have 3 partitions (1, 2 & 4 but now labeled as 1, 2 & 3) and there should be enough room to increase the size of partition 2 (into where 3 was before it was deleted to make a hole), once you have increased partition 2 using fdisk, you will need to run " sudo resize2fs /dev/mmcblk0p2 " remember to use " rpi-rw " again after rebooting to ensure you are not in read-only mode.
You still need to increase the size of the 2nd partition before you can expand the filesystem. So far all have have done is made a gap for the partition.
Using fdisk you will need to "delete" the 2nd partition and create a "new" larger partition in it's place, when this is done as one set of operations and "written" once it has the effect of just changing the size no data is deleted or moved, after which you should have something like
the "80000000" can be anything between the original end (5822463) and the start of 3rd partition -1 (9999999).
Then you can expand the filesystem.
Paul
Re: RaspB+ and SD card Extend
I downloaded Gparted and created a bootable USB. (http://gparted.org/liveusb.php)
Than I started my Mac with this USB and changed the size of 2nd and 3rd partitions to use the entire 8Gb SD-card.
Now I have 3.5Gb for 2nd partition and more 3.8Gb for 3rd partition and all works perfectly.
Thanx!