LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-01-2013, 02:00 PM   #1
pabelmont
LQ Newbie
 
Registered: May 2010
Posts: 1

Rep: Reputation: 0
problem after copying 250GB disk to 1TB disk (cannot resize the old EXTENDED)


with an empty new disk 1TB INTERNAL (sda)
and old data-filled 250GB external (sdb),
the 1TB previously set-up as a whole NEW by GPARTED

I used "dd if=/dev/sdb of=/dev/sda bs=64k" to copy the entire old disk to the new.
(Reason: to make sure to copy the MBR which I don't understand at all.)

What happened is that 1TB now has these partitions:
2 PRIMARY (DELL and WINDOWS)
1 EXTENDED (swap, "/", "/home", various small stuff)
AND one 3/4-TB "unallocated".
WHAT I CANNOT DO IS:
[1] resize the existing EXTENED to incorporate the unassigned 3/4 TB of space
or [2] create another EXTENDED within the huge unassigned partition.

(GPARTED is called "first-thing" from UBUNTU on a Live-CD, but says the
existing EXTENDED partition contains stuff that is mounted, so it cannot be re-sized. THIS SEEMS WRONG, BECAUSE I SHOULD NOT HAVE OPENED ANYTHING WITHIN ANY OF THE PARTITIONS on 1TB at this early stage,

Can anyone help me re-size my existing extended?

I suppose one alternative is to:
[1] again re-format the 1TB as NEW
[2] copy the MBR somehow
[3] set up the desired partitions, without data
[4] use "dd" to copy EACH partition's data, one-by-one.
but this seems tedious. Is there a better way? Perhaps a way to UMOUNT the entire /dev/sda?
 
Old 02-01-2013, 02:35 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 1,983

Rep: Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512
If you think about it, dd is the wrong tool

What you did was copy the /dev/sdb image to /dev/sda... That copied every block of /dev/sdb - the MBR, the partition table, everything. The resulting filesystems will have the same limits that existed on /dev/sdb.

And the same will be true if you copy partition by partition. The copied filesystems will still have the original limits.

You should be able to delete the last partition on /dev/sda (it should be the extended one), and recreate it (with the new larger size). Since it hasn't moved the beginning, you should still have the same filesystem on there - but still with the original size limit. You should be able to change that (if ext2/3/4) using tune2fs. It won't necessarily be optimal (initial file allocations, recovery blocks and such) will not be optimum for the new size.

The normal procedure is to create a planned partition table, then create filesystems on those partitions, mount them, and copy the data file-by-file (rsync/cp -a/tar/cpio). You would get a better result.
 
Old 02-01-2013, 02:59 PM   #3
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
You should:
1. part your 1T disk, as you want it, install your desired filesystem
2. copy content of old disk (with usual [i]cp -r[\r], to the same partitions)
3. copy content of your master boot record with dd if=/dev/<your old disk> of=<your new disk> bs=512 count=1
4. make sure that after you will remove old disk, all the paths in grub config and /etc/fstab will remain correct (if UID are used, you need to change them to UIDs of new partitions. if device paths are used, make sure new device will get the same name as old one).
 
Old 02-01-2013, 03:07 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,050

Rep: Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971
Quote:
Originally Posted by jpollard View Post
If you think about it, dd is the wrong tool
Absolutely correct.
Likewise, it must not be used to copy the MBR - that will only undo any good done.
 
Old 02-03-2013, 06:47 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Also, extended partitions don't contain anything, they are just a marker to say where LOGICAL partitions start.
If you run
Code:
fdisk -l
(lowercase L)
you'll see what I mean
 
Old 02-04-2013, 08:38 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 1,983

Rep: Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512
Actually, no partition contains anything... A partition is just an index list with a partition type, starting point, ending point (or length). And that short list of four entries is in the raw disk following the MBR.

The extended partition allows for a new (chained, I believe) list of additional partitions, and that list is stored within the extended partition.
 
  


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
One partition or many for 1TB disk? Ook Linux - Newbie 9 06-24-2009 08:45 PM
Copying one distro on a hard disk to another disk jimmy512 Linux - General 2 11-21-2006 01:19 PM
san disk resize problem ronanio Linux - Enterprise 0 02-07-2006 06:21 AM
Disappearing partitions during or after SUSE 9.2 install on 2nd 250GB Hard Disk. winterfeld Suse/Novell 0 02-21-2005 01:03 PM
K3B - Disk copying problem kevinatkins Linux - Software 2 02-11-2004 10:25 AM


All times are GMT -5. The time now is 02:35 PM.

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