Author Topic: LiveUSB copy - SOLVED  (Read 1541 times)

Offline jordanin

  • Jr. Member
  • **
  • Posts: 18
LiveUSB copy - SOLVED
« on: December 27, 2010, 05:56:49 PM »
I am trying to make copies of a liveusb stick I created to give as Christmas presents. I have had such trouble they will now be late Christmas presents. I have 4 GB sticks that I am trying to use and I was putting 2 GB as ext3 and 2 GB as fat32 for file sharing. First I tried for format a kingston datatraveler 100 and pcc kept crashing. I searched high and low and tried other machines always the same result, "program exited abnormally". I then used the command line to delete the partition table and redo it, and after that pcc didn't crash anymore. Next, I used the PCLinuxOS liveusb creator to create one stick, and it worked beautifully. I customized it quite a bit and then wanted to make a copy. I could not get mylivecd to work probably because there was not enough space on the flash disk. I tried specifying the destination to a larger drive and it still didn't work. So I moved on. I decided to use Rsync using directions found here:
from old-polack http://www.pclinuxos.com/forum/index.php/topic,80737.0.html
Basically I plugged in the working USB flash drive while operating off of the harddrive, and issued the following commands:
Code: [Select]
fdisk -l
mkdir /mnt/here
mount /dev/sdg1 /mnt/here

Plugged in disk to copy to
Code: [Select]
fdisk -l
mkdir /mnt/there
mount /dev/sdh1 /mnt/there
rsync -av /mnt/here/ /mnt/there

Next I followed paranotes example of how to install grub since the sticks did not work without it: http://www.pclinuxos.com/forum/index.php/topic,74879.0.html
by entering
Code: [Select]
grub
find /boot/grub/menu.lst
geometry (hd2)
root (hd2,0)
setup (hd2)

Now this worked in that I now have a working copy, but unfortunately it did not copy the changes I made. I also should note that I tried making the subsequent sticks from the PCLinuxOS liveusb creator but it now errors out with no uuid found, but they all have uuid as found with the blkid command. I would like to make copies of the stick with changes, and I would appreciate any advice or help to that end.

Thanks,
Jordan





« Last Edit: January 11, 2011, 05:05:10 PM by jordanin »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: LiveUSB copy
« Reply #1 on: December 27, 2010, 11:43:39 PM »
I am trying to make copies of a liveusb stick I created to give as Christmas presents. I have had such trouble they will now be late Christmas presents. I have 4 GB sticks that I am trying to use and I was putting 2 GB as ext3 and 2 GB as fat32 for file sharing. First I tried for format a kingston datatraveler 100 and pcc kept crashing. I searched high and low and tried other machines always the same result, "program exited abnormally". I then used the command line to delete the partition table and redo it, and after that pcc didn't crash anymore. Next, I used the PCLinuxOS liveusb creator to create one stick, and it worked beautifully. I customized it quite a bit and then wanted to make a copy. I could not get mylivecd to work probably because there was not enough space on the flash disk. I tried specifying the destination to a larger drive and it still didn't work. So I moved on. I decided to use Rsync using directions found here:
from old-polack http://www.pclinuxos.com/forum/index.php/topic,80737.0.html
Basically I plugged in the working USB flash drive while operating off of the harddrive, and issued the following commands:
Code: [Select]
fdisk -l
mkdir /mnt/here
mount /dev/sdg1 /mnt/here

Plugged in disk to copy to
Code: [Select]
fdisk -l
mkdir /mnt/there
mount /dev/sdh1 /mnt/there
rsync -av /mnt/here/ /mnt/there

Next I followed paranotes example of how to install grub since the sticks did not work without it: http://www.pclinuxos.com/forum/index.php/topic,74879.0.html
by entering
Code: [Select]
grub
find /boot/grub/menu.lst
geometry (hd2)
root (hd2,0)
setup (hd2)

Now this worked in that I now have a working copy, but unfortunately it did not copy the changes I made. I also should note that I tried making the subsequent sticks from the PCLinuxOS liveusb creator but it now errors out with no uuid found, but they all have uuid as found with the blkid command. I would like to make copies of the stick with changes, and I would appreciate any advice or help to that end.

Thanks,
Jordan



When you have a working stick, copy it with the dd command. Say the working stick is plugged in and seen as /dev/sdc, and the new stick you wish to receive the copy is seen as /dev/sdd, the command would be;

dd if=/dev/sdc of=/dev/sdd                               <Enter>

The copied to drive should be bit perfect down to the partition table, grub, filesystem format, etc. It should look and work exactly like the original.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: LiveUSB copy
« Reply #2 on: December 28, 2010, 04:26:27 PM »
When you create a LiveUSB install, the /boot/grub/menu.lst file contains a reference to the partition on which it is installed, in the form of a UUID.

That UUID is specific to that partition.

When you copy all the files to a different stick/partition, you must change the UUID used in the boot stanzas to reflect that change.

Please note that the changes directory has root permissions, and so would need proper rights to copy it to a different location.

Having completed the copying of the files you can easily set up Grub on the new stick, from any running OS, by using Grub from the command line. How to do this with three simple commands has been posted previously, but if you need it post back.

regards.

Offline jordanin

  • Jr. Member
  • **
  • Posts: 18
Re: LiveUSB copy
« Reply #3 on: January 11, 2011, 05:04:50 PM »
Just19 thanks for your advice. I had at one point tried changing the UUID to match the new partitions, but my problem was that the changes did not show up. They were in the changes folder taking up space but the programs were not there in PCLinux.

old-polack once again you have solved my problem. I did as your recommended and used dd and it took quite a long time, and for some reason did not copy the partition table. This worked as long as the new Linux partition was as large or larger than the one I was copying from. I also found ddrescue in the repos and it is much quicker, but it also did not copy the partition information. I tried looking at the wiki for dd and ddrescue but didn't really understand much of it, so I just used pcc to partition each drive to the same size and made my copies.

Thanks again


Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: LiveUSB copy
« Reply #4 on: January 11, 2011, 07:15:22 PM »
Just19 thanks for your advice. I had at one point tried changing the UUID to match the new partitions, but my problem was that the changes did not show up. They were in the changes folder taking up space but the programs were not there in PCLinux.

old-polack once again you have solved my problem. I did as your recommended and used dd and it took quite a long time, and for some reason did not copy the partition table. This worked as long as the new Linux partition was as large or larger than the one I was copying from. I also found ddrescue in the repos and it is much quicker, but it also did not copy the partition information. I tried looking at the wiki for dd and ddrescue but didn't really understand much of it, so I just used pcc to partition each drive to the same size and made my copies.

Thanks again



If you copy a whole drive, (USB stick or HDD) starting at byte 0 sector 0 the partition table will occupy bytes 466 to 509 of the boot sector. (MBR) The first 466 bytes (0 to 465) will be your grub stage1. The next 15-19 sectors would be the embedded grub *_stage1_5 files, followed by the actual partitions, in the past starting at sector 63, but possibly sector 2048 with the newer partitioning scheme. This has been one of the primary uses of dd, the ability to copy at the bit level to clone drives. Something is definitely wrong with your results.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: LiveUSB copy - SOLVED
« Reply #5 on: January 12, 2011, 04:18:43 AM »
I think - from a time perspective - it might have been just as quick (and maybe quicker), to have run the Liveusb creator app on each stick, and just copy as root the changes directory, to each.