LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-27-2005, 08:03 PM   #16
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15

Well, everything was working well until I modified /etc/fstab.

I cannot boot the system now. How can I go in and edit /etc/fstab since the system will not boot? When trying to boot I can get a maintenance prompt.
 
Old 12-27-2005, 08:15 PM   #17
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Okay, disregard the last message. I took care of it.

I did compress some files and copied them to hdb, but I think I have partitioned the drive incorectly.

How do I need to setup the single partition for hdb and mount it so I can access it when booted into hda?
 
Old 12-27-2005, 08:37 PM   #18
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Post #9 first 2 line of Method B refers. You don't need me to remind you altering hda1 to hdb1, do you?
 
Old 12-27-2005, 08:49 PM   #19
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee
Post #9 first 2 line of Method B refers.
Oh, sorry. I actually ignored it since I had the bootable floppy. My Ubuntu Live-CD is 25% downloaded as we speak.

Quote:
Originally Posted by saikee
You don't need me to remind you altering hda1 to hdb1, do you?
I don't understand your question???
 
Old 12-27-2005, 09:08 PM   #20
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
The 2 lines in Post #9 were written for mounting partition hda1.

You now want to mount hdb1 and I take it you would know to allter the partition reference yourself without the need of writing the lines out in full for you again.

Method (B) is the standard method to "hoop" from one working Linux into an "unbootable" Linux. It is a technique you need to know to survive in future.
 
Old 12-27-2005, 09:21 PM   #21
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee
You know if you have more data than the space availabe nobody can do it unless you compress the data but that make it inoperable.
On hda I have an 80GB over four partitions:
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    defaults,errors=remount-ro,usrquota,grpquota 0       1
/dev/hda5       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
hdb is only 40GB and I currently have on partition on it.

Quote:
Originally Posted by saikee
Assuming your data in hda can be physically fitted into hdb and "all of them are in a single partition" then the task is quite simple but you should do it with a 3rd system because copying an operating Linux isn't a good idea because you copy the mounted systems also.

If you boot up a Live CD (it is a bit slow), say you want hda1 to move into hdb1 then tar is quite reliable to preserve the full structure of the Linux. You first make /mnt/hda1 and /mnt/hdb1, mount them, change directory to the source and tar it to the target directory
Code:
mkdir /mnt/hda1
mkdir /mnt/hdb1
mount /dev/hda1 /mnt/hda1
mount /dev/hdb1 /mnt/hdb1
cd /mnt/hda1
tar cf - . | (cd /mnt/hdb1; tar xf -)
That is all. The tar command does not copy the boot loader but you can boot it with the Grub floppy and do a grub-install afterward in the new envirnment when hdb becomes the hda.
I guess I just don't understand this particular tar command, but I get the overall function of your code...I think. Given my current partitioning on hda, will your code still work for me?

Quote:
Originally Posted by saikee
The 2 lines in Post #9 were written for mounting partition hda1.

You now want to mount hdb1 and I take it you would know to allter the partition reference yourself without the need of writing the lines out in full for you again.
I get your "alter 'a' to 'b' now. I just overcomplicated the statement...
Quote:
Originally Posted by saikee
Method (B) is the standard method to "hoop" from one working Linux into an "unbootable" Linux. It is a technique you need to know to survive in future.
Thank you for the extra info. I may need it again someday.

I tell you, this has been a bit of a chore so far. All I am trying to do is copy my data so I can replace my current o/s and have a means to fall-back if I have problems importing my user data from the backup. Maybe I just need to go out, sell one of the kids (kidding), and buy another 80GB drive so I can make a complete image. Then I wouldn't have much more to worry about. If you think the tar code will work, maybe I'll still try it.

I deeply appreciate all of the help and knowledge you have given me to this point. It is obvious that you are greatly experienced and don't mind sharing the wealth. "What goes around, comes around!"
 
