Mailinglist Archive: opensuse (963 mails)

< Previous Next >
Re: [opensuse] How to re-shuffle disk partitions
On 2011/04/21 10:13 (GMT-0400) Anton Aylward composed:

This is not a question about what tool to use, but about how to avoid a
major screw-up.

On a laptop I have an OpenSuse 11.3 with the disk configured thus:

Device Boot Start End Blocks Id System
/dev/sda1 1 1275 10241406 7 HPFS/NTFS
/dev/sda2 1276 2530 10080787+ 7 HPFS/NTFS
/dev/sda3 2551 9729 57665317+ f W95 Ext'd (LBA)
/dev/sda4 * 2531 2550 160650 83 Linux
/dev/sda5 2846 9729 55295698+ 8e Linux LVM
/dev/sda6 2558 2836 2241036 83 Linux
/dev/sda7 2837 2845 72261 82 Linux swap
/dev/sda8 2551 2557 56164+ 82 Linux swap

Partition table entries are not in disk order

That's usually because the first logical partition got created before the last primary partition got created. The order of original creation usually determines which table entry slot gets used for the extended. They could be rearranged into disk order, but doing that requires additional skillful procedures to be performed in a certain sequence to avoid an unbootable system.

Please not that last line!

You mean s/not/note/? What about it? A 2nd swap partition?

This was originally a dual boot machine, but when I asked when was the
last time you booted into Windows I was met with the kind of glassy
stare you expect from a deer caught in your headlights. DUH!

So C: (/dev/sda1) and D: (/dev/sda2) go.
Maybe make /dev/sda1 into /boot and some swap?
In an ideal world ....

* I'd drag /dev/sda4 (/boot) to the beginning of the disk
* I'd drag /dev/sd7 and /dev/sd8 to follow it as swap
and merge them
* I would somehow expand the LVM to use the space left
over in C: and D:

But my problem is what will happen to the naming/numbering?

My concern is that everything else gets re-numbered.

The names sda[1-4] actually come from the positions of the partition entries in the MBR's partition table. You can delete sda1 & sda2 without affecting any other names.

In that ideal world, I suppose, a /etc/fstab that exclusively uses uuid
might be immune to a renaming of the partitions in /dev/sd? terms.
But that's not what I've got with this client.

I'm hesitant to take a step here lest I end up with an unbootable system.
What do the Disk Layout Gurus advise?

[And yes, in a perfect world we would be running Grub2 and all this
could have been put in a LVM and the Windows stuff could have been
a virtual machine and none of this would be a problem since LVM is
much smarter about naming "partitions". But ...

1-Delete 1 & 2.
2a-create a 160650 block sda1 that could function as a replacement /boot
3a-create another LVM sda2 with remainder & adjust fstab accordingly; or
2b-create a swap of whatever size you deem sufficient as an exclusive swap partition
3b-create another LVM sda2 with remainder
4b-umount and delete sda7 & sda8, grow sda6 into the vacated space, adjust fstab accordingly

Those familiar with Grub's command interface and mkfs could easily go the 2a route, possibly before deleting sda2, copy the content of sda4 to it, install Grub to it, adjust fstab accordingly, and reboot with sda1 as the new /boot before proceeding to delete sda2 and sda4 to create a new swap sda2 and LVM sda4 in the space vacated by sda2 and sda4. Or, grow sda5 into all the space vacated by sda2 & sda4 - I think, since I'm unfamiliar with LVM niceties - and leave swap at the end of the disk. The latter should eliminate the out of disk order messages running fdisk -l, since there would only be one primary hosting a filesystem partition directly before the start of the extended. You'd then have either sda1, sda2, sda3, sda5, sda6.... or sda1, sda3, sda5, sda6.... depending on whether putting in the swap on sda2 or not.
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata ***
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups