LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-30-2004, 03:29 PM   #1
Davisgwin
LQ Newbie
 
Registered: May 2004
Posts: 6

Rep: Reputation: 0
Changing disk drive label


I have a disk drive from failed computer with data on it that I need. I mounted it as an additional drive in my computer using Redhat version (9.0 ( the same as the old computer) and it won't mount. It says duplicate label /boot. How do I change the label to allow it to mount as an additional drive?
 
Old 07-02-2004, 04:41 PM   #2
skip_g33k
LQ Newbie
 
Registered: Feb 2004
Location: Boise, ID
Distribution: SimplyMEPIS, RHEL3 WS, RH9
Posts: 24

Rep: Reputation: 15
Good news, I've been wondering that myself. Over the last couple of years I never found a satisfactory answer until today. Here is the URL:
RedHat 8.0 User Manual

In short, the utility that you need is called
Code:
e2label
To use it, you specify a partition as the first parameter and a label as an optional second parameter.

Eg. Check the label on partition /dev/hdb1
Code:
e2label /dev/hdb1
Eg. Set the label on partition /dev/hdb1 to /var
Code:
e2label /dev/hdb1 /var
I hope this helps you out. Post again if you have trouble.

Skip
 
Old 07-16-2004, 05:26 AM   #3
coolingtower
Member
 
Registered: Jul 2004
Location: AnPing, Tainan, Taiwan
Distribution: Ubuntu 11.04
Posts: 42

Rep: Reputation: 15
Changing the name and label of /boot

Hello, Skip,

Earlier you had helped Davisgwin with his bootup problem "duplicate found.../boot not mounted." You offered very useful information--thank you!

I bought a new (much larger) hard drive and I would like to be able to sometimes boot the old one in order to do things before I'm "totally switched over".

The question is: is it safe to change the name of the /boot partition, then change it back and go boot it? Normally I'm very brave about trying things, but I have many years' worth of data on the "old" drive and I'm afraid of rendering that disk unbootable.

Thanks,

coolingtower
 
Old 07-16-2004, 12:50 PM   #4
skip_g33k
LQ Newbie
 
Registered: Feb 2004
Location: Boise, ID
Distribution: SimplyMEPIS, RHEL3 WS, RH9
Posts: 24

Rep: Reputation: 15
coolingtower,

It should be safe to change the /boot label. I'm sure you don't want to do that very often, but that's just a gut feeling. But why do you need to? You can most likely do what you want by setting up your boot loader properly. I probably don't understand exactly what you are trying to do but here are my thoughts. Reply with some more details if I don't present a workable solution for you. Things that would be helpful are partition table information, where your data is, what you plan to store on your old drive and on the new one, and anything else like distro, etc.

First off, I'm guessing that you have an installation of RH9 on your original disk and that you have a new installation of something on your new, larger disk (or are planning to). I'm also assuming that, since you have a /boot partition, that you also have a / partition that is separate.

Since you want to keep your old data and installation this is what I would do.

Boot into your working system and edit your /etc/fstab to not automatically mount the /boot partition. On the /boot line you should add the option noauto and change the label to /oldboot. The line in your /etc/fstab file should look something like this:
Code:
LABEL=/oldboot   /boot   ext3   defaults,noauto 1 2
This label will match the label that we are going to give it. Save /etc/fstab.

Now lets change the label on the /boot partition.
Set it to something innocuous. First check that we have the right partition:
Code:
e2label /dev/hda1
If it isn't /boot, then keep looking till you find it. Now, set the label (on the correct partition ) to something else:
Code:
e2label /dev/hda1 /oldboot
Reboot and make sure that the existing installation still boots and works properly. Since we don't automount the /boot partition anymore, check that too. Try:
Code:
mount /boot
ls /boot
This shouldn't fail and you should see everything appear as before since all we did was rename a partition and tell /etc/fstab where to find it. Now, shutdown the computer.

First, unplug your old drive. Plug in the new drive and make it the master on IDE channel 0. Then do the install on the new drive like normal. Boot into it and make sure that everything is as it should be and that the boot loader is working correctly. Before you shutdown, edit your /etc/fstab file and set the options for the /boot partition to include noauto the same way we did before.

The line in your /etc/fstab file should look something like this:
Code:
LABEL=/boot   /boot   ext3   defaults,noauto 1 2
Now shutdown so we can reconnect the old drive.

Now you can connect your original drive as the slave on IDE 0. This will allow your new installation access to the old drive. At this point you should have two working drives connected in your computer, the master should boot you into your new installation, and you should be able to mount you old partitions and access the data there.

Power on and your new installation should boot on your new drive. Now comes the cool/fun/tricky part. What we want to do is modify the configuration of your boot loader to not only boot your new installation but also the old one. I know how to do this with grub (but not lilo) so I'll use that as my example.

For the next part I'm going to assume the following partition layout:
Code:
New drive (hda)
   Label Partition
   /boot hda1
   swap  hda2
   /     hda3
Old drive (hdb)
   Label Partition
   /boot hdb1
   swap  hdb2
   /     hdb3
Now we can check out how to boot your old installation. Mount the old boot partition:
Code:
mkdir /mnt/oldboot
mount /dev/hdb1 /mnt/oldboot
Check out the old grub.conf:
Code:
cat /mnt/oldboot/grub/grub.conf
You should see an entry like this:
Code:
title Red Hat Linux (2.4.20-8)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img
It's time to edit the new boot configuration file. So mount the new boot partition:
Code:
mount /boot
And edit the /boot/grub/grub.conf and add this old section. You should now have a grub.conf that looks something like this:
Code:
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.6.1smp)
        root (hd0,0)
        kernel /vmlinuz-2.6.1smp ro root=LABEL=/
        initrd /initrd-2.6.1smp.img
