{"id":374,"date":"2011-07-05T00:31:11","date_gmt":"2011-07-04T16:31:11","guid":{"rendered":"http:\/\/my.no-ip.info\/carlos\/blog\/?p=374"},"modified":"2011-07-05T00:42:44","modified_gmt":"2011-07-04T16:42:44","slug":"shrink-ext234-parition-without-data-lost","status":"publish","type":"post","link":"https:\/\/carlos.aboutmy.info\/blog\/?p=374","title":{"rendered":"Shrink ext2\/3\/4 parition without data lost"},"content":{"rendered":"<p>\u6211\u6210\u65e5\u90fd suggest \u5982\u679c\u60f3\u5b78\u96fb\u8166\uff0c\u771f\u7684\u8981\u7528\u4e0b Linux\uff0c\u4ee5\u4e0b\u662f\u4e00\u500b\u4f8b\u5b50\uff1a<br \/>\n\u5982\u679c\u60f3 shrink \u4e00\u500b parition (e.g. \/dev\/sda2) in ext2\/3\/4 file system to 120G:<\/p>\n<p>0. \u5982\u679c shrink \u7684 parition \u662f system, \u9700\u8981\u7528 Live CD \/ USB boot \u6a5f<br \/>\n1. e2fsck -f \/dev\/sda2 (check \u4e0b disk \u5148, -f = force check even partition seems clean)<br \/>\n2. resize2fs \/dev\/sda2 119G (must slightly smaller than 120G)<br \/>\n3a. use fdisk \/dev\/sda to delete the parition 2<br \/>\n3b. use fdisk \/dev\/sda to create a new parition 2 with target size 120G (must be larger than 119G)<br \/>\n3c. suggest reboot after this<br \/>\n4. resize2fs \/dev\/sda2 (\u5514\u9700\u8981\u52a0 size, \u7528\u6652\u500b 120G, \u56e0\u4e4b\u524d resize \u6210 119G, \u4f46\u53c8\u5514\u53ef\u4ee5\u6253 120G, \u56e0\u53ef\u80fd\u662f 119.99G. If size parameter is not specified, it will default to the size of the partition)<br \/>\n5. e2fsck -f \/dev\/sda2 (\u6700\u5f8c\u518d check \u4e0b disk \u5148)<\/p>\n<p>\u8070\u660e\u7684\u4f60\uff0c\u61c9\u8a72\u77e5\u9053\u6700\u795e\u5947\u7684\u662f step 3, \u7adf\u7136\u53ef\u4ee5 delete and create a new parition \u7684\u540c\u6642\uff0c\u7121 data lost! \u5481\u53c8\u5b78\u5230\u91ce\uff0c\u5c0d parition and file system \u7684\u7406\u89e3\u53c8\u5514\u540c\u5de6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u6210\u65e5\u90fd suggest \u5982\u679c\u60f3\u5b78\u96fb\u8166\uff0c\u771f\u7684\u8981\u7528\u4e0b Linux\uff0c\u4ee5\u4e0b\u662f\u4e00\u500b\u4f8b\u5b50\uff1a \u5982\u679c\u60f3 shrink \u4e00\u500b parition (e.g. \/dev\/sda2) in ext2\/3\/4 file system to 120G: 0. \u5982\u679c shrink \u7684 parition \u662f system, \u9700\u8981\u7528 Live CD \/ USB boot \u6a5f 1. e2fsck -f \/dev\/sda2 (check \u4e0b disk \u5148, -f = force check even partition seems clean) 2. resize2fs \/dev\/sda2 119G (must slightly smaller than 120G)\u2026 <span class=\"read-more\"><a href=\"https:\/\/carlos.aboutmy.info\/blog\/?p=374\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/374"}],"collection":[{"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374"}],"version-history":[{"count":0,"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/374\/revisions"}],"wp:attachment":[{"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/carlos.aboutmy.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}