can I upgrade 9.10 installed on a flash memory card?

Asked by Stephen Hamer

Can I up grade ubuntu 9.10 installed on a 4GB micro flash memory card? How much free space do I need? Is 1.7GB enough? What is the procedure? If you have actually done this, please get in touch - any light you can shed on these questions is much appreciated.

Also, it occurs to me that it might be a good idea to clone my existing flash card, prior to attempting an upgrade. Will copying everything on it onto another 4GB card result in a second bootable flash card? Your thoughts, greybeards - let's 'av 'em.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen Hamer
Solved:
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Yes, a backup is ALWAYS a good idea.
I have a look at my Virtual Machine, and Ubuntu 10.04 seems to take less space than 9.10.
I'm surprised, but I was told they removed some applications to keep it on a single CD, with not too much download.
On a 7.5GB disk, I used for fresh install 2.9GB.

Revision history for this message
Stephen Hamer (stephen-hamer-uk) said :
#2

Thankyou for replying, Delance, but I don't think we're quite there yet. Let me be more specific.

I have used 9.10's start-up disc creator (I think that's the application) to create a bootable flash memory card - a Kingston 4GB micro flash memory card, which I usually use with a San Disc micro USB adapter (the whole assembly is about the size of the final joint of your index finger and fits very securely and unobtrusively into the side of an N110 Samsung netbook and a whole bunch of other places). I now have access to loads of wonderful free software via ubuntu's very user-friendly interface; but although this installation is persistent, it's not the same as a full install on a computer hard drive, so I am left wondering: can I update my card?

Delance suggests that one should begin with a back up. Wise words, but what I really want to know is, can I:

a) 'clone' my 4GB micro card, by copying everything on it onto another 4GB card. Will this give me a second bootable flash card, with (of course) the same content as the first? It seems to me that this ought to work, but I don't want to fork out £12 for another card only to find it doesn't.

And can I:

b) Use, say 'update-manager', to update 9.10 on the first card to 10.04? Is this even possible? If it is-in general terms-possible, what other conditions have to be met? For example, how much free space on the card do I need? Is 1.7GB enough?

I am really interested to hear from someone who has actually done this (or something close to it)

Revision history for this message
delance (olivier-delance) said :
#3

a) Yes, but there is a trap.
In some files, like /etc/fstab and /boot/grub/grub.cfg (and perhaps some others), the partition are not named /dev/sdg but with a UUID, which is specific to a card. So you could failed to boot and mount disk.
It can looks strange, but people who knows best it are ones who work on duplication of virtual machine (and virtual disk).

b) I can simulate this thing.
I have simply to build a virtual machine with 4GB of memory, installing 9.10 and upgrading into 10.04.
I did it, but with disks of 8GB. Sorry.
Can you do a
    sudo parted -l
and post result, so I can reproduce exactly the size of partition.
You should have results at least at Monday evening.

Revision history for this message
Stephen Hamer (stephen-hamer-uk) said :
#4

Huge thanks for getting back to me on this, delance, and with such useful information. I had a feeling that there would be problems with my naive method of backing-up by 'cloning' my card (issue a)). If this method did work, there would clearly be security implications. Still, i'm tempted to do the experiment (the definitive test), even if it costs me 12 quid. I will post the result, here - other people may be interested.

Regarding issue b) - updating a bootable flash card from 9.10 to 10.04, I did what you suggested and got the following result:

