LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-22-2018, 06:13 AM   #1
kujirasan
Member
 
Registered: Mar 2007
Posts: 168

Rep: Reputation: 19
Cloning USB problem.


I usually have two identical USB sticks that I up date, by using one of them as backup, I moved from 16GB to 64GB USB3.0 recently, using two identical USB sticks same brand (Toshiba), I cloned the old 16GB to one of the USB 3.0, with no problem at all, I made a mortal mistake and formatted the second USB3.0 0n windows 7, then the trouble started, the firs USB 3.0 has a capacity of 58.18GB, while the second one that was formatted on Windows 7, has a capacity of 58.17GB, since this one is slightly smaller, I cannot clone to it using the following command,

dd if=/dev/source of=/dev/target bs=1M,

I have deleted the partition and reformatted on Linux several times but I always get the 58.17GB capacity, is there any way to correct this problem, besides buying another USB and staying away from Windows?

doing an fdisk -l, the result is almost identical except for the , start end sector, which may be where the problem lies, any reply would be appreciated, thanking you in advance.


Disk /dev/sdb: 58.2 GiB, 62474158080 bytes, 122019840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf75f4e84

Device Boot Start End Sectors Size Id Type
/dev/sdb1 32 122019839 122019808 58.2G c W95 FAT32 (LBA)

Disk /dev/sdc: 58.2 GiB, 62461575168 bytes, 121995264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ffd93e7

Device Boot Start End Sectors Size Id Type
/dev/sdc1 32 121995263 121995232 58.2G c W95 FAT32 (LBA)
 
Old 10-22-2018, 06:21 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Nothing to do with formatting - Win or other. They are different sized USBs - look at the total sectors. Happens all the time.

dd'ing is a poor option anyway IMHO, but it's your kit, so your choice.

Edit: mmm - maybe I misunderstood somewhat. If you are just cloning the partition, rather than the entire device, simply make the partition slightly smaller so it fits both devices. 58.0 Gig say.

Last edited by syg00; 10-22-2018 at 06:27 AM.
 
Old 10-23-2018, 07:52 AM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,144

Rep: Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308
If you suspect that windows has hived off a few sectors for it's own nefarious purposes, anf you're so fond of dd, why not UNformat it?
Code:
dd if-/dev/zero of=/dev/sdX
I agree with syg00 that dd is a lousy way to do it. You end up rewriting a lot of zeroes, and can't access the files. Rsync is a lot faster and no less accurate.
 
Old 10-23-2018, 08:12 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
I agree with syg00 and the drives are just different sizes. Starting with Windows 7 the native formatting tool only allows using FAT32 for drives <=32GB. You must be using a 3 party utility. HP used to have a Windows formatting utility available for downloading that would allow you to format any size drive as FAT32.

I agree that using rsync is a better option. If your cloning just the partition then although the MBR shows 58GB your filesystem is still 16GB unless you already resized it.
 
Old 11-03-2018, 03:30 AM   #5
kujirasan
Member
 
Registered: Mar 2007
Posts: 168

Original Poster
Rep: Reputation: 19
Thanks for the input;
but it did not solve the problem, I am sure formatting on windows 7 wreck the usb, I firs cloned on Linux, Debian with no problem, I used on Windows 7, it asked to format it, which I did, and cloned again on Linux, using same procedure, it failed, I managed to clone it reducing the image, on the source, but every time I open a file, I must type in pass word, as well, the usb gets mounted automatically on the manufacturer's name/label, Toshiba etc while it ignores the label that I gave it!

agree with syg00 that dd is a lousy way to do it. You end up rewriting a lot of zeroes, and can't access the files. Rsync is a lot faster and no less accurate.

I agree that using rsync is a better option. If your cloning just the partition then although the MBR shows 58GB your filesystem is still 16GB unless you already resized it.


rsync is not for cloning it copies and backs up, if a file has changed it can make a mess of it,

this one : dd if-/dev/zero of=/dev/sdX,, should be dd if-/dev/zero of=/dev/sdX bs=2014 or something similar.

rysnc is not that easy to use,

#rsync -gloptruc $srcdir $dstdir this a more proper way to copy ,

the easiest way is to use weresync,

#weresync /dev/sda /dev/sdb
 
Old 11-04-2018, 04:52 AM   #6
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan with some Tiny Core, Fatdog, Haiku, & BSD thrown in.
Posts: 5,443

Rep: Reputation: Disabled
Quote:
/dev/sdb1 32 122019839 122019808 58.2G c W95 FAT32 (LBA)
/dev/sdc1 32 121995263 121995232 58.2G c W95 FAT32 (LBA)
Clearly shows that there are fewer sectors available on the sdc1 disk.

I would try reducing the number of sectors available on the larger disk sdb1 down to the smaller disk size of sdc1 using fdisk - doing something like this always has a chance/danger of losing data, so it is your choice whether to try it or not.

However, my question is, do you really need a clone, or is it just data(?), which it sounds like it might be if you have gone from a 16GB to 64GB.

Last edited by fatmac; 11-04-2018 at 04:56 AM.
 
Old 11-05-2018, 07:15 AM   #7
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I've used Linux dump/restore or xfsdump/xfsrestore and it has worked wonderfully. However, these are for ext* or xfs file systems. Don't see in your post if FAT32 is needed? If FAT32 is not needed, perhaps format the USB sticks to use either ext or xfs filesystem and use dump/restore method.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cloning a USB with dd PreguntoYo Linux - Newbie 10 01-14-2016 11:44 AM
Cloning hdd, usb stick etc. Coolmax Linux - Newbie 10 07-14-2012 08:59 AM
usb cloning ravedog Linux - Newbie 5 05-06-2010 03:47 PM
Cloning USB drives using C++ greenberet Programming 3 02-24-2010 04:11 AM
Cloning HD using USB fraidycat Linux - General 8 02-22-2007 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration