You are not logged in.

#1 2011-04-26 21:20:53

Mazh
Member
Registered: 2011-04-13
Posts: 48

Make a working copy of my current USB key to another USB key.

Hello,

recently I've installed a copy of archlinux on my USB key using larch. But now, I'd like to know how I can make a working copy capable to boot of this current USB key I'm using on laptop, on another USB key. I know using CP command won't work, as the partition needs to be formated, set as boot and to be a linux filesystem, but I certainly miss some parts.

If there is a way to make an usable .iso of the current content so I could larchify from this iso to make as many duplicate of my USB I want, or if there is a simple way to do so in console, and then copy my stuff to the USB or whatever, this would be cool. I've made few test myself but didn't work.

Sorry for my english, this is hard to explain, but I only want to duplicate my USB to make some working copies in case of, and I'd like another copy to test some stuff on it, as I've installed everything I need (drivers and base softwares), now I'd like to test some new stuff and I know i'll probably fuk my system, but I'd not like to reinstall everything once again.

Cordially Maz

Offline

#2 2011-04-26 21:39:29

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: Make a working copy of my current USB key to another USB key.

If the 2nd pen drive is as big or bigger than the one you want to clone you can use dd.

dd if=/dev/sdX of=/dev/sdY conv=notrunc

if is source (your larch usb drive), of is target (empty usb drive).

You can create an image with

dd if=/dev/sdX of=/path/to/imagefile.iso

P.S.: The package cdrkit also has a tool called mkisofs where you can create an iso from files (i.e. your mounted usb drive).

Last edited by demian (2011-04-26 21:43:33)


no place like /home
github

Offline

#3 2011-04-26 21:42:27

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

I have tried 'dd' - it works for me. At first dd you USB device (say, /dev/sdb - not partition like /dev/sdb1!) to file, replace sticks and dd this file to new stick. Use bs option with few MB (see man). In fact I have tried to dd from 8GB stick to a file, and then the file to 16GiB stick and it has worked for me (I have Arch installed on a stick for my self-made NAS).


"I exist" is the best myth I know..

Offline

#4 2011-04-27 02:03:38

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Make a working copy of my current USB key to another USB key.

Please, please, please be careful with the dd command. 
Whenever I use it, I type the command, sit back, read what I typed, think about it more, re-read what I typed, then hit return.
I still destroy  file systems occasionally.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2011-04-27 04:24:49

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

Thanks, dd is working great, but I got a specific problem with one of my USB key:

I think there is a problem with my filesystem and it is corrupted. When I do fdisk -l it's wrote my sdc1 is W95 FAT32 (LBA) system, but I did mkfs.ext3 /dev/sdc1. What's wrong? I should have 83 linux partition. What I did is going with fdisk into my USB and deleted to make new table as primary, then write. Nothing changed again...

Then, I also tried dd=/dev/zero if=/dev/sdc1 but still the same problem.

Then I say, I'll try to duplicate the source of my 1st USB, everything seemed to work, but I can't access my key USB and Dolphin is giving me an error like that:

mount: wrong fs type, bad option, bad superblock on /dev/sdb1

I do check with fdisk -l again, and same filesystem...
I do mkfs.ext3 /dev/sdc1 again, fdisk -l, same filesystem, what's wrong? I've tried everything I known in this domain and searched google but can't find useful infos.

Thanks

p.s I've 4GB USB key, but now it's wrote that I've 3.7 only, it's strange as I know U3 doesn't really get 300MB on a usb key ...

Last edited by Mazh (2011-04-27 04:46:35)

Offline

#6 2011-04-27 08:30:11

IncredibleLaser
Member
From: Germany, NRW
Registered: 2008-07-16
Posts: 158

Re: Make a working copy of my current USB key to another USB key.

p.s I've 4GB USB key, but now it's wrote that I've 3.7 only, it's strange as I know U3 doesn't really get 300MB on a usb key ...

If you have a 4 GB key, it's 3.7 GiB - 4*10^9/2^30.

Offline

#7 2011-04-27 14:16:56

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

I see, thx ^^

But anyone willing to help with my last problem?

Offline

#8 2011-04-27 14:48:40

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

@Mazh

Partition type, if I understand correctly, must be defined by fdsik (gparted, adn so on) - as well as boot partition. Not with mkfs.


"I exist" is the best myth I know..

Offline

