LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-06-2015, 11:45 AM   #1
kenw232
Member
 
Registered: May 2006
Posts: 125

Rep: Reputation: 12
Shrink Hard Disk (SCSI) in Workstation?


I have a VM that was about 120GB I wanted to migrate to a vSphere server. I had to reduce the amount to space used by the VM so it could fit so I did that - these first two screenshots show it was reduced to about 20GB on disk:
http://sites.extremehosting.ca/trash/space1.jpg
http://sites.extremehosting.ca/trash/space2.jpg

But the size of the VM's Hard Drive is still 120GB which won't fit onto my vSphere server. VMware Converter gives and error because of it:
http://sites.extremehosting.ca/trash/space4.jpg

How do I resize this 120GB Hard Drive down to about 30GB so I can get it moved to vSphere?
http://sites.extremehosting.ca/trash/space3.jpg
 
Old 06-06-2015, 02:54 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Once you create a hard drive virtual or physical it isn't easy to reduce it. Generally one takes the active partitions and reduce them. Then they copy the smaller partitions.


Some vm import or P2V apps can do this in the process.
 
Old 06-06-2015, 04:58 PM   #3
kenw232
Member
 
Registered: May 2006
Posts: 125

Original Poster
Rep: Reputation: 12
I've done the reducing in size. I've cleared the free space, shrunk the partition, compacted. Thats why its only 20GB on disk (space actually used by the guest VM). There has to be a way to just change the size of the VM from 120GB to 30GB.
 
Old 06-06-2015, 07:31 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
But you didn't copy the system to a new smaller drive first. The drive is still large. (guess I may misunderstand too)

What does disk information say the size of the drive is still? Not partition, drive.
 
Old 06-06-2015, 08:45 PM   #5
kenw232
Member
 
Registered: May 2006
Posts: 125

Original Poster
Rep: Reputation: 12
Yes, I see fdisk -l says its still a 120+GB hard drive:
http://sites.extremehosting.ca/trash/size.jpg

But gparted shows its just mostly empty & unallocated space now:
http://sites.extremehosting.ca/trash/gparted.jpg

How do I shrink /dev/sda to 30GB then?
 
Old 06-06-2015, 09:47 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Has to be done by the hypervisor, not the guest.
Quick search indicates can't be done on pre-allocated (guest) disk images. May be out-of-date info of course.
 
Old 06-17-2015, 07:06 PM   #7
DVOM
Member
 
Registered: Nov 2010
Posts: 223

Rep: Reputation: 48
This is how I've done it:

vmware shrink
 
1 members found this post helpful.
Old 06-17-2015, 11:51 PM   #8
kenw232
Member
 
Registered: May 2006
Posts: 125

Original Poster
Rep: Reputation: 12
I ended up having to add a second hard drive to the VM, copy the partition/drive from one to the other, then delete the first and fix the boot sector on the second when it doesn't boot.
 
Old 06-18-2015, 05:40 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
DVOM way may have worked.
Forgot about the tools.

The clone method would have worked but some distros would require edits based on the drive now being different. uuid or device by name
 
  


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
Now I have a scsi hard disk, two IDE hard disk, i want install linux on scsi hard dis tecpenguin Linux - Server 4 11-10-2007 06:44 AM
Adding new SCSI Hard disk Saravana Pandi Linux - Server 1 01-24-2007 04:26 PM
can not find the scsi hard disk ztdep Linux - Software 7 10-26-2006 06:18 PM
HP B2000 Workstation Hard disk cloning xgreen Other *NIX 0 06-19-2006 11:13 AM
Hard disk + IDE-SCSI palanisaravanan Linux - Hardware 4 04-21-2004 11:05 AM

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

All times are GMT -5. The time now is 05:57 PM.

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