Greetings; Do we have a utility that can force the kernel to re-read, and re-initialize itself to a given drives partition tables without having to reboot if one is working with a drive that is not part of the required kernel directory tree? The reason I ask, is that I've just spent about 20 hours fighting with amanda after repartitioning a drive for use by amanda as virtual tapes, making /dev/sdc1 into a primary partition of nearly 400GB. /dev/sdc1 started out as a /boot2 labeled partition of 200mb, and because the kernels data was stale, amanda upchucked all over itself when the kernel thought the original 200Mb had been filled when it had been umounted from /mnt/bootf8 repartitioned, mke2fs'd, a journal added and a new label written and then mounted to /amandatapes. Something it seems to me, should have forced the re-init, but didn't. So is there a tool that can force that? Thanks -- Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Your mode of life will be changed for the better because of new developments. --
or "sfdisk -R /dev/sdX" c'ya sven -- The Internet treats censorship as a routing problem, and routes around it. (John Gilmore on http://www.cygnus.com/~gnu/) --
Hi, Yes, the blockdev utility. You want the --rereadpt option, i.e. blockdev --rereadpt /dev/sdc It is part of the util-linux package. Best regards, Anton -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer, http://www.linux-ntfs.org/ --
fdisk or similar should have issued an ioctl to reread the partition table after writing the new one, but you can do it manually with 'blockdev --rereadpt <device>'. -- ilmari "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen --
i remember bringing up this very issue quite some time ago and, IIRC, the consensus was that *primary* partition changes would be re-read by the kernel, but not *logical* partition changes. or something sort of like that. rday -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA Home page: http://crashcourse.ca Fedora Cookbook: http://crashcourse.ca/wiki/index.php/Fedora_Cookbook =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Nah, it dumps the whole partition structure. Note in fs/partition/check.c:rescan_partitions: for (p = 1; p < disk->minors; p++) delete_partition(disk, p); --
In my experience fdisk (whichever one you use) will ask the kernel to reread the partition table on write. The kernel refuses to reread the partition table on any disk where it has anything mounted. So if any part of the disk is in use then it refuses to change anything about it's view of that disk. So if you only have partitions mounted from sda and sdb then you can repartition sdc and it will reload the partition table just fine. If any part of sdc is mounted or otherwise in use then you can't. I have often wondered how hard it would be to change the kernel behaviour so that it only refuses to reload the partition table if the partitions that are in use on the disk are being changed, but let it reload the partition table if only unused partitions are being changed. For example: sdc1 200MB mounted sdc2 500MB not mounted sdc3 300MB not mounted Delete sdc2 and sdc3 and create a new sdc2 that is 800MB Since sdc1 is not changed (no change in size or start and end locations in partition table), then the kernel should let the partition table be reloaded since there is no affect on the in use partition. After all it seems the disk manager in windows is capable of this, so perhaps linux ought to be as well. It may not be relevant very often, but it sure is annoying having to go through multiple reboots when doing certain disk layout changes just because you are using and not changing one partition on a disk. -- Len Sorensen --