#9 2011-04-27 15:24:37

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

Thanks for replying Student,

in fact if I quote myself:

What I did is going with fdisk into my USB and deleted to make new table as primary, then write. Nothing changed again...

I did format the usb key with mkfs (even if I thought I could change the filesystem with it), then I went into my usb with fdisk and deleted the partiton to make a new one, but it didn't change

Do you guy have something to suggest to reset, format, and install linux partition type to my usb key in console. Then I'll give my feedback if it works.

Usually if I do:

mkfs.ext3 /dev/sdX
fdisk /dev/sdX 
-d
-n (primary) [enter][enter]
-w
fdisk -l (I should have 83 linux right?)

Last edited by Mazh (2011-04-27 15:34:44)

Offline

#10 2011-04-27 15:56:58

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

@Mazh

Creating partitions with their types and boot flag via fdisk or any other partitioning tool is a primary (and independent from any filesystem-related tools)  task. You must do all needed work with partitioning tools (fdisk, gparted, ...) and only then create filesystem(s), install operating system, and so on.


"I exist" is the best myth I know..

Offline

#11 2011-04-27 15:59:38

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

Thanks for the good advice, I will try that when I switch to my archlinux OS

Offline

#12 2011-04-28 16:39:05

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

okay, I've tried today and got my USB key to get formatted and be a linux fs.

Now when dd is done the output show me this error input/output:

[root@myhost /]# dd if=/dev/sdd1 of=/dev/sdc1 conv=notrunc
dd: writing to `/dev/sdc1': Input/output error                                     //what's that
7666977+0 records in
7666976+0 records out
3925491712 bytes (3.9 GB) copied, 1625.2 s, 2.4 MB/s

Also, when I try to access my USB key from Dolbin, here is a screenshot of the error:

http://img580.imageshack.us/i/snapshot5u.png/

As you see, there is my 1st working USB with the correct distro and file on it, and my second. Everything was fine, I could have an access when I did format and re-installed new filesystem. But when I do try to copy with DD here are my both errors. Also, sometime I can access my USB but if I remove it from the computer and reinsert it, I cannot access anymore and Dolbin showing me this error. Only viable way would be console then. Also I must mention that my USB key wasn't able to get detected from windows few time ago. I did nothing special with it.

Is it broken?

Offline

#13 2011-04-28 16:53:53

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

Why are you dealing with partitions rather with devices? Have you read it? -

student975 wrote:

dd you USB device (say, /dev/sdb - not partition like /dev/sdb1!) to file...


"I exist" is the best myth I know..

Offline

#14 2011-04-28 23:36:41

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

[root@myhost /]# dd if=/dev/sdc of=/dev/sdd conv=notrunc
dd: writing to `/dev/sdd': No space left on device
7669825+0 records in
7669824+0 records out
3926949888 bytes (3.9 GB) copied, 1720.01 s, 2.3 MB/s

both 4GB USB, and i used only around 2.2 GB, why would I've no space left on device hmm

Offline

#15 2011-04-28 23:48:35

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

Mazh wrote:

why would I've no space left on device hmm

Are sticks exactly the same? Sorry, I have not tried direct copying (stick1 -> stick2), rather stick -> file and file -> stick only. Of course, at this case conv=notrunc isn't needed.

BTW, to make your experiments much faster use 'dd' option for buffer size, say 'bs=4M'


"I exist" is the best myth I know..

Offline

#16 2011-04-29 00:01:24

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Make a working copy of my current USB key to another USB key.

You can also compare sticks' sizes:

sudo blockdev --getsize64 /dev/sdc

Last edited by student975 (2011-04-29 00:01:44)


"I exist" is the best myth I know..

Offline

#17 2011-04-29 12:25:42

Mazh
Member
Registered: 2011-04-13
Posts: 48

Re: Make a working copy of my current USB key to another USB key.

1st USB key is even smaller by few, I just don't understand now. I've possibly done every possible tests around with DD, even tried to make an .iso to recreate the img to my second USB instead of directly transfer USB to USB. This evening I  might try unetbooting, just to see if this is working, as I've seen on some forum, some people were telling dd wasn't working on some distro sometimes and tried that software and worked. I just don't know if this software is capable to do what I want form iso, but I think so. But I'd have enjoyed to resolve my problem  via console of crouse.

Offline

Board footer

Powered by FluxBB