Questions : disk partition re-reading
Hi,
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
2/ Is it possible to delete a disk partition without having the partition numbers changed?
My box is an AMD 2500+/Asus board with FC1 / 2.6.5.
Do I need to upgrade fdisk or use an other utility? Or do I need to apply a kernel patch?
Regards,
Remi
Quoted 28 lines · Christian Kröner
Quoted 15 lines · you
Hi,
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
2/ Is it possible to delete a disk partition without having the partition numbers changed?
My box is an AMD 2500+/Asus board with FC1 / 2.6.5.
Do I need to upgrade fdisk or use an other utility? Or do I need to apply a kernel patch?
Quoted 9 lines
Regards,
Remi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 7 lines
All this is possible...
Use fdisk or cfdisk for editing the partition table and, if youre root partition doesnt reside on the disk, simply use hdparm to let the kernel reread the partition table. You can start formatting the new partitions right after that... cheers, christian.
Christian,
I have modified a partition with fdisk.
Then, I have tried to update the in memory partitioning informations, but I have the following error message :
# hdparm -z /dev/hdb
/dev/hdb:
BLKRRPART failed : Device or resource busy
An other partition is used on the same disk.
Regards,
Remi
Hi Remi :)
* Remi Colinet <[email protected]> dixit:
Quoted 2 lines
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
sfdisk -R <disk-you-want-to-get-its-partition-table-reread>
Quoted 2 lines
2/ Is it possible to delete a disk partition without having the partition numbers changed?
For primary partitions, it is possible. Don't know for extended
ones :??
Quoted 1 line
Do I need to upgrade fdisk or use an other utility?
AFAIK, fdisk will do, except for rereading. Well, 'fdisk'
actually *do* a rereading, but only after altering the partition table of the disk. 'sfdisk' can do it on demand, but if the disk is busy the BKLRRPART ioctl will fail.
Raúl Núñez de Arenas Coronado
Signature · 2 lines
Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/
Quoted 6 lines · Remi Colinet
Hi,
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
Not if you want to use DOS partition tables, no. But read on.
Quoted 2 lines
2/ Is it possible to delete a disk partition without having the partition numbers changed?
Yes. fdisk will do this. But read on :)
Look into LVM.
Really, it solves all the silly problems with partition tables like:
1) requiring reboot after changing table on root disk
2) partition fragmentation
3) partition number limiting
4) the inability to partition SW-RAID devices
5) etc...
And then it adds some real niceties; like being able to span a "parition" (logical volume) over multiple physical disks, and very easily adding extra storage (extra disks) into your "storage pool" (volume group).
Currently, the various distro installers aren't particularly good at (or even able to) install on LVM - this is changing (the next debian release seems to be able to do this - dunno about others yet), but this is currently the only problem that I've seen with LVM.
At home I have a small / on hda1, then I put hda2 (spanning the rest of hda) into LVM. So, all other filesystems are created on LVM, and I never need to mock around with the partition table. Works nicely. This setup (LVM on top of partition tables) saved me the trouble of figuring out how to create an initrd properly, but I know others who mount / from LVM so it's indeed possible. But for an existing setup like yours, maybe it's easier to keep / on the partition table and just put the "rest" in LVM.
And it's not that hard to work with; there's an excellent HOWTO on the topic. Once you figure out "physical volume", "volume group" and "logical volume", you know enough to use it.
/ jakob
Quoted 4 lines · Remi Colinet
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
"blockdev --rereadpt /dev/whatever" does the trick on 2.4.x. Didn't try it on 2.6 yet, but I don't think it changed.
Quoted 2 lines
2/ Is it possible to delete a disk partition without having the partition numbers changed?
Yes (assuming MS-DOS style partition tables).
Erik
Signature · 2 lines
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
Quoted 7 lines · you
Hi,
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
as already stated,it can be. fdisk tries to refresh the kernel's copy of the table every time it writes, and hdparm -Z /dev/hdx does the same, but both will fail if any partitions are mounted from that disk. unmounting, then re-partitioning, then remounting lets it work... this is often useful to me when working from rescue disks but never when booted from that drive, or if /usr, /var, or /tmp are on it
Signature · 3 lines
Rob Couto [[email protected]] computer safety tip: use only a non-conducting, static-free hammer. --
Quoted 4 lines · Remi Colinet
I have 2 questions about disk partitioning under linux 2.6.x :
1/ Is it possible to alter a disk partition of a used disk and beeing able to use the modified partition without having to reboot the box?
Yes. Look at partx.
Quoted 2 lines
2/ Is it possible to delete a disk partition without having the partition numbers changed?
Yes. Look at partx.
Quoted 2 lines
Do I need to upgrade fdisk or use an other utility? Or do I need to apply a kernel patch?
You must distinguish the on-disk partition table and the kernel partition table. You can change the on-disk partition table just by writing to it, but that does not change the kernel's ideas. You can change the kernel partition table using the right ioctls but that does not change the bits on disk.
Usually one does
blockdev --rereadpt /dev/something
after changing media, or after writing to the partition table, but that will fail if the disk is busy.
Quoted 10 lines · Andries Brouwer
You must distinguish the on-disk partition table and the kernel partition table. You can change the on-disk partition table just by writing to it, but that does not change the kernel's ideas. You can change the kernel partition table using the right ioctls but that does not change the bits on disk.
Usually one does
blockdev --rereadpt /dev/somethingafter changing media, or after writing to the partition table, but that will fail if the disk is busy.
Which reminds me: Too bad the kernel says "Busy" without really thinking aboutit.
Assume that I have a
<hda1> swap 1G (*)
<hda2> root 19G (active)
<free space> disk, and want to add an extra partition. Maybe I have a 20G image which I want to copy onto 20, 40, 60, 80, 120 and 200Gb disks. I can then add the third partition as a /data or a /tmp partition. However as the active root is on that disk I have to reboot. But in fact I don't intend to change the active partition.
So, there should be objections if I want the new partitioning scheme to be:
<hda1> swap 1.5G
<hda2> root 19G (active)
<free space> then there is a problem and I can understand "Busy". But if the new scheme is:
<hda1> swap 1G
<hda2> root 19G (active)
<hda3> data 20G <unformatted>then I don't understand the reason for refusing the rereadpt request.
Anybody want to code this up?
Roger.
(*) usually active as well, but easily deactivated. So lets pretend it's inactive for this discussion.
Signature · 3 lines
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 ** *-- BitWizard writes Linux device drivers for any device you may have! --* **** "Linux is like a wigwam - no windows, no gates, apache inside!" ****
On Tue, Apr 20, 2004 at 04:36:35PM +0200, Rogier Wolff wrote:
...
Quoted 10 lines
then there is a problem and I can understand "Busy". But if the new scheme is:
<hda1> swap 1G <hda2> root 19G (active) <hda3> data 20G <unformatted>then I don't understand the reason for refusing the rereadpt request.
Anybody want to code this up?
The answer is always the same: it exists and is called partx.
Maybe you want to move part of its functionality into the kernel, but there is no good reason.
Quoted 1 line · Previously Andries Brouwer
The answer is always the same: it exists and is called partx.
Is partx ready for prime time yet? The util-linux sources do not compile or install it by default and the only comment in the HISTORY file is 'code to play with, not to use'.
Wichert.
Signature · 2 lines
Wichert Akkerman <[email protected]> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple.
Quoted 8 lines · Wichert Akkerman
Quoted 1 line · Previously Andries Brouwer
The answer is always the same: it exists and is called partx.
Is partx ready for prime time yet? The util-linux sources do not compile or install it by default and the only comment in the HISTORY file is 'code to play with, not to use'.
So partx is intended to provide a reason for not discussing putting the functionality into the kernel, rather than actually being robust enough to use? If the author doesn't think it's ready for production use, why mention it?
Signature · 3 lines
-bill davidsen ([email protected]) "The secret to procrastination is to put things off until the last possible moment - but no longer" -me
Quoted 6 lines · Wichert Akkerman
Quoted 1 line · Previously Andries Brouwer
The answer is always the same: it exists and is called partx.
Is partx ready for prime time yet? The util-linux sources do not compile or install it by default and the only comment in the HISTORY file is 'code to play with, not to use'.
It depends on what you want to do.
It really works, or at least really worked when I last tried it. There are no problems that I know of.
On Mon, Apr 26, 2004 at 11:21:25AM -0400, Bill Davidsen wrote,
Quoted 3 lines
So partx is intended to provide a reason for not discussing putting the functionality into the kernel, rather than actually being robust enough to use?
Both parts of that sentence are false.
Quoted 3 lines · Previously Andries Brouwer
It depends on what you want to do.
It really works, or at least really worked when I last tried it. There are no problems that I know of.
If it works as advertised I'm happy with it. I'm just asking you to make it a proper part of util-linux in its next release so it will actually be installed for people without having to manually compile and install it seperately from the other utilities in util-linux.
Wichert.
Signature · 2 lines
Wichert Akkerman <[email protected]> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple.