LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 12-08-2010, 10:20 PM   #1
xptchina
LQ Newbie
 
Registered: Mar 2006
Posts: 8

Rep: Reputation: 0
How to change disk size by editing disk information on the hard disk?


The question is how to change physical size of hard disk by software?

I am moving winxp to virtual .vdi disk. Correct way is to take image of the whole harddisk dd if=/dev/sda etc. Problem is that the disks are huge and I only need the first 10GB which is C: drive.

So how can I edit the disk information ( partition table? MBR? ) on the physical source hard drive so so that it looks like 10GB hard drive instead of 250GB? After editing the size information I will start windows which will most probably do chkdsk etc. After windows and whole system ( grub etc. ) thinks that the disk is 10GB I can take image of that 10GB and convert it to 10GB virtual .vdi disk.

I have tried take copy of first 10GB of the disk just ignoring the rest. I did something like
dd if=/dev/sda of=./cdrive.dd bs=1M count=10K
and then tested
mount -o loop,offset=32256 -t ntfs ./cdrive.dd ./cdisk
and I could read the files normally, so this partially works.

I have not managed to convert this cut image to a working virtual .vdi disk yet. I have been using VBoxmanage converfromraw tool which did not give errors but did not manage boot the .vdi yet.
 
Old 12-09-2010, 05:37 AM   #2
khinch
Member
 
Registered: Apr 2007
Location: Carlisle, UK
Distribution: Debian
Posts: 73

Rep: Reputation: 18
You can use the dd command to copy a single partition on the drive rather than the full drive itself. E.g. dd if=/dev/sda1 of=/*somepath*/partition1.img

Wikipedia has some helpful examples: http://en.wikipedia.org/wiki/Dd_%28Unix%29
 
1 members found this post helpful.
Old 12-16-2010, 08:12 AM   #3
xptchina
LQ Newbie
 
Registered: Mar 2006
Posts: 8

Original Poster
Rep: Reputation: 0
Whole disk need to be copied when making image for virtualbox.

"If making an image, DO NOT image just the partition, this will not work! "
http://www.virtualbox.org/wiki/Migrate_Windows

Now I am looking for tools to create MBR manually and then copying only one partition to a image file.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk Space shows more used disk thank size of files present in folder vinvar Linux - Virtualization and Cloud 2 11-02-2009 11:59 PM
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
mounting linux files from another hard disk(IDE) to current hard disk(sata) the lord protector Linux - Hardware 5 05-04-2008 11:30 AM
SATA Hard disk(Windows) MBR corrupted by IDE hard disk(Linux) Peter_APIIT Fedora 6 07-07-2007 12:20 AM
60GB laptop hard disk & 200GB external USB hard disk linux compatibility powah Linux - Hardware 0 03-07-2006 10:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration