Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:general_admin:resize_a_qemu_raw_image_with_an_ntfs_filesytem [2013/12/15 00:59 (UTC)]
allend created
howtos:general_admin:resize_a_qemu_raw_image_with_an_ntfs_filesytem [2013/12/15 06:18 (UTC)] (current)
allend [Use ntfsresize to resize the NTFS partition]
Line 8: Line 8:
 ===== Use qemu-img to resize the  QEMU raw disk image  ===== ===== Use qemu-img to resize the  QEMU raw disk image  =====
  
-This command increases the size of the disk image in the file Windows_XP_Professional_SP_3.img by 1GB+This command increases the size of the disk image in the file Windows_XP_Professional_SP_3.img by 1GB.
  
 <​code>​qemu-img resize Windows_XP_Professional_SP_3.img +1G</​code>​ <​code>​qemu-img resize Windows_XP_Professional_SP_3.img +1G</​code>​
  
-After this command, if you boot your virtual machine, you will see that there is an additional ​free 1GB of disk space available.+After this command, if you boot your virtual machine, you will see that there is an additional 1GB of free disk space available.
  
 ===== Find the offset into the image  ===== ===== Find the offset into the image  =====
Line 18: Line 18:
 Loop mount the image. Loop mount the image.
  
-<​code>​losetup ​ /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​+<​code>​losetup /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​
  
-Inspect the partition table (here parted is used but fdisk or cfdisk can also be used)+Inspect the partition table (here parted is used but fdisk or cfdisk can also be used).
  
 <​code>​parted /​dev/​loop0</​code>​ <​code>​parted /​dev/​loop0</​code>​
  
-Within parted set the units to sectors ​and print the current partition table+Within partedset the units to sectors, then print the current partition table.
  
 <​code>​(parted) unit s                                                            <​code>​(parted) unit s                                                           
 (parted) print </​code>​ (parted) print </​code>​
  
-The output will look something like this+The output will look something like this:
 <​code>​Model:​ Loopback device (loopback) <​code>​Model:​ Loopback device (loopback)
 Disk /dev/loop0: 12582912s Disk /dev/loop0: 12582912s
Line 40: Line 40:
 </​code>​ </​code>​
  
-Note the Sector size and Start sector numbers.+Note the Sector size and Start sector numbers ​in the output.
  
-Now quit parted+Now quit parted.
  
 <​code>​(parted) quit</​code>​ <​code>​(parted) quit</​code>​
  
-Delete the loop device+Delete the loop device.
  
 <​code>​losetup -d /​dev/​loop0</​code>​ <​code>​losetup -d /​dev/​loop0</​code>​
Line 52: Line 52:
 ===== Use ntfsresize to resize the NTFS partition ===== ===== Use ntfsresize to resize the NTFS partition =====
  
-Loop mount the NTFS partition to be extended, using an offset calculated from the sector size and start sector.+Loop mount the NTFS partition to be resized, using an offset calculated from the sector size and start sector.
  
 <​code>​losetup -o$((512*63)) /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​ <​code>​losetup -o$((512*63)) /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​
  
-First do a dry run+First do a dry run.
  
 <​code>​ ntfsresize -n -s 6G /​dev/​loop0</​code>​ <​code>​ ntfsresize -n -s 6G /​dev/​loop0</​code>​
  
-If all is OK, do it for real+If all is OK, do it for real.
  
 <​code>​ntfsresize -s 6G /​dev/​loop0</​code>​ <​code>​ntfsresize -s 6G /​dev/​loop0</​code>​
  
-Delete the loop device+Delete the loop device.
  
 <​code>​losetup -d /​dev/​loop0</​code>​ <​code>​losetup -d /​dev/​loop0</​code>​
Line 70: Line 70:
 ===== Update the partition table ===== ===== Update the partition table =====
  
-Loop mount the image+Loop mount the image.
  
 <​code>​losetup ​ /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​ <​code>​losetup ​ /dev/loop0 Windows_XP_Professional_SP_3.img</​code>​
  
-Update the partition table using parted (both fdisk and cfdisk appear to fail here)+Update the partition table using parted (both fdisk and cfdisk appear to fail here).
  
 <​code>​parted /​dev/​loop0</​code>​ <​code>​parted /​dev/​loop0</​code>​
Line 97: Line 97:
 <​code>​(parted) quit</​code>​ <​code>​(parted) quit</​code>​
  
-Delete the loop device+Delete the loop device.
  
 <​code>​losetup -d /​dev/​loop0</​code>​ <​code>​losetup -d /​dev/​loop0</​code>​
Line 103: Line 103:
 ===== Finish up ===== ===== Finish up =====
  
-Boot the virtual machine and allow the Windows chkdsk program to run+Boot the virtual machine and allow the Windows chkdsk program to run.
  
  

In Other Languages
QR Code
QR Code howtos:general_admin:resize_a_qemu_raw_image_with_an_ntfs_filesytem (generated for current page)