LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-23-2005, 02:52 AM   #1
ChriZathens
LQ Newbie
 
Registered: Nov 2005
Distribution: Redhat 8 , Fedora Core 2
Posts: 12

Rep: Reputation: 0
Using unpartitioned space


Hi everyone !!!
Since i am a new member , i would also like to send my greetings from Greece!!!

I'm experiencing a problem...
I had a 20GB SCSI hard disk in which i had Redhat 8.0 installed.
After a few months i got a new SCSI hard disk (capacity 37GB)
I cloned the 20GB disk to the 37GB disk (dd if=/dev/sda of=/dev/sdb bs=2048k)

Everything works fine this way and i get a perfect clone of the 20GB disk.

*I'm using this method at work -no more 20GB disks are in the market anymore ,so this way i don't have to re-install linux again.

But my problem is this.
I practically can't use the remaining unpartitioned space on the 37GB disk.
Using fdisk i saw that no space appears available so that i can create a new partition there and mount it so that i'll have more free space available.
Anyone has any ideas?
I used ext2resize, but i couldn't do anything because no available space is recognized.


----For example in Windows XP you can clone a 40 Gb disk to an 80GB disk and of course then , if you boot from the cloned disk you see only 40GB. But with right-click "My Computer" --->manage---->disk management, the remaining disk is available and you can create a new partition there...
Can i do something like that in the remaining unpartitioned space on my Redhat PC's??
 
Old 11-23-2005, 03:56 AM   #2
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Welcome to LQ!

When you cloned your disk with the dd command, you did an exact bit-copy of your old, smaller disk, including the partition table, which describes the smaller disk. So no, you will not see your extra space.

You need to copy your files somewhere else, run fdisk on your new disk (which will effectively erase it!) to set up the partitions as you like, then format the partitions with your filesystem (ext2, ext3, reiser, whatever) of choice, then copy your files back (not with dd), set up your bootloader....

There are plenty of threads on this board addressing the problem of "moving to a larger disk". May I suggest you investigate the search button above?

Hope this helps.
 
Old 11-23-2005, 04:35 AM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,743

Rep: Reputation: 299Reputation: 299Reputation: 299
The problem with using dd is this: dd will copy one disk to another, including the MBR (Master Boot Record) and will create the partitions in the process, only to the size of the object disk!.

If the disk which is being written to is larger that the disk written from (written to == target disk; written from == object disk), then dd will truncate (make smaller) the used space on the new disk.

I am not certain how to proceed from this point. Do you have a full backup of your installation?

If so, then try using parted or cfdisk to delete the partitions on the new disk. Then create new partitions. If the original 20Gig disk is still installed, with operating system intact, then try this as an alternative method to clone the smaller disk to the larger disk.

Get a LiveCD distro, such as Knoppix. Boot Knoppix. Examine the /etc/fstab file and /mnt directory. Mount all of the partitions shown in /mnt. Cd to each partition and identify the contents (/home, /boot, /, /usr, or however you have your disk partitioned).

Write the Knoppix name for each partition of the old disk on paper, and the contents (/ [root], /home, /usr, or any other partitions you have set up). You will need that information for what comes next.

Reformat the new hard disk, making partitions as you wish. Now you have a new disk with new partitions. To copy the 20Gig disk to the new disk, use tar.

If you have only one partition on the old and the new disk, then cd to / (the root of the filesystem) and issue this command: 'tar cf - . | (cd /mnt/hda1; tar xf -' will copy all of the old disk, except the MBR, (if it is now hdb) to the new disk (mounted at hda); this assumes that the mount point is /mnt/hda1 for the new disk and is in /etc/fstab, and a mount point made in /mnt (Knoppix is good at creating such mount points).

Now, use the tar command given above to copy one partition from the old disk, to the new partition on the new disk. When done, unmount the partition from the old disk, and the new disk. Then run the command again for the next set of two partitions; one old and one new.

The advantage of using this method: Tar does not change the disk geometry. Just create partitions as you will on the new disk. If the partitions are large enough to hold the contents of the old disk, you will not have problems. dd will change the disk geometry to make the new disk look like the old disk (to use the English terms, dd will truncate the available space on the new disk to resemble the old disk).

When that is done, mount the partition on the new disk which contains the bootloader config file and /etc/fstab. Edit the bootloader config file and fstab to show the new partitions and mount points.

Then reboot. You may have to re-configure your bootloader to the MBR.

I currently boot into my new drive with grub running from the old drive. The default is set to boot the Linux from the new drive. One of these days I will re-write grub to the new drive to show the new drive as master. Then I will delete and re-format the old drive and use it for other purposes.
 
Old 11-25-2005, 02:28 AM   #4
ChriZathens
LQ Newbie
 
Registered: Nov 2005
Distribution: Redhat 8 , Fedora Core 2
Posts: 12

Original Poster
Rep: Reputation: 0
Thanx a lot for your replies , guys .
The reason for using the dd command is that it is the fastest way to clone the disk when i'm facing a problem.
I have the mother-disk and when needed i install 2 disk inside a PC and execute the dd command.
(When something like that is needed, i must prepare a new machine in no time.
Besides that, not all the disks are 37 GB, so i needed to mount the extra space only in the large disks.)
I guess then that my only option is to create a new installation on a 37GB disk and when the destination disk is 37gb i will use the large mother-disk.When the destination is a small disk , i will use the small mother-disk.

Quote:
Originally posted by tredegar
There are plenty of threads on this board addressing the problem of "moving to a larger disk". May I suggest you investigate the search button above?

Hope this helps.
I did a little search, but my case is a little different...But i guess you are right

PS: Excuse me if my expessions are not 100% understood (English is not my native language...)

Last edited by ChriZathens; 11-25-2005 at 02:42 AM.
 
Old 11-25-2005, 05:38 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,093

Rep: Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978
I don't like using "image" solutions, but if you want to use it, perhaps try imaging partitions rather than the whole disk.
Try setting up the target disk with the required partitions, then dd from sda1 to sdb1, sda2 to sdb2, etc ...

This way the part table for the target is valid for the size of the target disk. Also the target parts can be larger than the source, so after the dd, a filesystem resize should work.
A little more work (but not a lot), and a lot more flexible.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
post 1024 cylinders unpartitioned installation? eliteskills Linux - Newbie 2 02-14-2005 04:09 PM
Multiple unpartitioned spaces... RoaCh Of DisCor Linux - Newbie 4 12-09-2004 09:26 PM
Do i have unpartitioned space? p0rt Linux - General 5 08-17-2004 05:00 PM
My /home partition shows up as unpartitioned space! purplecow Linux - Hardware 2 07-06-2004 05:20 PM
cfdisk (slackware 9.1) wont recognise unpartitioned space vespatian Slackware 1 12-09-2003 12:56 PM


All times are GMT -5. The time now is 03:11 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