Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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??
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?
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.
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.
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.
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.