Results 1 to 7 of 7
Hello Everybody
I need to be able to refresh the paritition table (re-synch disks) without rebootting the machine.
After manually editing the MBR (master boot record) using dd or hexedit, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-16-2008 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 9
Updating partition table dynamically
Hello Everybody
I need to be able to refresh the paritition table (re-synch disks) without rebootting the machine.
After manually editing the MBR (master boot record) using dd or hexedit, I need a way to force the system to refresh the partitions table on the fly.
I figured that if I run fdisk and then and just use the 'w' (write) even if nothing was changed on fdisk, it will refresh the tables with the new settings on the MBR, but I need to implement this functionality in a script, therefore can't use that option.
- 04-16-2008 #2
- 04-16-2008 #3Just Joined!
- Join Date
- Jun 2007
- Posts
- 9
Hi I tryed partprobe it takes a long time and after that if I execute 'cat /proc/partitions' I don't get the updated table.
fdisk still does it with no problems.
partprobe -h
Usage: partprobe [OPTION] [DEVICE]...
Inform the operating system about partition table changes.
-d, --dry-run do not actually inform the operating system
-s, --summary print a summary of contents
-h, --help display this help and exit
-v, --version output version information and exit
When no DEVICE is given, probe all partitions.
- 04-17-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
- 04-17-2008 #5Just Joined!
- Join Date
- Jun 2007
- Posts
- 9
Hey THANKS, that did it ! ! !

Now, just to be a pain and not have an extra file, is there a way to send that stdin directly form the line instead of creating another file?
Ends up being that the only command I have to send is 'w' that's all, not even a 'new line' or enter, after 'write' fdisk autommatically quits.
I tryed:
fdisk /dev/sda < 'w'
and others variants too, but it didn't work.
- 04-17-2008 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Sure, you want this:
Everything until the EOF mark (end of file) is not interpreted by bash. Instead, it's used to feed fdisk. EOF closes the stream and returns the control to bash.fdisk /dev/sda << EOF
w
EOF
[rest of the script]
- 04-17-2008 #7Just Joined!
- Join Date
- Jun 2007
- Posts
- 9
Thanks a LOT !!!


Reply With Quote