ubuntu@ubuntu:~$ sudo parted -l
Model: ATA SAMSUNG HM160HI (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 6449MB 6449MB primary ntfs
 2 6449MB 82.7GB 76.3GB primary ntfs boot
 3 82.7GB 160GB 77.3GB primary ntfs

Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sdc: 3966MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 4194kB 3966MB 3962MB primary fat32 boot

My copy of 9,10 is installed on the Generic Storage Device.

Your help in generating definitive and authoritative answers to my original questions is much appreciated.

Revision history for this message
delance (olivier-delance) said :
#5

I don't understand.
The flash memory card is formated under FAT32, which prevents installation of Ubuntu 9.10.
And there is no swap partition.
So it could not have Ubuntu 9.10 installed.
Can you explain me the situation ?

I'm simulating with a ext4 partition without swap partition. I'll tell you later the result.

Revision history for this message
delance (olivier-delance) said :
#6

Installation need 1148MB of free disk! So not possible with 3966MB.
Just under the threshold!

Revision history for this message
Stephen Hamer (stephen-hamer-uk) said :
#7

Sorry, delance, but what do you mean by "Just under the threshold". The installation (=upgrade?)takes 1148MB. The card has a capacity of 3966MB, and I seem to have slightly over 1700MB of free space. OK, dumb newbie question coming up: why isn't this enough? Is it possible to free-up space? How much do I need? I have already done 'sudo apt-get clean'

You are puzzled by the FAT32 file system on my flash memory card. You want to know how I managed to install ubuntu on it. I used the 'startup disc creator' application on a canonical supplied 'live' CD to create what is. in effect, a 'live' CD on a flash card - but one that is 'persistent', i.e. which allows me to make software changes, create files etc., which are not lost when I exit the system. Sorry, I don't know how this works. When I look at the files loaded on the flash card in Windows, most of the space 2.9GB is taken up by a file named 'casper-rw' (where changes are stored?). There are about a dozen other files and folders on the disc - most of these are quite small. The second largest file (folder actually), named 'casper', has a 677MB capacity.

Once again, thanks for your help on this

Revision history for this message
delance (olivier-delance) said :
#8

The lack of space is detected during upgrade before downloading anything, so you can try without any risk.
I built a disk of 3966MB, installed Karmic, then tried to install Lucid.
I got an error message telling me my disk has not enough space.
Unfortunately, I deleted this disk and can't check now.
By removing huge packages, like OpenOffice, you could spare disk, succeed on upgrade, and after reinstalling removed packages.
But it's time consuming, and I can't take too much time on it, as I follow many threads on this forum.
Another issue is that you will have this problem every 6 month, and problem will worsening, so it looks to me that it is more simple to buy a 8GB card.

But I repeat myself, you can try as installer detect problem before writing anything on disk. It's riskless.

About FAT32, I don't know everything on Linux. I'm not a system administrator. I presume that 'casper-rw' is a file which contains a Linux file system, with all Linux files properties.

Revision history for this message
Stephen Hamer (stephen-hamer-uk) said :
#9

I am very late with this. I got side-tracked on another matter: I found out how to install Ubuntu to an ext. USB HDD, which made the concerns expressed in this thread seem less relevant. But I don't like to leave dangling the questions that I originally posed dangling, and since delance's last post - many thanks to delance, by the way, for his sterling work - I've firmed up my view about the matters raised herein. To answer the two question in my 2010-05-29 post:

a) Is it possible to clone my 4GB card; i.e. copy all the files on it to another 4GB card (or similar) and thereby obtain a complete back-up of the flash install?

The strict answer to this, as delance suggests in his 2010-05-29 reply, is NO (but please read on to the next paragraph). The cloned card will not boot (confirmed by experiment). Some of the files on a flash card would appear to be card-specific in their action, and thus not transferable (in a functioning form) to another card. You can, of course, back-up all the files on the card to, say, another volume of some kind, although this will leave you with bootable software sitting on that volume (which might cause a few problems). You can use this back-up to restore the flash-install on your original, I stress original, card.

But if we weaken the assumptions of our original question, the answer is YES. To clone your system, you don't need to copy all the files on your card: simply copy to your hard-drive, or wherever, the persistence file on the flash install [it's labelled 'casper-rw' and it's (relative to the other files on a flash install) huge, so you can't miss it]. This is the file that actually contains the 'system' on the flash and all the changes that you have made to it, and what is more, this file is transferable between cards (at least between cards of the same kind - I have not tried any other arrangement). Thus you can create a casper-file on one card, use it; then create a second flash install on another card, edit out the casper-rw file from that card and replace it with a copy of the casper-rw file from the first card, and 'hey-presto' you have a working clone of your first card. This is a very useful way of totally backing-up a flash-install. It also means that it is very easy to recover the system on your first card, in the event of a major software accident, as long as you have a casper-rw back-up handy.

There is one precaution, however, which must be observed here - relevant to the case where you are moving the casper-rw file between cards. The important point to bear in mind in this matter is that cards with the same 4GB label are not necessarily the same size. They are only identical in size to within a given manufacturing tolerance. Thus if you buy two 4GB cards, one might be 3.96GB and the other 3.87GB, or whatever. If you use all the available space on the first card to create the casper-rw file, then this file will not fit onto the second card, and if the card you first created it on was unusually large, it won't fit on any other card. But the solution to this is simple: when you create a flash-install, leave yourself some 'wriggle-room': don't use all the space on the card; leave a couple of hundred MB or so to facilitate casper swaps between cards. This is, I know, an expensive solution, in terms of memory space, given the meagre ration available to the user on a flash-install; but the ability to back-up a flash card is a very useful one. I used this technique to investigate the possibility of 'updating' the distribution on a flash install, which brings us to my second question:

b) Is it possible to update a flash-install from, say, 9.10 to 10.04?

The answer to this question - obtained by experiment - would appear to be a resounding NO. I tried several times to do it. On each occasion, the upgrade failed and I was left with a mangled card. I think a flash-install works in a fundamentally different way from a regular desktop install with the result that a flash-install is definitely not upgradable.

One final point, I think I have discovered why flash-installs are limited in size to 4GB (a superficially annoying restriction): to maximise portability, flash installs use a FAT32 file-system, which imposes a maximum file-size limit of 4GB. Thus the persistence-file on your flash-install can't be bigger than 4GB.