{"id":272,"date":"2010-12-10T00:43:09","date_gmt":"2010-12-10T00:43:09","guid":{"rendered":"http:\/\/dhoytt.com\/mainblog\/2010\/12\/10\/resize-switch-dynamicallyextended-logical-volume-successfully\/"},"modified":"2010-12-10T00:43:09","modified_gmt":"2010-12-10T00:43:09","slug":"resize-switch-dynamicallyextended-logical-volume-successfully","status":"publish","type":"post","link":"http:\/\/dhoytt.com\/mainblog\/2010\/12\/resize-switch-dynamicallyextended-logical-volume-successfully\/","title":{"rendered":"Resize Switch DynamicallyExtended Logical Volume Successfully"},"content":{"rendered":"<p>p { margin-bottom: 0.08in; }<\/p>\n<p style=\"margin-bottom: 0in\">I used the &#8220;-r&#8221; option to resize<br \/>\nthe underlying <a class=\"zem_slink\" href=\"http:\/\/en.wikipedia.org\/wiki\/File_system\" title=\"File system\" rel=\"wikipedia\">filesystem<\/a> with the &#8220;lvextend&#8221; command for the<br \/>\nfirst time.  The &#8220;-r&#8221; option allowed the logical volume &amp;<br \/>\nfilesystem to be extended with just one command. I saw the &#8220;-r&#8221; switch there on the man page and decided to try it!<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tTo top it off the partition I extended<br \/>\nwas my root &#8220;\/&#8221; partition. The man page says that the &#8220;-r&#8221;<br \/>\noption calls the &#8220;fsadm&#8221; command to extend or resize the<br \/>\nfilesystem.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tWhat caused me to use this option was<br \/>\nthat I just did a fresh install of one of my Fedora Linux systems<br \/>\nthat has served alternately as a game server, web server, backup<br \/>\nserver. Currently in this iteration it will take over as my new game<br \/>\nserver.   I have all of my files in two logical volumes on a separate<br \/>\nphysical drive from my OS drive so that I will not have to worry<br \/>\nabout data files I don&#8217;t wish overwritten during OS installs or I can<br \/>\njust take that drive to the next server I build and manually mount it<br \/>\non that new server.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\"> \tThe drive of course is using LVM and<br \/>\nis its own volume group so that information is on the drive is<br \/>\nimported easily into LVM. I have two logical volumes on this physical<br \/>\ndrive within the volume group..<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tOne logical volume I mount to \/home<br \/>\nand the other to \/usr\/local\/games. These logical volumes have files I<br \/>\nhave downloaded to various home directories and working files &amp;<br \/>\nbinaries for the games I host on my servers.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tI didn&#8217;t include this extra physical<br \/>\ndrive that I store my data on as a target during the fresh Fedora 14<br \/>\ninstall, so I needed to unmount the \/home that was created with the<br \/>\ninstall and then mount my logical volume that holds data for my home<br \/>\ndirectories I mount on  &#8220;\/home\/&#8221; and game data which I mount on<br \/>\n&#8220;\/usr\/local\/games\/&#8221;.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tThe reason I ended up extending my &#8220;\/&#8221;<br \/>\npartition was that I didn&#8217;t pay attention to how much space the<br \/>\ninstallation of Fedora 14 was giving &#8220;\/home&#8221; or &#8220;\/&#8221;.  I<br \/>\ndidn&#8217;t even intend for the install to make the &#8220;\/home&#8221; a separate<br \/>\npartition but oh well it did and I needed the space the install<br \/>\nallocated for &#8220;\/home&#8221; to move to  &#8220;\/&#8221;.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tI won&#8217;t speak about partition sizing<br \/>\nand the reasoning&#8217;s for that since I started getting really liberal<br \/>\nwith that with the partitions I used to be strict on since drives are<br \/>\nso large now.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tAnyway not a big deal to those of you<br \/>\nwho may have used this &#8220;-r&#8221; feature before but I never have, even<br \/>\nwith HP-UX. I truthfully don&#8217;t know if HP-UX has the &#8220;-r&#8221; switch<br \/>\nfor the lvextend command  something I&#8217;ll research and find out later<br \/>\nsince the person who was bringing by my HP-UX box hasn&#8217;t brought it<br \/>\nby yet.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tNormally you would do the &#8220;lvextend&#8221;<br \/>\nand then use the &#8220;resize2&#8221; command which doesn&#8217;t take long but<br \/>\nits always nice to use the least amount of commands.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tAnyway this is what I did:<\/p>\n<p style=\"margin-bottom: 0in\">\n<ol>\n<li>\n<p style=\"margin-bottom: 0in\">Logged in as root in &#8220;gdm&#8221;<br \/>\n(Gnome Xwindows)  after commenting out the &#8220;root&#8221; user lines in<br \/>\n\/etc\/pamd.d\/gdm &amp; etc\/pamd.d\/gdm-password. I know, not what you<br \/>\nare supposed to do but I didn&#8217;t feel like rebooting and wanted<br \/>\nmultiple windows up.<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">Killed the processes that were<br \/>\nstill running on \/home<\/p>\n<ol>\n<li>\n<p style=\"margin-bottom: 0in\">fuser -ku \/home (didn&#8217;t work)<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">lsof \/home (showed pid)<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">kill -9 &#8220;pid&#8221;<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">unmout \/home<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">vgdisplay -v|more (showed my vg<br \/>\nthat was on my physical drive)<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">vi \/etc\/ fstab<\/p>\n<ol>\n<li>\n<p style=\"margin-bottom: 0in\">\/dev\/mapper\/home_vg-lvol1 \/home<br \/>\next4    defaults        1 2\n<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">\/dev\/mapper\/home_vg-lvol2<br \/>\n\/usr\/local\/games                   ext4    defaults        1 2\n<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">mount -a<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">df -kh<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\"> lvchange -a n<br \/>\n\/dev\/vg_system-name\/lv_home<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\"> lvdisplay<br \/>\n\/dev\/vg_system-name\/lv_home<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">lvremove<br \/>\n\/dev\/vg_system-name\/lv_home<\/p>\n<\/li>\n<li>\n<p style=\"margin-bottom: 0in\">llvextend -l &lt;PE -total size&gt;<br \/>\n\/dev\/vg_system-name\/lv_root -r<\/p>\n<ol>\n<li>\n<p style=\"margin-bottom: 0in\">Since its &#8220;\/&#8221; it will not<br \/>\nunmout but perform an online filesystem extension even if you<br \/>\nanswer &#8220;no&#8217;.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tThat was it in a nutshell, took  much<br \/>\nlonger to write this post! This is just my story of a new switch I<br \/>\nfound and decided to play with if you decide to try this please if<br \/>\nyour system or data is valuable back it up and do your research for<br \/>\nyour environment!  Make sure you have the online LVM packages etc. if<br \/>\nyou want to do an online filesystem extension. As they say mileage<br \/>\nwill vary!<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tLVM is different for HP-UX  than with<br \/>\nLinux and a bit different on other UNIX systems as well so I couldn&#8217;t<br \/>\nfind the command to see if the physical extents were concurrent but I<br \/>\nsuspect they are not. Just an FYI. You know please post, I ran out of<br \/>\ntime tonight and didn&#8217;t look much further.<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\tThis isn&#8217;t meant to be a tutorial but<br \/>\nif you have any question please ask! Maybe I&#8217;ll clean this up at a<br \/>\nlater time and present it in more of a tutorial fashion with better<br \/>\nexplanations but its time for me to go to bed!<\/p>\n<p style=\"margin-bottom: 0in\">\n<\/p>\n<p style=\"margin-bottom: 0in\">\t Man  how verbose no wonder I don&#8217;t<br \/>\npost as much as I should!<\/p>\n<p style=\"margin-bottom: 0in\"><\/p>\n<p style=\"margin-bottom: 0in\">Dude I even have charts from Wikipedia:<\/p>\n<p style=\"margin-bottom: 0in\"><\/p>\n<p style=\"margin-bottom: 0in\"><\/p>\n<p style=\"margin-bottom: 0in\">\n<div class=\"zemanta-img mt-image-right zemanta-action-dragged\" style=\"margin: 1em;float: right;width: 310px\"><a href=\"http:\/\/commons.wikipedia.org\/wiki\/File:LVM1.jpg\" rel=\"lightbox[272]\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/4\/42\/LVM1.jpg\/300px-LVM1.jpg\" alt=\"Linux Logical Volume Management (LVM) v1 Diagram\" height=\"183\" width=\"300\" \/><\/a><\/p>\n<p class=\"zemanta-img-attribution\" style=\"font-size: 0.8em\">Image via <a href=\"http:\/\/commons.wikipedia.org\/wiki\/File:LVM1.jpg\" rel=\"lightbox[272]\">Wikipedia<\/a><\/p>\n<\/div>\n<div class=\"zemanta-img mt-image-right zemanta-action-dragged\" style=\"margin: 1em;float: right;width: 310px\"><a href=\"http:\/\/commons.wikipedia.org\/wiki\/File:Unix_filesystem.png\" rel=\"lightbox[272]\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/5\/5f\/Unix_filesystem.png\/300px-Unix_filesystem.png\" alt=\"Unix filesystem\" height=\"225\" width=\"300\" \/><\/a><\/p>\n<p class=\"zemanta-img-attribution\" style=\"font-size: 0.8em\">Image via <a href=\"http:\/\/commons.wikipedia.org\/wiki\/File:Unix_filesystem.png\" rel=\"lightbox[272]\">Wikipedia<\/a><\/p>\n<\/div>\n<div style=\"margin-top: 10px;height: 15px\" class=\"zemanta-pixie\"><a class=\"zemanta-pixie-a\" href=\"http:\/\/www.zemanta.com\/\" title=\"Enhanced by Zemanta\"><img data-recalc-dims=\"1\" decoding=\"async\" style=\"border: medium none;float: right\" class=\"zemanta-pixie-img\" src=\"https:\/\/i0.wp.com\/img.zemanta.com\/zemified_e.png?w=620\" alt=\"Enhanced by Zemanta\" \/><\/a><span class=\"zem-script more-related pretty-attribution\"><\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>p { margin-bottom: 0.08in; } I used the &#8220;-r&#8221; option to resize the underlying filesystem with the &#8220;lvextend&#8221; command for the first time. The &#8220;-r&#8221; option allowed the logical volume &amp; filesystem to be extended with just one command. I &hellip; <a href=\"http:\/\/dhoytt.com\/mainblog\/2010\/12\/resize-switch-dynamicallyextended-logical-volume-successfully\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7,6],"tags":[168,163,165,132,161,164,169,162,166,167],"class_list":["post-272","post","type-post","status-publish","format-standard","hentry","category-technical-non-site-related","category-whole-site-development","tag-disk-formatting","tag-file-system","tag-hp-ux","tag-linux","tag-logical-volume-management","tag-logical-volume-manager-linux","tag-lvm","tag-operating-system","tag-unix","tag-volume-group"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/posts\/272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/comments?post=272"}],"version-history":[{"count":0,"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/posts\/272\/revisions"}],"wp:attachment":[{"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/media?parent=272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/categories?post=272"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dhoytt.com\/mainblog\/wp-json\/wp\/v2\/tags?post=272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}