LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 10-29-2010, 11:53 AM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
how to copy partition with dd


Hello
I have hdd with sda1(windows xp)(4gb) and sda2(my files)(10gb)
I have conected usb memory which apperas as sdb1 (4gb)

What I want is to copy sda1 to sdb1.

I did it this way:
Code:
dd if=/dev/sda1 of=/dev/sdb1
When I check what there are in sdb1 and disk was full but no files and folders were stored there.

What I did wrong?
 
Old 10-29-2010, 12:03 PM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,010

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
first of all did you create the destination partition ahead of time with fdisk? second was it the same size as the source partition?
 
Old 10-29-2010, 01:25 PM   #3
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
I created partition on usb memory with gparted. And they are both 4 GB.
My files in Windows are 2.7GB and after copy them with dd, from sda1 to sdb1, I noted in sdb1 there are 2.7gb, but I dont see the files and folders in Linux.
I just tried in windows and I see files and folders.
 
Old 10-29-2010, 01:26 PM   #4
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,366

Rep: Reputation: 156Reputation: 156
If you have the partition prepped just use the cp command. That way you don't have to worry about partition sizes.

Code:
# cp -pidRv /mnt/dev/sda1/* /mnt/dev/sdb1
Adjust the mount points for your system

Code:
man cp
To see what all the parameters are for.
 
Old 10-29-2010, 01:36 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,880
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
Quote:
Originally Posted by mlangdn View Post
If you have the partition prepped just use the cp command. That way you don't have to worry about partition sizes.

Code:
# cp -pidRv /mnt/dev/sda1/* /mnt/dev/sdb1
Adjust the mount points for your system

Code:
man cp
To see what all the parameters are for.
This will not copy the first sectors of the partition, which are part of the Windows bootloader. I don't know if this is an issue, if you use grub, anyways.
 
Old 10-29-2010, 01:57 PM   #6
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,366

Rep: Reputation: 156Reputation: 156
That's true, and I sure forgot about that. I use lilo, which may require a manual edit before a successful boot.
 
Old 10-31-2010, 03:48 AM   #7
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Ok, I did it.
I used
Code:
dd if=/dev/sda1 of=/dev/sdb1
again and then in MBR I installed grub and now I can boot windows from usb-memory, but when Windows is loading, about 20 seconds later, windows doeos not finish to loading and computer restarts.
Any idea what could be wrong. Meybe Windows detect that was installed in hdd, and now it load from usb-memory?
Diferent drive letter or I dont know.
Any idea?
 
Old 10-31-2010, 06:04 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,880
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
What version of Windows are you using? If it is XP it has to be prepared to run from USB, I don't know for other versions. Try to google for it, as this is a Windows question.
 
Old 10-31-2010, 07:52 AM   #9
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Yes, it is windows xp
 
Old 11-11-2010, 02:53 PM   #10
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
I dont understund this command you recommend me:

Quote:
cp -pidRv
Can you explain it better?

I see there is one cp -r,
but cp -pidRv not exist in man nither in google.
 
Old 11-11-2010, 10:00 PM   #11
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,366

Rep: Reputation: 156Reputation: 156
If you do:

Code:
man cp
It will explain all those parameters.

-p same as --preserve=mode,ownership,timestamps
-i, --interactive
prompt before overwrite (overrides a previous -n option)
-d same as --no-dereference --preserve=links

The rest are in there as well.
 
Old 11-14-2010, 01:04 PM   #12
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Oo, now I understand.
That is not just a one options, but these are several options together.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Contents of LVM Partition to Another Partition With a Different File System tmort Linux - General 3 03-07-2008 05:00 AM
Copy files from Windows partition to Linux partition Shibumgeorge Linux - Software 3 04-20-2007 10:08 AM
Copy boot partition to smaller partition Quakeboy02 Linux - Kernel 3 01-11-2007 01:44 AM
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee Suse/Novell 20 10-31-2005 07:30 AM
What is the code to copy a file from my windows partition to my linux partition? THEBIGFISH Linux - Newbie 3 03-15-2004 10:14 PM


All times are GMT -5. The time now is 08:07 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration