How to expand a20-lime2_debian_3.4.90_release_2.img to full size of sd card?

Started by lavisrap, January 17, 2015, 12:52:04 PM

Previous topic - Next topic

lavisrap

Hi,

I created a boot sd card from the a20-lime2_debian_3.4.90_release_2.img image. And if works fine.

When I tried to expand the file system I get a problem. First I create a bigger partition with fdisk andit looks like this:

root@toshiba:~# fdisk /dev/mmcblk0

Command (m for help): p

Disk /dev/mmcblk0: 31.9 GB, 31914983424 bytes
4 heads, 16 sectors/track, 973968 cylinders, total 62333952 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: 0x6f20736b

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       34814       16383+  83  Linux
/dev/mmcblk0p2           34815    62333951    31149568+  83  Linux

Command (m for help):

After reboot I try to expand the file system and I get following error message:

root@toshiba:~# resize2fs /dev/mmcblk0p2
resize2fs 1.42.5 (29-Jul-2012)
resize2fs: Ungültige magische Zahl im Superblock beim Versuch, /dev/mmcblk0p2 zu öffnen
Kann keinen gültigen Dateisystem-Superblock finden.

(Meaning: Not valid magic number in super block trying to open /dev/mmblk0p2. Cannot find a valid file system super block.)

What do I do wrong?



Gerrit

QuoteWhat do I do wrong?
Just expanding the partition does not expand the file system.

The most easy way in my opinion if you have an other Linux system, copy all files from p2 to your harddisk, become root first, delete the p2 partition and create it again with the new size, and format the new partition

mkfs.ext4 /dev/mmcblk0p2

and copy the files back to p2

I made a mistake it has to be ext3 but to be sure check first with the mount command which it is

mkfs.ext3 /dev/mmcblk0p2

lavisrap

@Gerrit

Do you to commands to do that? E.g. do you mean copy with dd? Or normal cp?


MBR

And if you dont have a running Linux system, try to boot from some LiveCD (I recommend SystemRescueCd, see http://www.sysresccd.org/) and use automated tools like gparted for partition and filesystem expansion, because it's very easy to make a mistake in the partition/filesystem sizes.

BTW, only the very begining of disk and the first partition must be left intact, but the second one can be freely modified (e.g. deleted and recreated) as long as the filesystem is of the same type (in this case, the Ext4) and all the files are there, with correct modes and permisions.

Gerrit

Quote from: lavisrap on January 17, 2015, 04:55:28 PM
@Gerrit

Do you to commands to do that? E.g. do you mean copy with dd? Or normal cp?

I prefer Midnight Commander it is a visual file manager you can start it with mc from the commandline.
On Debian or Ubuntu you can install it with apt-get install mc

make sure you run it as root so all permissions stay intact.


frederic_alexandre

You might also try to dd command.
This command is used to bitwise copy data

Gerrit

Quote from: frederic_alexandre on January 18, 2015, 08:09:39 PM
You might also try to dd command.
This command is used to bitwise copy data

No in this case he can not, you can use it to copy a partition yes, but not files in inclusive sub directions and permissions from one file system into an other.