Difference between revisions of "Resize-rootfs"

From VNUML-WIKI
Jump to: navigation, search
(uml_resize)
Line 1: Line 1:
<h1 class="firstHeading">Resizing a root-filesystem</h1>
+
<h2 class="firstHeading">Manual method</h2>
  
 
<ol>
 
<ol>
 
<li>Increasing the size of a root-filesystem:</li>
 
<li>Increasing the size of a root-filesystem:</li>
  
   > e2fsck -f root_fs_tutorial-0.31
+
   e2fsck -f root_fs_tutorial-0.31
   > dd if=/dev/zero of=root_fs_tutorial-0.31 bs=1 count=1 seek=550M conv=notrunc
+
   dd if=/dev/zero of=root_fs_tutorial-0.31 bs=1 count=1 seek=550M conv=notrunc
   > resize2fs -p root_fs_tutorial-0.31
+
   resize2fs -p root_fs_tutorial-0.31
   > e2fsck -f root_fs_tutorial-0.31
+
   e2fsck -f root_fs_tutorial-0.31
  
 
<li>Downsizing a root-filesystem:</li>
 
<li>Downsizing a root-filesystem:</li>
Line 13: Line 13:
 
<li>Create a new rootfilesystem with the size you want your filesystem to have:</li>
 
<li>Create a new rootfilesystem with the size you want your filesystem to have:</li>
 
    
 
    
   > dd if=/dev/zero of=newfs bs=1 count=1 seek=1200M conv=notrunc
+
   dd if=/dev/zero of=newfs bs=1 count=1 seek=1200M conv=notrunc
   > mkfs -t ext2 newfs    # Change the filesystem type to your needs (ext3, etc)
+
   mkfs -t ext2 newfs    # Change the filesystem type to your needs (ext3, etc)
  
 
<li>Copy the old filesystem content to the new one:</li>
 
<li>Copy the old filesystem content to the new one:</li>
  
   > mount -o loop oldfs /mnt/old/
+
   mount -o loop oldfs /mnt/old/
   > mount -o loop newfs /mnt/new
+
   mount -o loop newfs /mnt/new
   > cp -a /mnt/old/* /mnt/new/
+
   cp -a /mnt/old/* /mnt/new/
   > umount /mnt/old /mnt/new
+
   umount /mnt/old /mnt/new
  
 
</ul>
 
</ul>
 
</ol>
 
</ol>
 +
 +
<h2 class="firstHeading">Using uml_resize</h2>
 +
 +
The uml_resize that comes with the VNUML package can be also use to resize root filesystems. Look at the man page to know how it works:
 +
 +
  man uml_resize

Revision as of 14:27, 20 June 2007

Manual method

  1. Increasing the size of a root-filesystem:
  2.  e2fsck -f root_fs_tutorial-0.31
     dd if=/dev/zero of=root_fs_tutorial-0.31 bs=1 count=1 seek=550M conv=notrunc
     resize2fs -p root_fs_tutorial-0.31
     e2fsck -f root_fs_tutorial-0.31
    
  3. Downsizing a root-filesystem:
    • Create a new rootfilesystem with the size you want your filesystem to have:
    •  dd if=/dev/zero of=newfs bs=1 count=1 seek=1200M conv=notrunc
       mkfs -t ext2 newfs    # Change the filesystem type to your needs (ext3, etc)
      
    • Copy the old filesystem content to the new one:
    •  mount -o loop oldfs /mnt/old/
       mount -o loop newfs /mnt/new
       cp -a /mnt/old/* /mnt/new/
       umount /mnt/old /mnt/new
      

Using uml_resize

The uml_resize that comes with the VNUML package can be also use to resize root filesystems. Look at the man page to know how it works:

 man uml_resize