Linux Lite Forums
Live USB-Stick Installs - Printable Version

+- Linux Lite Forums (https://www.freecinema2022.gq/forums)
+-- Forum: Software - Support (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=5)
+--- Forum: Installing Linux Lite (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=17)
+--- Thread: Live USB-Stick Installs (/showthread.php?tid=1641)



Live USB-Stick Installs - bugfree - 03-14-2015

Hi Everyone,

LL2.2 is installed on a USB stick which is my primary OS. The stick is formatted as ext4 with a swap file. Very quick to boot and shut down and a pleasure to use.

I want to create a live USB stick to demonstrate this great OS to others.

My usual way is to use USB-creator-gtk which I install using synaptic, delete the casper-rw file and shrink the partition to a minimum. Then create a new partition as ext4 (default) naming it casper-rw. If the stick is new, I then have the OS in a fat32 partition of about 755Mb and the stick remainder as ext4. Persistence is then available over the whole stick.

This works fine but is somewhat slower (obviously), than being physically installed on the stick. Still pretty good, though!

Two things:-
What does everyone think about this type of formatting. Should I reformat the stick as a different file system,- ext2 or 3 or 4 etc beforehand, or just leave it as is, i.e. fat32 and ext4.

Also, I've noticed that when using gparted in LL to resize the partitions in the new stick, gparted exits without performing the tasks. I need to use another linux OS to do this part of the stick creation.  Sad Any comments on this.

Thanks for any advice.  Cheers! Smile





Re: Live USB stick installs - gold_finger - 03-14-2015

I've toyed around with doing that in the past as well -- mainly when making a live USB to a stick bigger than 4GB.  Using the separate "casper-rw" partition enables you to use a persistence file bigger than the normal 4GB limitation.  Only difference from what you've done is I used "ext2" file system on the casper partition.  Ext2 doesn't cause as many write operations to the partitions due to the journaling feature of the "ext4" format and (in theory) that may extend the life of the flash drive.  (Don't know if that really makes much of a difference or not though.  I just went by what I read in various places.)

Also, I believe I used UNetbootin when I did that instead of USB-creator-gtk; but as long as your method is working for you, no need to change it.  Both are similar.  Process-wise, if memory serves me right, I also made live USB first, then shrunk the partition on the USB and made a large new one labeled "casper-rw".  Don't remember if I bothered trying to make the casper partition ahead of time as a comparison or not.  If you do try that, don't label it until after you make the live system in the FAT32 partition and delete the existing casper-rw file.

(03-14-2015, 11:50 AM)bugfree link Wrote: Also, I've noticed that when using gparted in LL to resize the partitions in the new stick, gparted exits without performing the tasks. I need to use another linux OS to do this part of the stick creation.  Sad Any comments on this.

Yes -- I've run into the same problem a few times, but haven't had the time to fiddle around in effort to track down what's going wrong.  I don't remember my exact situation(s) when that happened, but am pretty sure it happened only when trying to shrink existing partitions on USB's.  I think I ended up just deleting all partitions and then creating them over again from scratch in GParted -- that seemed to work.  No idea why it wouldn't do the shrinking and not sure when I'll have time to play around with it more to try figuring that out.  (If I do find an answer somewhere along the line, I'll post it back here.)

For you, solution might be to create both the FAT32 and Ext2(or 4) partitions on the USB ahead of time.  Make FAT32 partition about 800-850GB so you can make a small persistence file on it with USB-creator-gtk.  Don't label the Ext2 partition.  After creating live system in FAT32 partition, delete casper-rw file and then label the Ext2 partition as "casper-rw".  I think that will work.


Re: Live USB stick installs - bugfree - 03-16-2015

Hello gold_finger,

Thanks for the great reply. Unetbootin is always reliable and I've used it a lot. But when demonstrating to a new user, I prefer USB-creator as it boots straight into the OS whereas Unetbootin does so via a menu. Less explaining!

Didn't know about the journaling and indexing using ext4. Thanks! Looks like ext2 is the way to go using the method you describe in your last paragraph. It may be just the sequence of creation that produces a satisfactory stick.

On the other hand, to avoid this persistence problem, the obvious solution is to install to a USB stick that has already been partitioned with ext2 and a swap file. I've done this a couple of times, although with ext4 format, but not tested on other makes and models of computers to determine if proper drivers are installed. Seems to work on Acer machines which are the ones I've tested on. Very quick when done this way.

On mine, I've got LL2.2 (4Gb mem) installed on a Sandisk cruzer fit micro stick created with USB-creator and partitioned as ext4 with a small swap file. The swap file never gets used. Everything is snappy! I've installed many other packages, which swells the used section to a bit over 10Gb with 19Gb left for storage.

As it takes time and bandwidth to install all these packages and set them up, what I'm trying to do now is to create/duplicate my usb installed system of 10Gb used and transpose this onto a blank 16Gb stick and somehow leave the balance of 6Gb available for storage (a la persistence). Otherwise I need to repeat the procedure for each stick I create. Could I create an iso of my installed system given it's 10-11Gb and install to a fat32 partition using usb-creator, then gpart the remainder as persistence.

I can probably use dd to clone, but this means using new 32 Gb sticks as the target disk needs to be the same size or larger and the 32's are expensive. I have a few 16Gb sticks at hand. Any clues on the best way to go about this.

I also noticed that a stick created with Unetbootin and reused usually because I've stuffed it up, will sometimes not boot. Not a big drama, but unetbootin must work in a slightly different way to usb-creator. Gparted might be in the mix here. 

