• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Huge rootfs copy to sd-card?  (Read 2685 times)
riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« on: August 31, 2009, 04:06:37 AM »

Code:
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  519168    296016    223152  58% /
tmpfs                   256872         0    256872   0% /lib/init/rw
varrun                  256872       284    256588   1% /var/run
varlock                 256872         0    256872   0% /var/lock
udev                    256872       128    256744   1% /dev
tmpfs                   256872         0    256872   0% /dev/shm
tmpfs                   256872     10912    245960   5% /var/cache/apt
/dev/mmcblk0p1         1929612      2880   1828712   1% /mnt/sdcard

SD kaart empty

Then i copy
> cp -ax / /mnt/sdcard

na:

Code:
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  519168    288940    230228  56% /
tmpfs                   256872         0    256872   0% /lib/init/rw
varrun                  256872       284    256588   1% /var/run
varlock                 256872         0    256872   0% /var/lock
udev                    256872       128    256744   1% /dev
tmpfs                   256872         0    256872   0% /dev/shm
tmpfs                   256872     10912    245960   5% /var/cache/apt
/dev/mmcblk0p1         1929612    685076   1146516  38% /mnt/sdcard

It uses 700Mb! How is that explained?
Logged

Rabeeh Khoury
Administrator
Full Member
*****

Karma: 5
Posts: 218


View Profile
« Reply #1 on: September 01, 2009, 07:11:51 AM »

The plug uses compressed filesystem on the internal NAND flash.
Logged

riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« Reply #2 on: September 01, 2009, 04:08:11 PM »

Aha, I see. Makes quite a difference!

Is it the reason why using SD for filesystem, uncompressed, is this much faster?
Logged

Rabeeh Khoury
Administrator
Full Member
*****

Karma: 5
Posts: 218


View Profile
« Reply #3 on: September 02, 2009, 03:52:20 AM »

It's a thing that developers are used to.
When using NAND flash directly connected to the chip; you use JFFS2/Yaffs/ubifs which all uses compression by default
When using SD / USB stick / USB HDD etc..; you use ext2/ext3/xfs/reiserfs which all don't support compression; although you can different filesystems intended for block devices that uses compression.
Logged

riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« Reply #4 on: September 02, 2009, 05:29:33 AM »

All makes sense Smiley

Thank you!
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #5 on: September 02, 2009, 08:54:17 AM »

Hmm...  I do not think I see this type of expansion when copying just the nand rootfs to an sdcard.  Are you copying just the rootfs only, or the uImage too?  Once when I saw this type of double size, it was caused by a pilot error here, because in a second time copy the whole rootfs got copied under in subdirectory.  Perhaps I am misundertanding this?  Am eager to follow this up...
Logged

Cordially, CqCn

riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« Reply #6 on: September 02, 2009, 09:21:49 AM »

I just did the

cp -ax / /mnt/sd

Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #7 on: September 02, 2009, 10:55:43 AM »

riel,  When I did copy many weeks ago, I kept a copy of my directory numbers.  I copied from the internal nand, just the rootfs while running from the nand, to an external sdcard in the sdcard slot.  Here is the before after numbers, which are very close, the small size difference in my case is because of the larger directory space of my 2GB sdcard.  I was USING EXT2 FILE SYSTEM.

Before the copy
Code:
>mkfs -t ext2 /dev/mmcblk0p1
>mkdir /mnt/sdcard
>mount /dev/mmcblk0p1 /mnt/sdcard
>df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  519168    151100    368068  30% /
tmpfs                   257816         0    257816   0% /lib/init/rw
varrun                  257816        36    257780   1% /var/run
varlock                 257816         0    257816   0% /var/lock
udev                    257816        12    257804   1% /dev
tmpfs                   257816         0    257816   0% /dev/shm
tmpfs                   257816         0    257816   0% /var/cache/apt
/dev/mmcblk0p1         1965176      2928   1862420   1% /mnt/sdcard

After copy:
Code:
>cp -ax / /mnt/sdcard # takes 13 minutes
>cp -a /dev /mnt/sdcard
>df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  519168    151100    368068  30% /
tmpfs                   257816         0    257816   0% /lib/init/rw
varrun                  257816        36    257780   1% /var/run
varlock                 257816         0    257816   0% /var/lock
udev                    257816        12    257804   1% /dev
tmpfs                   257816         0    257816   0% /dev/shm
tmpfs                   257816         0    257816   0% /var/cache/apt
/dev/mmcblk0p1         1965176    300072   1565276  17% /mnt/sdcard

Does this not look different from what you got?  Were you using ext3 ??
Logged

Cordially, CqCn

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #8 on: September 02, 2009, 12:52:58 PM »

It is probably because riel had more stuff (and slightly more compressible stuff) on his NAND partition than you did, CqCn:  His file system copy expanded from 288940 blocks to 685076, whereas yours expanded from 151100 to 300072.
Logged

riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« Reply #9 on: September 02, 2009, 02:07:58 PM »

It's quite a good compression the JFFS2 file system  is managing then.

I will make a backup of current filesystem to tar and see if indeed I get around a 50% compression. But I believe the copying went just fine Wink
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #10 on: September 02, 2009, 05:57:13 PM »

restamp, That was a very bad eye I had here (sheepishly grining)  Embarrassed  When I was quickly looking at my saved log, which was not in fixed space font, and the two numbers aligned differently and I had thought they were similar in the 30k area for me Smiley  This is good to know.

Now that I learned this, I cannot resist asking:  can we not use the similar/same compressed fs on the external sd card?  Would be interested in knowing about this, and side effects if any.  I would not really be sharing my rootfs with anything else like NFS, Samba; all interface is directly to the ShPg.
Logged

Cordially, CqCn

riel
Newbie
*

Karma: -2
Posts: 22


View Profile
« Reply #11 on: September 03, 2009, 02:45:19 AM »

I see no reason why it would not work.

I wonder what the speed will be, theoretically it should increase since writing/reading less bits should be faster.
As long as the processor keeps up, but I don't think that's a problem.

Logged

Pages: [1]
Print
Jump to: