{"id":629,"date":"2008-03-10T09:25:30","date_gmt":"2008-03-10T14:25:30","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/hoanga\/2008\/03\/10\/rereading-a-disk-partition-table-in-li"},"modified":"2008-03-10T09:25:30","modified_gmt":"2008-03-10T14:25:30","slug":"rereading-a-disk-partition-table-in-linux-without-rebooting","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/hoanga\/2008\/03\/10\/rereading-a-disk-partition-table-in-linux-without-rebooting\/","title":{"rendered":"Rereading a disk partition table in Linux without rebooting"},"content":{"rendered":"<p>Ran into a problem with trying to partition up a disk on a running system.  The idea is I wanted to create a new partition on a disk with partitions already mounted and use it without rebooting.<\/p>\n<p>Here&#8217;s what you&#8217;ll mostly likely run into&#8230;<\/p>\n<pre>\r\n# sudo fdisk \/dev\/sda\r\n... Steps for adding disk  elided ...\r\n\r\nCommand (m for help): w\r\nThe partition table has been altered!\r\n\r\nCalling ioctl() to re-read partition table.\r\n\r\nWARNING: Re-reading the partition table failed with error 16: Device or resource busy.\r\nThe kernel still uses the old table.\r\nThe new table will be used at the next reboot.\r\nSyncing disks.\r\n\r\nahoang@jp-db-3:~$ sudo mke2fs -m 0 -j \/dev\/sda3\r\nmke2fs 1.40.2 (12-Jul-2007)\r\nCould not stat \/dev\/sda3 --- No such file or directory\r\n\r\nThe device apparently does not exist; did you specify it correctly?\r\n\r\n# ls -la \/dev\/sda*\r\n\/dev\/sda   \/dev\/sda1  \/dev\/sda2  \r\n<\/pre>\n<p>The simplest thing to do is just reboot and Linux will redetect everything on restart.  However, sometimes you just can&#8217;t reboot.  After Googling around it seems that <a href=\"http:\/\/www.cyberciti.biz\/tips\/re-read-the-partition-table-without-rebooting-linux-system.html\">partprobe does the job handily<\/a>.  Luckily this tool is already on an Ubuntu system so no need to apt-get install but it&#8217;s only a few keystrokes away.<\/p>\n<p>Here&#8217;s the rest of the log once I ran partprobe and was humming along&#8230;<\/p>\n<pre>\r\n# sudo partprobe\r\n# ls \/dev\/sda*\r\n\/dev\/sda  \/dev\/sda1  \/dev\/sda2  \/dev\/sda3\r\n# sudo mke2fs -m 0 -j \/dev\/sda3\r\nmke2fs 1.40.2 (12-Jul-2007)\r\n... Creating a file system output elided ...\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ran into a problem with trying to partition up a disk on a running system. The idea is I wanted to create a new partition on a disk with partitions already mounted and use it without rebooting. Here&#8217;s what you&#8217;ll mostly likely run into&#8230; # sudo fdisk \/dev\/sda &#8230; Steps for adding disk elided &#8230; [&hellip;]<\/p>\n","protected":false},"author":703,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1216,1100],"tags":[],"class_list":["post-629","post","type-post","status-publish","format-standard","hentry","category-fixes","category-linux"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/users\/703"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/comments?post=629"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/629\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/media?parent=629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/categories?post=629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/tags?post=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}