Rich Freeman on 31 Jan 2013 17:33:01 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Using resize2fs


On Thu, Jan 31, 2013 at 8:15 PM, Eric H. Johnson
<ejohnson@camalytics.com> wrote:
> I have tried this both when mounted to another Linux computer and after booting to the SD. In both cases it basically says "nothing to do".  If I give it a size of 15G it says only so many blocks are available and I asked for a whole lot more.
>
> How do I expand the 3.9GB partition to use the remainder of the SD without losing data?

Might not hurt to give actual commands and responses, as it is easy to
miscommunicate.  Include:
fdisk -l
df -h (with the partition mounted)

That said, your first issue is that your filesystem can't be bigger
than the partition it is on, and that is only 4GB.  So, you first need
to edit the partition table to extend the partition to fill the
remaining space.  Something like qtparted can probably do the job - or
you can just delete and re-create the partition but if you do this you
MUST make sure the starting position is the same.  Oh, and don't do
this part with the filesystem mounted (unless you're using LVM).

Once the partition is resized then just run resize2fs <device> and it
will be resized to the full size of the partition.  This part can run
while mounted, but I'd avoid that if you can just the same.

With LVM all this stuff is a breeze - you can grow, shrink, as much as
you want with everything online.

Oh, be aware that ext2/3/4 have a fixed number of inodes at filesystem
creation - so unless it was created with an unusually large number of
inodes you can't resize more than a few orders of magnitude before you
run out of them.  If you're storing digital video or something that
isn't a big deal, but if you're storing lots of small files it
definitely is one (in fact, on small filesystems even the defaults can
be pretty sparse on inodes).  That is one of the benefits of btrfs -
everything is dynamic.

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug