LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-22-2016, 06:26 PM   #1
percoclap23
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Rep: Reputation: Disabled
How to enlarge system hard disk on HyperV VM ?


Hi all
I meet the following problem, don’t sucess to enlarge this fuc** space disk. I explain 
This CentOS VM is running under Azure, and I expanded correctly the system hard disk from 30GB to 550GB, OK. When I check on fdisk, I see there is correctly 550GB available
Disk /dev/sda: 549.8 GB, 549755813888 bytes
255 heads, 63 sectors/track, 66837 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c23d3


But now, how to enlarge this partition withot having the need to shutdown the VM ? I tried different tools like vlextends etc.. but without any success. So please if you could give me the command line to enlarge this system hard disk from 30 to 550GB, I would reaaaaly appreciate !!

Thanks a lot in advance
 
Old 10-23-2016, 04:19 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Hello and welcome to LQ, hope you like it here.


Quote:
Originally Posted by percoclap23 View Post
fuc**
Now you are new here, so we best be lenient, and lack of knowledge may lead to frustration but still there's no reason for that.


Quote:
Originally Posted by percoclap23 View Post
When I check on fdisk, I see there is correctly 550GB available
Disk /dev/sda: 549.8 GB, 549755813888 bytes
Your partial output doesn't include a partition table (if any) so there is no way to know, and therefore to advise, the right approach. You do seem to hint at using LVM but do understand that posting full tool output (fdisk -l /dev/sda; pvdisplay; vgdisplay; lvdisplay; dmsetup status; and such) is the best, unambiguous way to present nfo.


Quote:
Originally Posted by percoclap23 View Post
how to enlarge this partition withot having the need to shutdown the VM ? I tried different tools like vlextends etc.. but without any success.
Why not run us through the steps you took and post command used and the (error?) output those commands returned?
 
Old 10-23-2016, 05:57 AM   #3
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
I think all you need is:

# resize2fs /dev/sda1

You can research this, with a search like: resize2fs root partition

Others get 'stuck' on this, until they become aware of this concept, so don't feel bad!

The 1st in "Similar Threads" (below, bottom) eventually gets to this keyword/command in #10
also, when you first post a new Thread, under the Title, is a "Click Here to Find Similar Threads" button.

A couple more notes: you can edit your original post, to remove that ...** offensive word;
if your problem is resolved, you can use "Thread Tools" at top to mark [SOLVED];
if you find a post (reply) especially helpful, you can click on "Yes" in lower right corner.

Best wishes & welcome.

Last edited by Jjanel; 10-23-2016 at 06:05 AM.
 
Old 10-23-2016, 08:57 AM   #4
percoclap23
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hello

Yes of course I tried to run it's resizef2s in a first time :

[root@hcpvm0 ~]# sudo resize2fs /dev/sda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 7608064 blocks long. Nothing to do!


But when I do fdisk-l it says 30427078 block are available...any idea ?!


Disk /dev/sda: 549.8 GB, 549755813888 bytes
255 heads, 63 sectors/track, 66837 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c23d3

Device Boot Start End Blocks Id System
/dev/sda1 1 3788 30427078+ 83 Linux
 
