How do I switch the labels "/dev/sda1" with "/dev/sda3"
I don't quite know how to phrase this to google it without getting a billion off topic answers. LQ Search gave me a billion off-topic answers.
I partitioned 4 disks so that I can RAID0 them. To get the partition sizes right, I ended up needing to put the identical partitions at the "end" and the leftovers at the "beginning." So, for example, I have (/dev/'s removed): sda3 20G, sdb3 90G (90 gigabyte partition) sda2 100G, sdb2 100G sda1 110G, sdb1 110G Well, it just so happened that I put WinXP onto what was originally sdb3, the 90 gig partition. It switched my numbers! sda3 20G, sdb1 90G sda2 100G, sdb2 100G sda1 110G, sdb3 110G OK, that's fine. I don't know how or why that happened, but it did. But I'm having some problems and one of the tests I'd like to try (to fix my problems) is changing the numbers for sda. How can I make it so that the sda numbers change too?: sda1 20G, sdb1 90G sda2 100G, sdb2 100G sda3 110G, sdb3 110G --vonSt PS: I'm pretty sure that responders will say "it doesn't matter one wit," but this is a test, and it'll help me learn more about the way Linux runs, so I'm interested in knowing if and how this procedure can be done, since somehow it got done for my WinXP install on what is now "sdb1". |
you say that you have four disks, but you only describe the contents of two....Please post the output of "fdisk -l" (run as root).
When you say you want to "change the numbers for sda", how were you thinking of doing that? Normally, when you make a partition and put stuff on it, you can't then change the partition number.....(I think) |
I only posted 2 disk partition schemes as an example. It's a mess for me to post the whole thing. The gist of it is above.
Quote:
My thought is that if WinXP can renumber my partitions, then I can too! --vonSt |
Quote:
|
Does Slack use udev? If it does, you can assign your own locations in /dev to specific devices (by model, serial number, etc.) which would be another solution for your problem.
It's very handy is you change USB devices frequently, but want to refer to them with the same /dev id without having to know where or when they're plugged in. |
Quote:
|
Slackware does indeed use udev... at some point or another. Oh no, does that mean I have to become the master of udev too?
OK, in response to pixellany's plea, I've learned a little bit more about lsmod, rmmod, and modprobe. I think I can load and unload the modules to attach a thumb drive to my new box when I need to. Up to now, it's been totally and confusingly random. It either decides to allow me to load /dev/sde or it refuses [blah... blah...]. Code:
fdisk -l So, what does it mean "Partition table entries are not in disk order?" Just that I assigned my partitions from back to front? Oh, and it's time to admit I lied. Windows didn't reassign /dev/sdb. It assigned /dev/sda. Interestingly, and maybe it relates specifically to udev, I switched the cables around. Windows used to be on /dev/sdc. It did the same to /dev/sdc. Now, however /dev/sdc is 321. It didn't stay as 123. Also, as you can see, sda3 + sdb1 + sdc1 + sdd1 make up a raid partition. sdc3 is my /boot. sdd3 is my swap. sdb3 is my dos partition to link me to everything. --vonSt |
Quote:
Example (text surrounded with code tags): Code:
$ sudo fdisk -l Quote:
|
First of all, forget about renumbering the partitions. You can't.
You can relabel the hard drives. It could be that you have some dynamic addressing set up on your SCSI bus and after Windows was installed on one drive, it set that drive as the boot drive - which most controllers will by default make sda. This would cause the reordering of drives (not partitions) that you are experiencing. I would suggest you let it go as far as Windows is concerned. Windows is pretty unfriendly about a lot of things pertaining to hardware configuration once it is convinced of how things are, and you will just buy trouble. Note: Windows is NOT referring to the drives as /dev/sda etc... you are being sloppy in your notation when you claim that. Your SCSI controller will have a utility that lets you look at what is mounted where. You will access this utility through a keypress combination during the boot procedure, at the time when the SCSI controller is initializing. I suggest you take a look at that, and write down the addresses/sizes of the hard drives that are connected. Then, in Linux, you will find what drive has been labeled which in /var/log/dmesg. Take a look at this and compare it to what you got from your SCSI controller, and you will know which bus address has been assigned to which drive. Now it depends on your boot loader. I can't help you with LILO because I have made very little use of it; I use grub. In grub, if you take a look at the contents of /boot/grub/device.map, you will see a mapping of grub's understanding of your physical drives to the Linux device mapping. Grub will number your SCSI drives based upon their physical address on the bus; the lowest address will be hd0, the next highest address is hd1, and so forth. What you need to do is compare this physical layout to the logical layout that you want to have assigned, and you then assign it as you want it. As a specific example, my system (which I am presently typing this message on) has four SCSI hard drives on an Adaptec 29160 controller. I don't run RAID and for various historical reasons, my drives are out of order and I have to remap them. Here is the contents of my device.map file: Code:
(fd0) /dev/fd0 The reasons for this labeling are historical and the only time it matters is when I upgrade my Linux installation, which inevitably hoses up the mapping. I just keep an archival copy and after the installation messes me up, I do a manual reinstallation of grub and restore the map I need. |
Quote:
What happens when you switch them back? |
Jim18 was right. I was being sloppy. I know WinXP had nothing to do with the numbering/ordering of my partitions. In fact, when I switched around the cables, I didn't reload XP. XP asks the BIOS which disk is first. I changed it around in the BIOS and kept XP as first disk. Everything still loaded, but the partition numbers changed on the two different disks. Dynamically, I guess.
** NOTE: I highlighted the disk partitions with cylinder #1. I did NOT assign cylinder #1 to /dev/sda1. I assigned cylinder #1 to /dev/sda3. (Actually, when I assigned it, it was /dev/sdc3... which turned into /dev/sdc1 when I loaded XP on it... and then that disk became /dev/sda when I switched the cables.) I don't actually want to switch the cables back. I predict that if I did, the numbers would change again. So, taking a cue from this thread, and given that I'm learning how to install RAID (and I don't actually have to use it for anything yet), I erased everything and started over. I took the "fdisk -l", learned how to assign my partition sizes as cylinders, and assigned all my disk partitions in the orders that I wanted them. I think this thread was a good thread. If you wanted to change the partition numbers and nothing else, could you? Nope, I guess not. Now anybody else that comes up with this grand scheme can come to the thread, say "damn!", and repartition their drives over again or just forget it and leave things lie. Repartitioning didn't solve my problem, so I'm going to start another thread. It'll be called "I can't automount raid because I don't have valid superblocks. How do I get them in ext3?" But that's a new thread. vonSt PS: I don't actually have SCSI. I have SATA. The kernel treats it as SCSI. I have an NV SATA RAID. I'm beginning to think that these three things don't go together very well. |
All times are GMT -5. The time now is 10:20 PM. |