Just another observation. I have a menu option of install RELEASE. Clicking this does nothing. Is this because the OS is already installed on my stick and won't allow another install even to a new location.

Now to download 2.4 beta.

Cheers!






Re: Live USB stick installs - gold_finger - 03-16-2015

(03-16-2015, 04:06 AM)bugfree link Wrote: On the other hand, to avoid this persistence problem, the obvious solution is to install to a USB stick that has already been partitioned with ext2 and a swap file. I've done this a couple of times, although with ext4 format, but not tested on other makes and models of computers to determine if proper drivers are installed. Seems to work on Acer machines which are the ones I've tested on. Very quick when done this way.

Assuming that you mean doing a full-blown install to the USB (not a "live" USB), yes that works and you don't need to worry about contortions with setting up persistence.  Another advantage to that is that you can run system updates just like you would on a hard drive install, which is not something that works on "live" USB's -- they'll typically fail and/or freeze up the system.  In order to use a USB with regularly installed system on multiple computers, just don't install any proprietary graphics drivers.  It will just use the standard Linux drivers for whatever system it is booted from.  For demo purposes the standard drivers should be fine.



(03-16-2015, 04:06 AM)bugfree link Wrote: On mine, I've got LL2.2 (4Gb mem) installed on a Sandisk cruzer fit micro stick created with USB-creator and partitioned as ext4 with a small swap file. The swap file never gets used. Everything is snappy! I've installed many other packages, which swells the used section to a bit over 10Gb with 19Gb left for storage.

As it takes time and bandwidth to install all these packages and set them up, what I'm trying to do now is to create/duplicate my usb installed system of 10Gb used and transpose this onto a blank 16Gb stick and somehow leave the balance of 6Gb available for storage (a la persistence).

If I understand you right, you've got a 32GB Sandisk USB with full install that has a Root and Swap partition on it (with about 10GB used, rest free space) and you want to basically clone it onto a smaller (16GB) stick.

Best bet:
  • Set-up Root and Swap partitions on the 16GB stick.
  • Use GParted to shrink the Root partition on 32GB stick to same size as one made on 16GB stick.
  • After shrink, right-click and "Copy" the source Root partition on 32GB stick, right-click and "Paste" it on to destination partition on 16GB stick.
However, since you and I have both had problems with GParted trying to shrink USB partitions (for whatever reason) that may not be an option if shrinking aborts like before.

You're correct that using the dd command would require same size (or larger) USB destination stick, so that's not an option.  However, I'm pretty sure you could use the rsync command to basically do the same thing.  That command will only copy over the data from the source partition to the destination partition (ignoring the free space), so that would only copy over the 10GB being used on that 32GB stick.  I've never tried that myself, but I'm 99% sure that will work.  Look up the man page for rsync to find best options to use with the command.
Code:
man rsync

You'll want to use command options that preserve ownership and permissions.  Do a search for cloning with rsync to see if you can find examples of other people who've done it and what options they used in the command.  Here's a good example from very reputable person on the Mint forums:  http://forums.linuxmint.com/viewtopic.php?f=90&t=175924&start=20#p909260.  You'll notice that he's excluded certain directories in his command.  I believe that's because he's rsyncing from a running system to a USB stick.  If you boot from the 32GB stick and run the rsync command from there, I'd recommend you do the same.  If you're not running the command from the 32GB stick, but instead from a separate system with both USB's plugged in, then you can remove the excluded stuff from the command.

No matter which way you do the cloning (with GParted or rsync), you will likely need to use a "live" DVD/USB to install grub to the MBR of the new USB to get it to boot properly.  For example purposes, let's pretend you boot with live DVD/USB and plug in your newly cloned USB.  If it automounts when you plug it in, right-click it and choose "unmount" before proceeding.  Let's also pretend that the Root partition on the cloned USB is "/dev/sdc1".  To install grub boot loader, do the following.

Mount the Root partition to the /mnt directory
Code:
sudo mount /dev/sdc1 /mnt

Install grub to the MBR of the cloned USB stick
Code:
sudo grub-install --boot-directory=/mnt/boot /dev/sdc

Unmount the cloned root partition
Code:
sudo umount /dev/sdc1

One more thing you may want to check is the "/etc/fstab" file.  You need to make sure that the partition UUID's in fstab match the UUID's on the clone USB.

Enter this command to find the UUID's for the clone USB
Code:
sudo blkid -c /dev/null

Mount the clone's root partition again before trying to read the fstab file on it
Code:
sudo mount /dev/sdc1 /mnt

Print to the terminal screen the contents of the fstab file for you to look at
Code:
cat /mnt/etc/fstab

Look at the UUID's for both the Root and Swap partitions in that file and make sure they match the ones shown by the blkid command for that USB stick -- they probably won't.

If they don't match, open the file with your text editor (leafpad) as administrator with this command
Code:
gksu leafpad /mnt/etc/fstab

Replace the current UUID's with the correct new ones then save the file and close the text editor.

Unmount the USB's root partition after you're done making the change.

Close terminal and shutdown computer.

Reboot with newly cloned USB and it should work now.


Re: Live USB stick installs - bugfree - 03-16-2015

Thanks for your quick and comprehensive reply, gold-finger. Lots of logical suggestions! I'll wade through as time permits. At the moment, just trying 2.4 beta. This is a really good distro!
Cheers again!