How to expand SD card filesystem

Raspberry Pi related support

How to expand SD card filesystem

Postby ucap63 » 13 Jun 2015, 12:31

Hello,
I am pretty new to Linux and hope someone can help me.
I have installed Rune version 0.3-bet build 20141029 on a Raspberry B+. I am using a 4GB SD card, not sure about the class but I don't think it matters at this moment. Everything works fine: I can mount NAS, USB disks, I can ssh to the Raspi but I am in troubles when I try to expand the filesystem. I don't have a running Linux on other machines, so I have to rely on the Raspi command line and this is what happens. My partition looks like the following:

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 186367 184320 90M c W95 FAT32 (LBA)
/dev/mmcblk0p2 186368 3667967 3481600 1.7G 5 Extended
/dev/mmcblk0p5 188416 3667967 3479552 1.7G 83 Linux

I followed the guide reported somewhere in the forum:

Delete the second partition /dev/mmcblk0p2
d
2

Create a new primary partition and use default sizes prompted. This will then create a
partiton that fills the disk
n
p
2
enter
enter

Save and exit fdisk:
w

After saving the changes I got the following error message:

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: 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)

Well, if I reboot the system stucks in the boot state. I had to reinstall the image and I tried several time without no success. I also tried to run partprobe and kpartx but these commands were not recognized by Rune.
I have also tried to follow what stated in this forum: http://archlinuxarm.org/forum/viewtopic.php?f=31&t=3119
but once again, no success.
How can I solve this issue?
Thanks for your help.
ucap63
 
Posts: 3
Joined: 12 Jun 2015, 05:09
Location: Torino - Italy

Re: How to expand SD card filesystem

Postby schinken » 18 Jun 2015, 08:57

I think you first need to delete partition 5, it sits on top of partition 2. Then you have to create again an extended partition (new 2) and the logical partition (5) inside that.
Before and after doing the fdisk-stuff do a sync command to be sure, everything is written.
schinken
 
Posts: 8
Joined: 13 May 2015, 10:25

Re: How to expand SD card filesystem

Postby ucap63 » 18 Jun 2015, 21:40

Thanks schinken but when I try to create the logical partition 5 after recreating the 2, I got an error message telling me that partition 5 already exists! This is what I did:

delete partition 2:
Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.


Create partition 2:
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 2
First sector (186368-7744511, default 186368):
Last sector, +sectors or +size{K,M,G,T,P} (186368-7744511, default 7744511):

Created a new partition 2 of type 'Extended' and of size 3.6 GiB.


Create partition 5:
Command (m for help): n
Partition type
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l

Adding logical partition 5
Partition 5 is already defined. Delete it before re-adding it.
ucap63
 
Posts: 3
Joined: 12 Jun 2015, 05:09
Location: Torino - Italy

Re: How to expand SD card filesystem

Postby accab » 20 Jun 2015, 07:11

For what it's worth, I just did this successfully. I used the stock image for beta 0.3 on a raspberry pi 2, with a 32G SD card.

I did not have a partition 5 at all when I started - only partitions 1 and 2. So I don't know where your partition 5 came from. And it looks, from your account, as if you did not delete partition 5 before deleting partition 2, which might have confused things.

But following the instructions on the linked page, starting with
Code: Select all
fdisk -l
to get the partition table, I got to the stage where you reboot, having rewritten the partition table. There was then a warning, in red, which I ignored, about the kernel still using the old sizes. Typed
Code: Select all
 shutdown -r now
and when the system came up again
Code: Select all
 resize2fs /dev/mmcblk0p2
This gave me the result
Code: Select all
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p2 is now 7789312 (4k) blocks long.

and then
Code: Select all
runeaudio# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  1.4G   27G   6% /
devtmpfs        367M     0  367M   0% /dev
tmpfs           371M     0  371M   0% /dev/shm
tmpfs           371M  356K  371M   1% /run
tmpfs           371M     0  371M   0% /sys/fs/cgroup
tmpfs           371M     0  371M   0% /tmp
logs            5.0M   24K  5.0M   1% /var/log
rune-logs       5.0M  344K  4.7M   7% /var/log/runeaudio
/dev/mmcblk0p1  100M   12M   88M  12% /boot
accab
 
Posts: 1
Joined: 20 Jun 2015, 06:36

Re: How to expand SD card filesystem

Postby ucap63 » 20 Jun 2015, 11:07

I finally didi it!
I followed the instructions given here: https://raspberry-hosting.com/en/faq/how-expand-arch-linux-root-partition. As mentioned before, on step 4 I got this error message:

Partition 5 is already defined. Delete it before re-adding it.

Well, I deleted the partition 5 and followed the next instructions. Then, I did a sync before rebooting and now things are working perfectly.

Thanks everybody for your suggestions and comments.
ucap63
 
Posts: 3
Joined: 12 Jun 2015, 05:09
Location: Torino - Italy

Re: How to expand SD card filesystem

Postby Bruce » 24 Jun 2015, 18:31

The instructions on http://archlinuxarm.org/forum/viewtopic ... 119#p18160 worked perfectly for my Pi 2 with version 0.3.
Bruce
 
Posts: 4
Joined: 18 Jun 2015, 18:36

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 3 guests