title Red Hat Linux (2.4.20-8)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img
But the old boot section doesn't reference the correct drive. So change the root (hd0,0) to root (hd1,0) (disk hdb, partition 1).

Save the file. Reboot and you should now see multiple boot options. One of them should be the entry you just added for your old installation. First, lets choose the default and make sure that the new installation still boots. Then reboot and try the other option.

You should boot into your old installation.

This way you can have both installations boot, without having to continually modify the partitions or labels.

Good luck, and post again if have trouble, questions, or if I was so far off that this isn't helpful at all.

--
Skip
 
Old 07-17-2004, 10:24 AM   #5
coolingtower
Member
 
Registered: Jul 2004
Location: AnPing, Tainan, Taiwan
Distribution: Ubuntu 11.04
Posts: 42

Rep: Reputation: 15
(First of all I'd like to include a NOTE TO SCSI users: in the previous post, the author was assuming my hard drive was IDE and he used /dev/hda in the examples. I have a SCSI drive and I replaced those with /dev/sda. This could be something important to notice if your drive is a SCSI drive.)

Skip,

Thank you very much for taking the time to help me out with this!!!! The first half of your post absolutely nailed my problem and now everything is fine. Both hard drives don't complain about each other, which was my original goal in writing to you.

Now as for the Grub portion of your post, let me fill you in on exactly what I had planned in the first place:

Originally my system was, well, sort-of dual-boot:
"old" drive /dev/sda SCSI, 38gb, totally RH9.0
"very old" drive /dev/hda 20(?)gb, English XP bootable, huge "bridge" drive D:

(I call it the "bridge" drive because I can mount it with Linux and move files between the systems. I had set it up in /etc/fstab so that I could simply type 'mount /mnt/bridge')
To "dual-boot", I simply changed the computer's BIOS for "boot order" from "SCSI-ATA" to "ATA-SCSI". This worked fine since I never shut off my computer and only use XP a few hours a week, at the most. Usually for scanning, video games, downloading pictures from my phones or camera, or transferring files to/from my USB "mobile disk"--(however you say that in English(?).

I had bumped the "very old" drive down to slave, and had envisioned this setup:
"old" drive: still /dev/sda (no changes)
"new" drive: /dev/hda 120gb--(Chinese XP/RH9.0 dual-boot with GRUB)
"very old" drive: /dev/hdb (left alone, also).
(I wanted Chinese XP in order to: type Chinese text files that are useful at work, play a Chinese-language RPG I recently bought, type Chn. in MSN, etc.)

As of this writing, I have successfully booted off the renamed SCSI drive (Thanks, again). The "new" drive is working with GRUB to dual-boot Chinese XP and RH9.0 (very fresh installs--I haven't set up networking or other details yet). The "very old" drive is unchanged and its "Bridge" partition is still mountable with this setup as I have updated /etc/fstab to change its name from hda to hdb.

My main goal:
1. Consolidate important files onto the new drive.
2. Get the new RH install comfortably working.
3. When satisfied, blow away the "old" drive and turn it into a huge, shared "data warehouse".

NOW......thanks to the second half of your post, I am confident I will be able to change my GRUB into some kind of super-GRUB that can boot everything and I won't need to mess with the BIOS anymore.

A FEW MINOR PROBLEMS:
--- When I installed Chinese XP the first time, I created a huge D: drive that was to be a new "bridge" between the systems. Linux couldn't mount it because it was an "embedded logical drive" or something like that. I figured "I'll just use Linux to create that."

--- I blew away the drive and reinstalled Chinese XP. I gave it 8GB, reinstalled Linux and wanted to partition a huge VFAT "bridge" drive. Disk Druid said something to the effect of "maximum allowable size = 2048mb". Is that possible? I'm "nearly" certain that my original bridge drive is bigger than that.

--- When I installed RH on the "new" drive, I put GRUB in /dev/hda2 I believe. I rebooted and it started Windows. I redid it and put it in the MBR. Now it works fine. I'm worried I won't be able to make changes to GRUB. Whaddaya think? If grub.conf is embedded in the MBR then I may have problems.

Anyway, it's not too late to blow away the "new" drive again. I'm satisfied that dual-boot is working, but I haven't put so much time into that drive that I might be sad to lose if I were to redo the whole thing.

Thank you very much for your help, Skip!!!!

coolingtower

(An extra tidbit for potential dual-boot users: If you have XP and Linux on the same drive and you want to repartition, simply booting off the XP cd won't work. (This is assuming you haven't put work into your Linux partition yet). You need to pretend to install Linux, get into Disk Druid, erase some partitions, create some phony ones. When Red Hat says "copying installation image to the hard drive" put your XP cd in, push "reset" and then when it boots you can do partitioning with XP. This action also erases the MBR, in case you have a pesky MBR that you can't get rid of.)
 
Old 07-19-2004, 10:04 AM   #6
skip_g33k
LQ Newbie
 
Registered: Feb 2004
Location: Boise, ID
Distribution: SimplyMEPIS, RHEL3 WS, RH9
Posts: 24

Rep: Reputation: 15
coolingtower,

Thanks for the compliments. I hadn't thought of using SCSI since I don't have any experience with them, but you're correct about changing the names to /dev/sda, etc.

As for your questions (I may have missed one, so reply and I'll see what I can come up with ):

Quote:
Disk Druid said something to the effect of "maximum allowable size = 2048mb". Is that possible? I'm "nearly" certain that my original bridge drive is bigger than that.
I have had the same trouble creating partitions greater than 2 GB of type VFAT. Unfortunately, I don't have a solution for that right now. If you find something, I'd appreciate hearing about it. I know that Windows creates bigger VFAT partitions, but I'm not sure what, if any, Linux tools do.

Quote:
When I installed RH on the "new" drive, I put GRUB in /dev/hda2 I believe. I rebooted and it started Windows. I redid it and put it in the MBR. Now it works fine. I'm worried I won't be able to make changes to GRUB. Whaddaya think? If grub.conf is embedded in the MBR then I may have problems.
Grub doesn't work like Lilo. The grub.conf actually lives on the /boot partition, in the grub directory, and is referenced by the bootloader which lives in the MBR at boot time. This is part of its flexibility and allure. You only install grub once, like you did to the MBR. Then you can boot into Linux and modify grub.conf all you want and the boot loader will read it at boot time. So it should work just fine for you the way you did it the second time.

Since that may not have been entirely clear, keep grub installed in the MBR. Then you can modify the grub.conf found in /boot/grub. At boot time, grub will read the file from disk and pick up any changes that you made to it. You don't have to reinstall grub each time you change the file the way you do with lilo.

You posted some good work arounds for doing the installation of XP and Linux. I might add that there are now a number of LiveCD variants of Linux that allow you to boot a Linux distro off CD and use the tools without doing a partial install to get to Disk Druid. One of the best known is Knoppix, a full blown debian distro which is excellent at detecting hardware and then booting into KDE. A smaller one that I like to use is SystemRecueCD, based on Gentoo. It's great. It has an excellent set of tools, is about 100 MB and "works for me". Again, I haven't tried it with SCSI drives, but it has worked for me on the boxes that I maintain.

Quote:
When I installed Chinese XP the first time, I created a huge D: drive that was to be a new "bridge" between the systems. Linux couldn't mount it because it was an "embedded logical drive" or something like that. I figured "I'll just use Linux to create that."
Sorry, I don't know anything about this. I haven't used XP to create partitions on a new drive yet.

Hope this helps.

--
Skip
 
Old 07-19-2004, 10:41 AM   #7
skip_g33k
LQ Newbie
 
Registered: Feb 2004
Location: Boise, ID
Distribution: SimplyMEPIS, RHEL3 WS, RH9
Posts: 24

Rep: Reputation: 15
coolingtower,

Here is a page from Microsoft that explains about FAT, VFAT, FAT32, and NTFS.

Summary, FAT and VFAT are limited to 2 GB partitions. FAT32 supports larger partitions. NTFS is another animal altogether. But Linux is stating to include support of NTFS as well.

So you need to create a FAT32 (type 0B, or 0C (for LBA)) partition instead of a VFAT partition.

Here is a link to an article
that shows how to create a FAT32 partition.

I won't repeat it here. But it looked like it would work. Be sure to look at post #9 (the link should take you right to it.) I don't know of any graphical partition tools that allow you fine grained control of partition type so you'll probably have to use the command-line tools as described.

Also, the man page for mkdosfs says that it will automatically select FAT12 or FAT16 so you still need to explicitly specify a FAT32 type if you want it.

Hopefully this solves the last problem. And, please, let me know how this works out for you.

--
Skip
 
Old 07-20-2004, 12:22 PM   #8
coolingtower
Member
 
Registered: Jul 2004
Location: AnPing, Tainan, Taiwan
Distribution: Ubuntu 11.04
Posts: 42

Rep: Reputation: 15
Skip,

Thank you for the more detailed information. I was about to tell you how I created a partition on Saturday when I discovered your last post. Anyway, that's useful info.

LINUX FDISK:
I did it with RH's fdisk command. In partitioning my drive, I was thinking more in terms of % of drive space rather than gigabytes. I booted my old SCSI drive, logged in as root:

fdisk /dev/hda
The menu tells you what to push for "help", but I forgot. The "p" command is the first useful command to (p)rint the partition table on the terminal. The total number of cylinders on the drive will be shown above the table somewhere. Then "n" for "new partition." It asks for the partition number. Then, you can change the code. I used 0b, printed again and then it showed up as Win 95 FAT32. (Other useful commands: q = quit without saving; w = write partition table and quit.) I did it through guesswork. (NTFS = cyl 1 to 1045, with 16000 cyls total). I made the partition 1046 to 6500 or something like that).

I rebooted XP, formatted the disk, put a random file in there and then rebooted Linux. I made an entry in /etc/fstab for it and it still mounts using -tvfat as the file system type.

WARNING: Fdisk does exactly what you tell it to--not necessarily what you want. It's very easy to shoot yourself in the foot with this program. It's a powerful partitioning tool when used carefully, though.

PARTITIONING WITH XP:
A "stock" install of XP seems to only be able to create C: and D: within a huge partition with D: being an extended partition. That's a pretty user-hostile feature. Maybe an XP expert might have more insight than simply partitioning while installing(?).

ONE OTHER TIP:
While we're on the subject of moving files between the two different systems, sometimes you'll forget and copy or move files as root and then be dismayed by the fact that you can't access them properly as "you". Easy fix:

su root
chmod 777 <root-owned-files>
exit
tar -cvf <tarfile> <root-owned-files>
tar -xvf <tarfile>

This simply creates a tarfile owned by "you" with the root-owned files added. Upon extraction, since the tarfile is owned by "you", the files will be as well. This is also good when passing files through a not-Linux and non-FAT32 drive, because the long file names will be preserved within the tarfile (along with the u/l case).

Thanks again, and let me know if I may be of any help.

coolingtower
 
Old 09-29-2004, 02:50 AM   #9
linx win
Member
 
Registered: Jan 2004
Posts: 390

Rep: Reputation: 31
I have my boot system in the mbr of hda while my SuSE 9.1 system is in hdb8. I removed hda from my system and hdb became hda. I installed another copy of SuSE on hda9 and added the previous copy to its boot list because I did not know how to do that in the mbr. Now when I start SuSE (hda8) I get :

fsck failed. Please repair manually and reboot. The root file system is currently mounted read-only. To remount it read-write do:

bash# mount -n -o remount,rw/

I did:

"reiserfsck --check /dev/hda8"

and do "reiserfsck --fix-fixable /dev/hda8"

and told me no corruptions. Can some one help me?

Last edited by linx win; 09-29-2004 at 02:52 AM.
 
  


Reply



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
How to change the label of a disk dtournas Red Hat 0 08-17-2004 08:02 AM
edit boot disk after changing drive to slave? petrosil Linux - Newbie 4 11-17-2003 09:26 PM
Disk label problem Juniper34 *BSD 2 08-21-2003 06:01 AM
Disk label strangeness? MadCactus Linux - General 2 08-13-2003 12:24 PM
Disk Label Editor Philo *BSD 13 07-06-2003 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:38 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
Open Source Consulting | Domain Registration