Old 12-27-2005, 10:46 PM   #22
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
I tried to mount hdb1 after making the directory and it said I need to specify the file system type. I am unsure what the type is. When I partitioned hdb I used:
Code:
cfdisk /dev/hdb
This is what the partition looks like:
Code:
                                  cfdisk 2.12p

                              Disk Drive: /dev/hdb
                        Size: 40020664320 bytes, 40.0 GB
              Heads: 16   Sectors per Track: 63   Cylinders: 77545

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    hdb1        Boot        Primary   Linux swap / Solaris             40020.67











     [Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]
     [  Quit  ]  [  Type  ]  [ Units  ]  [ Write  ]

                 Toggle bootable flag of the current partition
This is the first time I used cfdisk. I even tried fdisk and it didn't give the FS Types I am familiar with e.g. ext2, etc.

What FS Type should I use? Also, when mounting it I used:
Code:
mount /dev/hdb1 /mnt/hdb1
How do I specify the FS Type here?

Thanks again for the help.
 
Old 12-28-2005, 09:08 AM   #23
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Ok It looks I need to explain a little bit more

When you want to clone one partition to another the best way to do it is to ignore the filing structure and write out the binary pattern of 1s and 0s. That is to use "dd" command. Although Linux officially cannot write on a NTFS partition one can clone a XP system and have it bootable by using one line of dd statement of
Code:
dd if=/dev/hda1 of=/dev/hdb1
Pretty impressive, isnt it? The relevance to your current problem is that dd only works if the source partition hda1 is "identical" in size to target partition hdb1 because it is a byte by byte transfer. So if you can use cfdisk program to create hdb1 identical in szie to hda1 then dd is the one to use. dd mirrors the entire partition 100% and the boot loader will be transfered across also. The boot loader is always in the boot sector of the partition and not part of the filing structure.

If you have the target different in size to the source then tar is the one I use mostly. I have the same feeling of your apprehension of the command
Code:
tar cf - . | (cd /mnt/hdb1; tar xf -)
because I didn't know what it means too. But it is a piece of cake if you understand "-" = the whole lot, "." = the current directory and "|"=next step. The command is compress the files (cf) the whole lot in the current directory then change to the target directory /mnt/hdb1 and expand the file (xf) there. This is the part of Linux I really like. It is simple, neat and totally bomb proof. You can see the things done at lighning speed too. I normally add a "date" statement before and after the tar or dd command if I want to know how long it takes to complete the task.

Now you may pick up that dd addresses the directory by the "raw device" names whereas tar command addresses the same but in a filing structure names inside directory /mnt. This implies tar works with the filing system. Thus your hdb1 must be "formatted" first in order to have a filing structure.

Since the tar command works on the filing structure it is automatically able to cope with source and target partitions of different in size. Therefore tar should work for you. All you need to do is to format your hdb1 in the standard ext3 format by
Code:
mke2fs -j /dev/hdb1
You will find Linux will not ask for the filing type after you have formatted hdb1. Another impressive feature of Linux in that it is very logical. You will do exactly the same thing if you are Linux yourself.

Lastly since you are tight with hard disk space to the point needing to sell your kids you may consider to use the minimum size for your hdb1.

I have not been able to find how how many partitions in your hda disk from the thread nor do I know how many other partitions in hda you want to copy across but Debian Sarge in my box has an installed footprint of of just under 2Gb. As 99% of the 97 distros I installed do not exceed 5Gb I suggest you re-partition your hdb to have hdb1 size 5Gb and type 83 so that the rest of the hard disk is unallocated but available for future use. My hda has 60 partitions fully populated by distros each in a 5Gb partition, including Debian Woody and Sarge. So there is no need to sell your kid to get another hard drive.
 
