Active Topics

 


Reply
Thread Tools
Posts: 131 | Thanked: 36 times | Joined on Dec 2009 @ Spain
#1
Since my N800 was out of battery in a very short time and after check that It happens when I was running maemo from the SD ext3 filesystem.

I decided to backup the files, format and restore them using a linux desktop and a SD reader.

I had a some errors uncompressing tar file, Steps I did:

(execution commands as root (sudo)
1. image backup of partition
dd -if .... -of ....img
2 tar -cf backup.tar /media/myN800
3 format ext3 partition with Qparteditor
4 uncompress tar file from desktop to SD ext3 partition
(after some hours I received errors in some files)

5 Try N800 without success

I think I can use the dd command to restore my backup image and return to the previous state, however, dd will place the content with the same initial fragmentation and I would like to avoid that file fragmentation.

What do you think about?
What about pipe the output of dd with the input of tar and create new tar file?
is ext3 a good filesystem for flash memory?
 
Posts: 1,225 | Thanked: 1,905 times | Joined on Feb 2011 @ Quezon City, Philippines
#2
You should have made a blank ext3 disk image and
Code:
cp -a /media/N800 /mnt/diskimage
and formatted the SDcard, then
Code:
cp -a /mnt/diskimage /media/N800
IMO, ext2 is better for flash memory, as the journaling of EXT3 will quickly wear flash out. EXT4 does behave well on flash though, but I don't think it's available on the N800's ancient kernel.
__________________
N9 PR 1.3 Open Mode + kernel-plus for Harmattan
@kenweknot, working on Glacier for Nemo.
 
Posts: 57 | Thanked: 15 times | Joined on Oct 2008 @ West Hills California
#3
dd copy the partition to a real hard disk partition. Then do a simple cp -r from hard disk to a new sd card.
 
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#4
You can mount the image and redo the tar file or "cp -a" the files from the image to the partition
mount -o loop backup.img /mnt
About ext3, it is the recommended filesystem for SD cards, that assertion about the journal wearing out the card is incorrect (my own system is on ext3 and it is 3 years old, the card is fine)
 
Posts: 154 | Thanked: 73 times | Joined on Jan 2009 @ Toronto
#5
Originally Posted by daperezg View Post
I decided to backup the files, format and restore them using a linux desktop and a SD reader.

.......

5 Try N800 without success
Did you ever succeed with this? I don't know if it's any help, but I can report success doing something similar with GParted (running in Ubuntu Lucid) instead of Qparteditor. Sorry, I don't know anything about Qparteditor and whether or not it resembles GParted. Part of the process was to shrink an ext3 partition containing a clone of the SD file system (this is very easy in GParted).

The archive streaming (tar operation) was done on the N800, booted from internal flash. It requires GNUtar or some other advanced version of tar. GNUtar is available from the Diablo repositories and should be installed through App Manager in the internal OS.

I believe that this procedure will only work if the SD partition containing the OS still has a fair amount of empty space. If it does not, you might have to combine the formatting with an increase in size of the ext3 partition (perhaps by shrinking the FAT partition). AFAIU, cloning of partitions must be done from a smaller partition to a larger one. The idea here is to clone from your SD partition to a larger one on another device, and then shrink the recipient partition before cloning back to the reformatted original one.

You will need a USB drive larger than the ext3 partition on your SD card. (You could use another SD card in a USB card reader for this purpose - whatever you have at hand.) You must also be able to use your N8x0 as USB host.

PROCEDURE

1. Format the USB drive so that it has an ext3 partition larger than the SD partition that you want to reformat.

2. Boot your N8x0 from the internal flash. List the modules currently in the kernel:
Code:
sudo gainroot
lsmod
See whether mbcache, jbd and ext3 are listed. If any are not listed, use insmod to insert them. For example:
Code:
insmod /mnt/initfs/lib/modules/2.6.21-omap1/mbcache.ko
etc. Note that mbcache and jbd must be inserted before ext3.

3. Check that top-level directories /opt and /floppy exist and are empty.
Attach the USB drive to N8x0. Run dmesg to see how the drive has been recognised. In my case, it was recognised as sda, and the ext3 partition was /dev/sda2.
The annoying automounting on N8x0 will mount the ext3 partition in a way that you don't want it. So, following the Maemo tradition of cloning from /floppy to /opt, you need to remount it on /opt. Still as root:
Code:
umount /dev/sda2
mount /dev/sda2 /opt
mount /dev/mmcblk0p2 /floppy
gtar cf - -C /floppy . | gtar xvf - -C /opt
umount /floppy
ls /opt
umount /opt
(In my case, the partition I wanted to reformat was /dev/mmcblk0p2. If you have a different setup, you must change the second "mount" command accordingly. The gtar pipe will take a few minutes to complete before you can "umount". You do not really need "ls /opt": it just lets you see that the file system actually has been copied.)

4. Remove the USB drive, attach it to Ubuntu PC, open GParted.
In the graphic representation of the USB drive's ext3 partition, there is a yellow bar indicating the space used, and the rest of the space is white. Shrink the ext3 partition until there is just a small amount of white. The resulting partition should be smaller than the ext3 partition on your SD card. (If not, you will have to increase the size of the SD card's ext3 partition in the next step.) Close GParted.