Old 10-23-2016, 07:13 PM   #5
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Sorry for suggesting the 'obvious' that you had already tried.
Another idea (tho it may again be [ditto]):
Did you reboot? Try `partprobe` (or 'w' in fdisk), to make the kernel re-read the partition table.
(I think fdisk can 'see' what the kernel is *not*! [yet] 'aware' of; I've seen this before!)
p.s.
Specific detail question: did you [*ever*] use the fdisk 'w', to update ..., OR did you just do the Azure-size-increase, then [*only*] *look* at fdisk -l? (I'm only asking this detail, to understand/learn what might have happened, not to be 'picky') Thanks!

Last edited by Jjanel; 10-23-2016 at 07:19 PM. Reason: p.s. ?
 
Old 10-26-2016, 05:29 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
"to enlarge this partition withot having the need to shutdown the VM"

Guess we will have to know the format of the drive. XFS may not be supported live yet. Have to check.

See this web page too. https://codesilence.wordpress.com/20...ytem-on-linux/

https://www.nonamehosts.com/blog/how...ithout-reboot/
 
Old 10-27-2016, 04:47 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
I hope that you had the foresight to include LVM = Logical Volume Management when you constructed this Linux system, because if you did, the solution to your difficulty is very easy.

LVM allows you to associate physical volumes (disk drives) with "storage pools," and then to associate those storage pools with "mount points" (such as, say, /usr), so that this mount-point is now associated with multiple drives and the data is spread-out among them. You can add new storage without even rebooting the system. If a drive is "going flaky on you," you can migrate it out-of-service and bring in a new one ... again, without rebooting the system.
 
1 members found this post helpful.
Old 10-27-2016, 09:08 PM   #8
percoclap23
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi all, thanks for all your feedback, lets try to move forward

Quote:
Originally Posted by Jjanel View Post
Sorry for suggesting the 'obvious' that you had already tried.
Another idea (tho it may again be [ditto]):
Did you reboot? Try `partprobe` (or 'w' in fdisk), to make the kernel re-read the partition table.
(I think fdisk can 'see' what the kernel is *not*! [yet] 'aware' of; I've seen this before!)
p.s.
Specific detail question: did you [*ever*] use the fdisk 'w', to update ..., OR did you just do the Azure-size-increase, then [*only*] *look* at fdisk -l? (I'm only asking this detail, to understand/learn what might have happened, not to be 'picky') Thanks!

Yes I already tries fdisk w, and tried to reboot the system.
When I do a partprobe I got the following output :

[root@hcpvm0 ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdb (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
 
Old 10-27-2016, 09:51 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,131

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by percoclap23 View Post
[root@hcpvm0 ~]# sudo resize2fs /dev/sda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 7608064 blocks long. Nothing to do!

But when I do fdisk-l it says 30427078 block are available...any idea ?!
Different blocksize - the filesystem uses 4k whilst the fdisk display uses 1k.
Looks like you need to resize the partition to the full size of the disk, then rerun the resize2fs. The only way I know to do this automatically is to boot a gparted liveimage in the guest. Else you will have to delete the partition, reallocate it (make sure the start is the same) and then resize2fs.
 
Old 11-02-2016, 09:43 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Repeating the mantra to "use LVM, or switch to it ..." It really is a dangerous thing to "re-size a partition," IMHO. It's terribly easy to fsck things up.

Far better would be to use LVM. Now, you can simply allocate a new partition, add it to the physical pool, then assign that volume to the logical pool that represents the root-directory. Now, you can easily format the new partition and resize the filesystem to encompass the newly added space.

Linux sees the logical view, not (directly) the physical one. The space is now distributed among two (or more) partitions on one (or more) physical disks. But now, the situation is manageable.

Let's say that one of those drives "starts making ominous clicking sounds." You can use LVM to move the physical storage pool from this (failing) drive to a new one, then remove the old drive from service. And you won't have to reboot the machine to do it.

You can also use LVM to distribute traffic among multiple physical volumes and channels just for efficiency's sake. It is extremely powerful to be able to separate the logical view (as seen by application programs) from the physical reality.

I'm pretty much saying that "LVM is the 'right way to do this.'" And the good news is, "it just works.™"

Last edited by sundialsvcs; 11-02-2016 at 09:45 AM.
 
Old 11-10-2016, 08:59 PM   #11
Fionana
LQ Newbie
 
Registered: Nov 2016
Posts: 1

Rep: Reputation: 0
I have the same question as you, and wondering how to do
 
Old 11-11-2016, 07:44 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Hello Fionana, welcome to LQ.

How about you repost your question again on it's own thread? Explain what you want answered a bit more please.
 
  


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
Need to resize (enlarge) a file system. Mel96 Linux - Newbie 16 02-25-2016 10:31 AM
Enlarge /boot file system to update kernel Cambren Linux - Newbie 3 10-12-2007 03:31 PM
Reiser file system / Hard Disk/ Hard Drive Problems Oxyacetylene Linux - Software 4 10-10-2005 02:24 PM
Add new hard disk to the system. benoy4007 Red Hat 1 08-15-2004 08:39 AM
why can't I load system in hard disk? lzyking Linux - Software 4 12-18-2002 06:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:53 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