LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2009, 09:34 PM   #1
PC_Head
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Rep: Reputation: 0
Copy Linux Partition


I have a partitioned HDD with Linux Satanic on it. I want to copy that partition to another HDD and make it bootable. I have tried Partition Magic and it don't recognise the Linux ext3 (what ever that is) for it to copy, ghost or what ever you call it. Also there is another Linux partition called Swap. It is only small but what does it do? Is it part of the main Linux partition? Do i have to copy that as well? What other programs can i use to do this please? Thanx in advance.
 
Old 01-26-2009, 11:04 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by PC_Head View Post
I have a partitioned HDD with Linux Satanic on it. I want to copy that partition to another HDD and make it bootable. I have tried Partition Magic and it don't recognise the Linux ext3 (what ever that is) for it to copy, ghost or what ever you call it. Also there is another Linux partition called Swap. It is only small but what does it do? Is it part of the main Linux partition? Do i have to copy that as well? What other programs can i use to do this please? Thanx in advance.
It would be easier to just install it.

It is possible to copy it, but it will require getting your hands dirty. You need to boot linux (a livecd will do), mount the original partition, format and mount the distination partition, then copy everything (preserving permissions, i.e. with cp -a) and then you will need to properly setup the bootloader. If you aready have a bootloader (you must have one if you are able to boot your original linux partition) then you probably just need to edit the /boot/grub/menu.lst or grub.conf file to add the new partition to the list of bootable ones.

If you plan to replace one disk with the other the thing change because you need to install the bootloader on the second drive.

You also need to setup your /etc/fstab file probably, depending on your layout.

If you decide to do this and you need more info just ask.

By the way, the swap partition is like the swap file in windows. It's used to page stuff to disk when your ram is full.

Being all that said, try to tell us why do you want to do this and why installing on the new disk from scratch is not an option.
 
Old 01-27-2009, 12:24 AM   #3
PC_Head
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
It would be easier to just install it.

It is possible to copy it, but it will require getting your hands dirty. You need to boot linux (a livecd will do), mount the original partition, format and mount the distination partition, then copy everything (preserving permissions, i.e. with cp -a) and then you will need to properly setup the bootloader. If you aready have a bootloader (you must have one if you are able to boot your original linux partition) then you probably just need to edit the /boot/grub/menu.lst or grub.conf file to add the new partition to the list of bootable ones.

If you plan to replace one disk with the other the thing change because you need to install the bootloader on the second drive.

You also need to setup your /etc/fstab file probably, depending on your layout.

If you decide to do this and you need more info just ask.

By the way, the swap partition is like the swap file in windows. It's used to page stuff to disk when your ram is full.

Being all that said, try to tell us why do you want to do this and why installing on the new disk from scratch is not an option.
Im tryimg to do this so i have one HDD for Windows Xp, 7 32 and 7 64 and one HDD dedicated to Ubuntu. Yea that bootloader thing can be a real problem. Still trying to work it out and if all else fails, knowing me it probaly will ill do a fresh install of Ubuntu as suggested. One other thing, Ubuntu fits on a 700mb cd yet it took up near on 20 gig of HDD space, (thats what it said in Partition Magic). Why is this? Thnax
 
Old 01-27-2009, 12:43 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by PC_Head View Post
Im tryimg to do this so i have one HDD for Windows Xp, 7 32 and 7 64 and one HDD dedicated to Ubuntu. Yea that bootloader thing can be a real problem. Still trying to work it out and if all else fails, knowing me it probaly will ill do a fresh install of Ubuntu as suggested.
Judging by your post I assume that your experience with linux is very limited. No offense intended at all.

So I'd emphasize again the suggestion of reinstalling. Toying with partitions and bootloaders can be left for a later stage because at times it can be a bit confussing, overall when you don't even know the basics about partitions and disk layout in linux (though you obviously have at least the needed knowledge to use partition magic, which is a good starting point).

If you still want to try to do it the hard way I will provide all the assitance that I can. But unless it's for learning purposes I don't think it's worth all the trouble. Reinstalling should take minutes at most, and it is way easier.

Quote:
One other thing, Ubuntu fits on a 700mb cd yet it took up near on 20 gig of HDD space, (thats what it said in Partition Magic). Why is this? Thnax
I am assuming that you are talking about the size of the partition. That is not the space that ubuntu takes. It's just the size of the container, that doesn't means it's all full. Windows can't see the free space inside that partition simply because windows can't deal with the linux fs natively (though certainly there are workarounds to overcome that as well).