5. Safely remove the USB drive from the PC. Attach the SD card (in card reader). Open GParted again. Reformat the SD card's ext3 partition, increasing its size if necessary (see above). Close GParted. Safely remove the card reader. Replace the SD card in N8x0.

6. If you have done anything else on the N8x0 in the meantime, make sure that it is now running from internal flash, with XTerm open and root, and the mbcache, jbd and ext3 modules in the kernel.

7. (Reverse of Step 3.)
Attach USB drive to N8x0. Run dmesg to see how it is recognised (assumed to be sdb in the following).
Code:
umount /dev/sdb2
mount /dev/sdb2 /floppy
mount /dev/mmcblk0p2 /opt
gtar cf - -C /floppy . | gtar xvf - -C /opt
umount /floppy
umount /opt
8. Remove the USB drive (or not, as you prefer).

9. Reboot to use your reformatted ext3 partition.

Before 9. In my case, the reformatting involved a change from ext2 to ext3. It was therefore necessary to edit bootmenu.conf and run initfs_flash, so that the mbcache, jbd and ext3 modules would be inserted at boot time.


FOOTNOTES. Sorry, this has already been a long post, but there are a few things to add.

(1) The reason for running the tar operation on N8x0 rather than PC is that you can have conflicts of file ownership when an archive is extracted on one machine and the resulting files are run on another. It should be possible to avoid such problems by adding a "-p" option to both extractions (the "xvf" parts). I have not tried that and therefore can not say for sure that it will work. In any case, the N8x0 does a good job of running this operation.

(2) [EDIT: I previously reported that Opera browser had difficulty loading images after the procedure described above. It now appears that this must have been either a problem on my network (now cleared up), or a self-correcting result of the change from ext2 to ext3 file system (e.g. maybe it took a period of journalling before Opera interacted efficiently with the ext3 journal). I had copied the rootfs back to two newly reformatted cards (one SDHC, one MMC-mobile). Both initially had the problem with images in Opera. On one, the problem disappeared after I re-installed Opera, and I therefore reported here that it was fixed by the re-installation. However, the problem also disappeared from the other card, without re-installation of Opera or any other "fix". No fix is needed.]

(3) From time to time, forum members ask how they can back up and restore an entire operating system, fully loaded with apps and settings. The usual answer is to make a jffs2 image, which can be restored by nandwrite or by a flasher. The problem with that answer is that the restoration must be made to the internal flash, which might already contain something that you want to leave undisturbed. Furthermore, your fully loaded system might be too big to fit back into the internal flash. (That was the whole point of installing it on the SD card, remember?) The procedure described above would allow restoration to any sufficiently large linux-formatted partition of your choice.

Last edited by scaler; 2011-07-22 at 16:54. Reason: Opera browser problem not caused by this procedure.
 

The Following User Says Thank You to scaler For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 06:34.