Resizing Openelec 'Storage' partition

22 posts
by enuui » Mon Jan 14, 2013 4:34 pm
Hi, I'm trying to figure out if I can do a resize of the storage (/dev/mmcblkp02) partition on OpenElec.Tried loads of googling but kinda getting lost in it all as I'm new to Linux.

So I have my Pi running the latest openelec xbmc build, which I installed via a precompiled image on to my 32GB SD card, and I want to drop a few HD films over onto the card but because it was a precompile I think its only taking up just under a gig and I can't (or don't know how to) see the rest of the space, so can someone help me with the commands I need to put in, to expand the storage partition to fill the rest of the space (got the PC linked up to the Pi with PuTTy btw), if possible that is.

ta muchly
Posts: 4
Joined: Sun Dec 09, 2012 12:33 pm
by Revmacd » Mon Jan 14, 2013 4:54 pm
Hi enuui. I'm interested in Openelec as a digital signage solution myself but haven't gotten around to it yet. Maybe we can help each other out here. I'm no expert by any stretch but I have figured out how to recover the unused space on my sd card thanks to all the good advice in this forum.

If you can open a terminal or get to a command line on boot up, type; sudo raspi-config and hit enter. It will open an awkward interface in which you can make some changes to the configuration. One of the options is to recover the unused space on the sd card.

The reason I call the interface awkward is you actually use the tab key to highlight selections and then hit enter to execute them, rather than just using the arrows and enter. It feels a little awkward to use but does the job.

So try it, and if it works for you, come back to this thread and let me know if it worked and also tell me a little about your media center. Are you using it for signage? If not, what plug ins are you using and how are they working? Nothing too in depth. I'm just interested in a new openelec users initial impressions.

Good luck.
Posts: 2
Joined: Tue Sep 18, 2012 9:50 pm
by enuui » Mon Jan 14, 2013 5:06 pm
Hey. Cheers, but sudo raspi-config doesn't seem to work on OpenElec
I've used it before on my other SD card with Raspbian installed.

I'm using OpenElec just to play some HD films really, as I've had my HD TV for 3 years and it never had any HD through it until I got the Pi. I have a few plugins installed just to check them out, like Rockpalast for some concerts, BBC Iplayer.

Saturday just gone I got a new SD card, as my last one was borrowed, so just trying to get a sweet setup where I can easily access films and stuff either by dropping them onto the card - or over wireless (and today is the first day I've accessed the Pi via SSH, all new things to me really)
Posts: 4
Joined: Sun Dec 09, 2012 12:33 pm
by FADpi » Thu Jan 17, 2013 1:20 am
hey guys,

i am not sure which version of openelec you two are using but I installed the latest "OpenELEC 3.0 RC 1 (2.99.1)" which was released on Jan 3rd 2013 and I didn't need to resize my card since the installing script "create_sdcard" which comes with it creates the second partition with whatever space left in the card.

this is the part of the script that creates the partitions:
Code: Select all
  parted -s "$DISK" unit cyl mkpart primary fat32 -- 0 16
  parted -s "$DISK" unit cyl mkpart primary ext2 -- 16 -2

as you see the second partition starts from 16 (which is the end of the first partition) and ends at -2 (negative value means start counting backward from the end of the drive)

So the script creates the first partition with a fixed size then creates the second partition with the remaining free space.

However, if you already have an sd-card with a small partition then i would suggest using GParted (from your computer) which is a GUI for parted to resize, the app is really easy to use. Resizing from within the Rpi is still possible but it will require un-mounting the second partition. *I assumed that you two are using linux based on your posts.
User avatar
Posts: 10
Joined: Tue Nov 06, 2012 10:52 pm
by madog » Sat Feb 23, 2013 3:06 am
I just did a fresh install of 2.99.3 and my /storage shows 755.9/M on my 16GB flash drive (14GB usable).

How did you install OE, through Linux or Windows/Mac? Can I run that script manually?
Posts: 5
Joined: Thu Feb 21, 2013 8:05 pm
by Cloudcentric » Sat Feb 23, 2013 7:33 am
I know everything about nothing"
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am
by madog » Sat Feb 23, 2013 10:26 pm
Cloudcentric wrote:

I found that pretty late in the night and followed these directions and it worked (for any future searchers):

SSH in as root
By default you’re in /storage; switch to root partition:
cd /
Keep XBMC from restarting:
touch /var/lock/xbmc.disabled
Stop XBMC, so we can unmount /storage:
killall -9 xbmc.bin
umount /storage
Verify mounts:
parted /dev/mmcblk0
In parted:
change to sectors display:
unit s
show partitions, make note of starting sector of your partition:
remove the partition:
rm 2
re-create it, using same starting sector # and ending of -1 to use remaining space:
mkpart primary 258048 -1
quit parted
e2fsck -f /dev/mmcblk0p2
resize2fs /dev/mmcblk0p2
mount /dev/mmcblk0p2 /storage
df -h
rm /var/lock/xbmc.disabled
XBMC will start up again

I'm a beginner linux user (just know ls and such), so I had no idea what I was doing there, but it worked. Now I just need to know how to actually utilize the /storage drive :P

The quest never ends!
Posts: 5
Joined: Thu Feb 21, 2013 8:05 pm
by hurrand » Thu Mar 28, 2013 9:00 pm
Posts: 1
Joined: Thu Mar 28, 2013 8:59 pm
by gtuvell » Thu Apr 11, 2013 8:56 pm
Wow. This worked perfectly!! Thanks! I'm also a novice linux user and that was way over my head..but the commands worked flawlessly to resize it.
Posts: 1
Joined: Thu Apr 11, 2013 8:54 pm
by phgelin » Wed May 08, 2013 2:03 pm
Woww.. all my congratulation for this clean and efficient way to resize the SD card.
Exactly what I needed.

Two thumbs up.
Posts: 1
Joined: Wed May 08, 2013 1:59 pm
by ulysess » Wed May 08, 2013 6:04 pm
What about to use Gparted? Clean and easy! ;)
Mis apuntes de...Raspberry Pi:
Google Docs RPi:
Posts: 249
Joined: Thu Aug 02, 2012 6:35 am
Location: Spain
by alecjcook » Wed May 15, 2013 9:54 pm
Hi. I have openelec 3.0.2 (frodo 12.2), and when I try