Old 12-28-2005, 12:09 PM   #24
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee
When you want to clone one partition to another the best way to do it is to ignore the filing structure and write out the binary pattern of 1s and 0s. That is to use "dd" command. Although Linux officially cannot write on a NTFS partition one can clone a XP system and have it bootable by using one line of dd statement of
Code:
dd if=/dev/hda1 of=/dev/hdb1
As far as a backup solution (beyond RAID) I was considering using a similar dd command dd if=/dev/hda of=/dev/hdb, create a script and put it in the daily cron directory, and so on. Btw, I think I am going to go ahead and just get two identical drives today. This would make my project much easier. ...I'm sure going to miss the kids though.

Would you recommend a different means of backing up/imaging (rsync, or something else)? Or, would you recommend running the software RAID for these two 80GB drives. FYI, I will be installing Mandriva 2005.

Thank you so much for explaining the tar statement you provided. I completely understand it now.

Quote:
Originally Posted by saikee
I have not been able to find how how many partitions in your hda disk from the thread nor do I know how many other partitions in hda you want to copy across but Debian Sarge in my box has an installed footprint of of just under 2Gb. As 99% of the 97 distros I installed do not exceed 5Gb I suggest you re-partition your hdb to have hdb1 size 5Gb and type 83 so that the rest of the hard disk is unallocated but available for future use. My hda has 60 partitions fully populated by distros each in a 5Gb partition, including Debian Woody and Sarge. So there is no need to sell your kid to get another hard drive.
I have 5 partitions (not 4 as I mentioned in post #21) on hda.
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    defaults,errors=remount-ro,usrquota,grpquota 0       1
/dev/hda5       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
The total used space in hda is somewhere under 1GB currently. Even though I am purchasing the two new drives today, I would still like to make this tar copy over to the current hdb1 (40GB). That way I can have a backup of the existing Debian install.

Given that I have 5 partitions in the current (Debian) hda, I think I only need to tar hda1. I am not sure what the proc partition is used for. I used a tutorial to setup these partitions.

Now when it comes to the new install (Mandriva with the two 80GB drives) assuming that I am going to use dd to image the hda -> hdb, how should I initially partition hdb? Should it just be free space?
 
Old 12-28-2005, 01:45 PM   #25
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Your partitioning scheme in the hard disk is the information on the screen when you type at Bash shell
Code:
fdisk -l
The files in /etc.fstab are those the Linux must load at boot time.

If you use RAID-1 you can kiss dd and tar goodbye as you won't be needing them. Basically you put two identical disks in but only one can be seen and used. The other one just mirror the first one at the background. You have access to the second one only when you break up the RAID.

However not all Linux can understand your RAID system and some will treat them as different disks thereby upsetting the whole arrangement. I broke up my RAID because of this trouble.

DD is easy but duplicating a 80Gb disk is a 45 minutes job. A fast processor may cut it down to 25 to 30 minutes. Thus I would in your case just tar partitions out if I go down that route. In a recent tar exercise with a 5 Gb partition by Suse 10.2 x86 64 the time was 100 seconds.

You will find Mandriva a lot better to use as it is one of the most modern distros. The Mandriva I have is 4.8Gb large after installation and I would give a 10Gb space to it.

If you need to backup your work on the daily basis you need to use more sophisticated than the simple way I have suggested or go for a different command. I can't help you on this so you need to put up a new thread or do a bit of search.

For my money I would partition my drive as

/dev/hda1 in Fat32, size 2Gb and install FreeDos onto it.
/dev/hda2 in Fat32, size as large as you need for your work, say 20Gb
/dev/hda5 as Swap, 1Gb large. Being 5th means this is the first logical partition
/dev/hda6 as 5Gb large for Debian
/dev/hda7 as 10Gb for Mandriva
rest unllocated

The hda1 allows you to access all your work without a Linux. If the MBR disappears completely you can still boot it up with a Dos floppy and check all your work

hda2 is what you need to backup. You can do it with Dos's copy command or Linux's drag and drop in Windows without bothering about dd or tar. Being smaller, at least initially, it should be easier to maintained.

I recommend the first logical partition as the swap because every Linux needs it and it helps to remember where to find it if it is always the first logical partition.

You don't need to backup Linux itself. If one goes down you can use the other to rescue it. Don't mix your data with an operating system either. You can always re-install a Linux but but not your data. You may need to mount the data partition hda2.

With the exception of the swap you can put Grub in any partition. I would use the Grub provided by either Debian or Mandriva initially and finally put it into hda2 the data partition which is accessible to Dos and two Linux

So take your new hard disks back to the shop, ask for a refund and buy back the kids now.
 
Old 12-28-2005, 02:58 PM   #26
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Wow! What valuable info--thanks! I did already buy the drives, but the kids are just rented out for a while. I think I will keep them and make a decision about which route to take. I tried to run the fdisk -l command and it did not return anything. I did this through PUtty, but that shouldn't matter would it?

Thanks again for all of the help. You are one in a million... Of course I may still have additional questions once I get started (whichever I decide to do)...
 
Old 12-28-2005, 03:07 PM   #27
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Not used Putty before so can't comment on it but "fdisk-l" is responded by every Linux I came across. You can use the Grub floppy to get the full list of the partition types but not their sizes by
Code:
geometry (hd0)
I am only handing out information I learn from others in the forum. Part of the enjoyment of being in Linux is because of its nice friendly community.
 
Old 12-28-2005, 03:13 PM   #28
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee
I am only handing out information I learn from others in the forum. Part of the enjoyment of being in Linux is because of its nice friendly community.
I have about 3 months of Linux experience. I am currently running a webserver that hosts a few sites. I run a bulletin board, Gallery2, and some other cool things. It has been a real learning experience for me and I cannot say enough good about the Linux community. I have already been able to help others from what I have learned.

I extend many thanks to people like you... I will be certain to share the knowledge that I have retained as well. For now, I am working on keeping my head above water.

Btw, can I ask why you have so many distributions of Linux running? Just curious...
 
Old 12-28-2005, 03:34 PM   #29
ctroyp
Member
 
Registered: Sep 2005
Distribution: Fedora Core 4 / CentOS
Posts: 92

Original Poster
Rep: Reputation: 15
Quick question, I tried to mount hdb1 using:
Code:
mkdir /mnt/hdb1
mount /dev/hdb1 /mnt/hdb1
It seemed to work, but should I be able see the contents of hdb1 in the directory /mnt/hdb1 using "ls -l"? I copied a test file over to hdb1 to see if it would show up in /mnt/hdb1 and did not see it. Originally, after I mounted the hdb1 partition, I saw a file called "lost+found". What am I missing here?
 
Old 12-28-2005, 03:52 PM   #30
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Once you have mount the partition it becomes part of the filing system that you can operate in the desktop. So just drag and drop as much as you like there. The command to list your filing system in shell should
Code:
ls /
and
Code:
ls /boot
and so on to search anything you want when the GUI desktop is unavailable for some reason.

I keep the distros I installed as I couldn't see why I should destroy them. These are my experience and many of them have fascinating features. Hard disk space cost in UK is about 33 or US$66 per 100Gb so the money I save in not keeping a distro in a 5Gb partition can hardy buy me a pint of beer. It is just a way to Learn Linux for me. The box is my best teacher.

By the way unlike Windows that cannot be transferred between PC I brought my Linux hard disk to new machines. Many of the distros I kept have lived in 3 PCs so far.
 
  


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
move grub dmenezes Linux - Newbie 1 08-28-2005 12:26 AM
Help with Grub: move it to /boot linda Slackware 14 11-01-2004 08:29 PM
How do i MOVE grub? MadSkillzMan Linux - General 5 10-26-2004 06:54 PM
Move from GRUB to XP geekBass Linux - Newbie 1 03-09-2004 01:24 AM
Grub/booting problems after partition move jacobly Linux - Newbie 3 09-02-2003 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:15 PM.

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