Sanity Check

sptnelson

New Member
Sep 2, 2015
8
0
1
I have a proxmox server that I noticed was running out of disk space. I'm fairly confident it has a second drive that I've never made use of.

root@ny-vm02:~# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb
root@ny-vm02:~# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x879f26a2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): q

root@ny-vm02:~#

Are there any other commands I should run to ensure that proxmox isn't making use of this disk in some way I wouldn't imagine? If it's not in use, it should be as simple as a pvcreate and lvextend to get more disk space in my pve lvm, correct?

Thanks
Tony
 
Thank you very much. I'm confident I can use the disk and I won't be losing anything now.

root@ny-vm02:~# cat /proc/mdstat
Personalities :
unused devices: <none>

root@ny-vm02:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 pve lvm2 a-- 465.26g 15.99g

root@ny-vm02:~# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
data pve -wi-ao--- 295.14g
root pve -wi-ao--- 96.00g
swap pve -wi-ao--- 58.12g

root@ny-vm02:~# vgs
VG #PV #LV #SN Attr VSize VFree
pve 1 3 0 wz--n- 465.26g 15.99g

And of course, here is the problem I need to solve.

root@ny-vm02:~# df -h /var/lib/vz
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pve-data 291G 289G 1.8G 100% /var/lib/vz
 
some more, just in case:

# parted -l (better than fdisk, I think)
# pvdisplay
# vgdisplay
# lvdisplay

In your case sdb does indeed seem to be unused!

Not memorized, but as much as I can remember off the top off my head, now all you need is:
pvcreate, vgextend, lvresize -r (resize FS).


I usually use "entire disk" in my LVM config (that is "/dev/sdb") rather than partitioning (/dev/sdb1) it.
Of course, this is as I want to use the entire disk anyway. :)

Cheers,
Shantanu

P.S.
I use "df -hTP" (shows more info)
 
the command to see what disks are available on your system and what they are used for is lsblk.
df will tell you what disks are mounted.

Shantanu has it right. In order to be able to use your sdb device, you'll need to add it to your logical volume. to do this, you'll need to:

# pvcreate /dev/sdb
# vgextend pve /dev/sdb
# lvextend -l100%FREE /dev/pve/data
# umount /dev/pve/data

assuming your filesystem is ext4-
# resize2fs /dev/pve/data
# mount /dev/pve/data

that should do it.
 
Hi @alexskysilk

Unmounting pve/data is not required.

* the default ext4 install should support ONLINE resize (increase only)
* shrink (or decrease) is not yet supported ONLINE for ext4
* instead of the two step extend and then resize, I always prefer it in the single command using the LVM2 command
 
I want to thank everyone for their help. I did this last night. Surprisingly, the e2fsck that I had to run took longer than I expected, but it wasn't terrible.

I failed to mention I'm still running proxmox3 on these servers, so you couldn't know my partitions are still ext3 and so had to be both unmounted and fscked. Also, I don't think this command:

# lvextend -l100%FREE /dev/pve/data

Worked they way I would have thought because I still have free space in my vg.

root@ny-vm02:~# vgdisplay
--- Volume group ---
VG Name pve
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238340
Alloc PE / Size 162784 / 635.88 GiB
Free PE / Size 75556 / 295.14 GiB
VG UUID 5Wji10-MWBH-XuJy-oGHf-CFw5-9Pr0-id9aXt

I didn't notice until I had all disk remounted, and all of the VMs running again. I can fix that if I ever need the disk space. I am set for now.

root@ny-vm02:~# df -h /var/lib/vz
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pve-data 475G 289G 186G 61% /var/lib/vz
root@ny-vm02:~#

Thanks everyone again for their help.

Tony
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!