Code: Select all
umount /storage

I get:
Code: Select all
umount: can't umount /storage: Device or resource busy
Posts: 2
Joined: Sat May 04, 2013 4:38 pm
by METDeath » Sat May 18, 2013 3:07 am
alecjcook wrote:Hi. I have openelec 3.0.2 (frodo 12.2), and when I try

Code: Select all
umount /storage

I get:
Code: Select all
umount: can't umount /storage: Device or resource busy

I had the same problem, make sure you aren't accessing one of the samba shares, and it may take a minute for it to become not busy. It took less than one minute for it to work on my Pi after I closed the Windows Explorer window that was pointed at the Pi.
Posts: 3
Joined: Thu Nov 29, 2012 4:31 am
by pazure » Sat May 18, 2013 2:42 pm
METDeath, make sure you aren't typing


(with the letter "n"). The command is umount


Posts: 1
Joined: Sat May 18, 2013 2:39 pm
by jdenbrok » Tue Jun 04, 2013 9:40 pm
fuser -m /storage

to see what processes are still open and stopping you from umount /storage
Posts: 1
Joined: Tue Jun 04, 2013 9:38 pm
by angad16 » Tue Jun 25, 2013 11:25 am
So I just resized the partition and now airplay won't work nor can I access files using samba.

Any help in diagnosing the issue will be greatly appreciated.

Posts: 1
Joined: Tue Jun 25, 2013 11:22 am
by studiord » Wed Jul 10, 2013 3:39 pm
jdenbrok wrote:jdenbrok

I did that and this is what I got :

openelec:/ # fuser -m /storage
1567 1568

How do I close these processes ? Also, can I make the root partition 256mb instead of the default 128mb ?
Posts: 2
Joined: Sun May 12, 2013 7:33 am
by rgvraspi » Thu Jul 11, 2013 11:46 pm
What I do, since I have a Windows Machine, is run a copy of Ubuntu Linux in VirtualBox. I then mount my Card Reader inside VirtualBox and run gparted to resize the partitions on the SD Card. The versions of gparted I found for Windows seemed to only be usable via booting a CD or USB which is a bit inconvenient. Using VirtualBox also allows me access to run certain Linux utilities when I need them without having to dual boot.
Posts: 31
Joined: Sat Nov 03, 2012 3:38 pm
Location: USA
by nathankeltner » Sat Nov 09, 2013 10:53 pm
Just a couple of pointers, because I found this while running into the same problems.

First, if you get this error:

umount: can't umount /storage: Device or resource busy

You have to stop whatever processes are touching /storage. When you run fuser -m /storage, depending on options, there might be a couple, but the only one that gives you trouble is connmand. When you kill it, it automatically restarts.

However, there's a small window, so if you run:

OpenELEC:/ # kill -9 <connmand pid> && umount /storage

It'll go ahead and unmount and let you resize it.

Hope that helps!

Posts: 1
Joined: Sat Nov 09, 2013 10:50 pm
by bobby » Sun Dec 29, 2013 8:13 pm
How ridiculous, I still can't unmount the storage partition.
I installed using a mac so there's no option to set the storage partitions size when using dd
Posts: 1
Joined: Sun Dec 29, 2013 7:42 pm
by ignaciowd » Sun Apr 27, 2014 8:33 pm
you are probably on /storage
type "pwd" it will tell you which is your current directory.
then cd .. to go to the upper direcotry

try again the umount
Posts: 1
Joined: Sun Apr 27, 2014 8:32 pm
by TylerD75 » Fri Aug 22, 2014 7:54 pm
I know this might be a bit late, but I encountered the same issue, and found a much simpler way to resize the /storage partition here:

Log in as root (ssh).
Code: Select all
# touch /storage/.please_resize_me

Then simply reboot, and the resizing will be done automagically.
Posts: 2
Joined: Fri Aug 22, 2014 1:39 pm