If partition magic can see inside the linux partition (which I don't know) then it might be also be able to tell you if there's free space inside that partition. But only if it supports that type of partition.
 
Old 01-28-2009, 07:39 AM   #5
PC_Head
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
Judging by your post I assume that your experience with linux is very limited. No offense intended at all.

So I'd emphasize again the suggestion of reinstalling. Toying with partitions and bootloaders can be left for a later stage because at times it can be a bit confussing, overall when you don't even know the basics about partitions and disk layout in linux (though you obviously have at least the needed knowledge to use partition magic, which is a good starting point).

If you still want to try to do it the hard way I will provide all the assitance that I can. But unless it's for learning purposes I don't think it's worth all the trouble. Reinstalling should take minutes at most, and it is way easier.



I am assuming that you are talking about the size of the partition. That is not the space that ubuntu takes. It's just the size of the container, that doesn't means it's all full. Windows can't see the free space inside that partition simply because windows can't deal with the linux fs natively (though certainly there are workarounds to overcome that as well).

If partition magic can see inside the linux partition (which I don't know) then it might be also be able to tell you if there's free space inside that partition. But only if it supports that type of partition.
Thank you for your reply and no, not offended. You have explained so much about what i needed to know. After messing around with it for a while, with no luck i feel it may be best to do your suggestion of a reinstall. So i will. All this ghosting, bootloader, virtual windows and all the other cool and exciting stuuf is new to me. But it is a learning curve. I guess once i get my head around it, it will be like breathing. The only dump question, is one that isnt asked. Very happy with your reply. Thanks once again.
 
Old 01-28-2009, 12:47 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by PC_Head View Post
Thank you for your reply and no, not offended. You have explained so much about what i needed to know. After messing around with it for a while, with no luck i feel it may be best to do your suggestion of a reinstall. So i will. All this ghosting, bootloader, virtual windows and all the other cool and exciting stuuf is new to me. But it is a learning curve. I guess once i get my head around it, it will be like breathing. The only dump question, is one that isnt asked. Very happy with your reply. Thanks once again.
I hope you find your way around.

Linux as any new thing can be a bit hard to learn at the beginning, but you will surely find some satisfaction in it once you have learned a bit about the basics. Luck on your new quest and regards.
 
Old 01-28-2009, 04:08 PM   #7
Gune
LQ Newbie
 
Registered: Jan 2009
Posts: 8

Rep: Reputation: 0
Just a side note.

If you really wanna make a raw copy of the disk and put it on another disc or just have a backup i gotat recommend Acronis True image.
It works great with ext3 partitions.

- Gune
 
Old 01-28-2009, 06:43 PM   #8
GibsoneanNode
Member
 
Registered: Jan 2009
Distribution: Desktop- Debian 4.0
Posts: 43

Rep: Reputation: 16
Hello PC_Head, you may already know of The Linux Documentation Project and their resources, but if not I would suggest the Introduction to Linux guide. Some questions you'd asked concern section 3.1. General overview of the Linux file system, as in the case of the swap partition. While other questions on ext3 pertained to The Linux System Administrator's Guide, notably, 5.10. Filesystems.
 
Old 01-29-2009, 11:04 AM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,111

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
this mite work:
Code:
dd if=/dev/sda1 of=/dev/sda2
# warning: this is very destructive, make sure you are overwriting the correct device.
 
Old 01-29-2009, 02:43 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by schneidz View Post
this mite work:
Code:
dd if=/dev/sda1 of=/dev/sda2
# warning: this is very destructive, make sure you are overwriting the correct device.
I usually disregard giving this kind of advice to a newcomer. This will effectively copy byte-by-byte a given block device (sda1) into another block device (sda2). There are a number of things to consider.

The first two are evident:
  1. As you said, you need to know how to correctly identify partitions, if you overwrite the wrong one there's no need to tell what will happen.
  2. In a similar fashion, guess what happens if the devices are not exactly of the same size. dd makes a raw copy, which means it bypasses the file system. It copies the whole partition it doesn't matter whether it's empty. dd doesn't know what's inside the partition. It just reads bytes from point A to point B and dumps them into another partition. If the destination is smaller then not everything will be copied (and in addition your partitions won't have a valid ending, and will have an incorrect size). That means you can lose data. If the destination is bigger then everything will be ok. But you will lose storage capacity which will be unaccessible.

There are others:
  • If your partition is mostly empty you are stressing your disk unnecessarily because you will be copying mostly empty space which is meaningless.
  • This just copies the partitions, but he will still have to deal with the boot loader and the /etc/fstab file in the new partition. For this you also need to know what the layout of your disks in linux is, and how they are called. And if using grub then you need to translate them into grub syntax, which is different of the linux one.
 
Old 01-29-2009, 04:05 PM   #11
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,111

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Quote:
Originally Posted by i92guboj View Post
...[*]This just copies the partitions, but he will still have to deal with the boot loader and the /etc/fstab file in the new partition. For this you also need to know what the layout of your disks in linux is, and how they are called. And if using grub then you need to translate them into grub syntax, which is different of the linux one.[/LIST]
i understand what you said about everything else but would this alleviate the problem quoted above:
Code:
dd if=/dev/sda of=/dev/sdb
?
 
Old 01-29-2009, 04:59 PM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
That would copy an entire disk into another. The same things I said above applies. You are going to have problems unless both disks are of identical size.

About fstab and grub.conf, the same things apply as well.

For example, assuming you have two disks (hda and sdb) you would need to change hd0 by hd1 on grub.conf. You would also need to adjust the kernel lines and substitute root=/dev/hda1 (or a similar thing depending again on your layout) by root=/dev/sdb1 or whatever fits in.

In fstab you would need to adjust ALL your partitions so they refer to the correct place for sdb instead of hda. This all assuming that your two disks are named that way.

Some of these problems can be alleviated by using a shared /boot partition for both oses. But of course you need to know how to deal with that, since both OSes will in principle assume that /boot belongs to them alone and can conflict with each other.

That is, unless he just want to transfer the OS to a second hd, and then remove the first hd and substitute it with the second. In which case it *should* work without any tinkering. But it all depends on the disks and how you configure and attach them to the motherboard, as well as a couple of kernel settings in some cases.
 
  


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
copy files from windows partition when I am in linux os platform jasonlimvm Linux - Newbie 2 04-07-2008 04:04 AM
Copy files from windows to linux partition nataly Linux - Newbie 6 10-09-2007 11:08 AM
Copy files from Windows partition to Linux partition Shibumgeorge Linux - Software 3 04-20-2007 10:08 AM
how do i copy a partition in linux fedora? scl789 Linux - Software 3 08-16-2005 10:35 PM
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 12:38 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration