Resizing an EXT4 Partition [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I have an Ubuntu 18.04 server in a VM. The VM administrator has allocated more disk space. How do I resize a partition to use that space?
My setup is as follows:
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 5244927 4194304 2G Linux filesystem
/dev/sda3 5244928 424675327 419430400 200G Linux filesystem
/dev/sda4 424675328 529532927 104857600 50G Linux filesystem
/dev/sda5 529532928 1578108927 1048576000 500G Linux filesystem
/dev/sda6 1578108928 1745881087 167772160 80G Linux filesystem
(parted) print free space
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 1397GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 538MB 537MB fat32 boot, esp
2 538MB 2685MB 2147MB ext4
3 2685MB 217GB 215GB ext4
4 217GB 271GB 53.7GB ext4
5 271GB 808GB 537GB ext4
6 808GB 894GB 85.9GB ext4
894GB 1397GB 503GB Free Space
How can I assign that free space to the fifth partition.
Following the instructions in:
https://geekpeek.net/resize-filesystem-fdisk-resize2fs/
I deleted /dev/sda5 and then recreated it, but it remained the same size:
Similarly, following:
https://www.tecmint.com/parted-command-to-create-resize-rescue-linux-disk-partitions/
resizepart doesn't suggest that there's any available disk space to use and the partition remains the same size.
Do I need to remove /dev/sda6 to get access to the available disk space?

If you want to assign free space to partition /dev/sda5 from inside the VM you will first have to get rid of /dev/sda6 partition.
Otherwise the solution is to run GParted from a live CD while the filesystem is not mounted, because you will have to move partitions (in your case, you would have to move the /dev/sda6 partition to the end of the disk, then expand /dev/sda5 with its now adjacent free space).

Related

Expand virtual hard disks on a Linux VM with the Azure CLI

I am trying to extend a disk in my vm (azure). I used to do it like this:
sudo umount /dev/sdc1
(sdc1 as an example)
sudo parted /dev/sdc
after typing print, I should see something like this:
GNU Parted 3.2
Using /dev/sdc1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Unknown Msft Virtual Disk (scsi)
Disk /dev/sdc1: 215GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 107GB 107GB ext4
I can't go any further because in my case after typing this command I see:
GNU Parted 3.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Msft Virtual Disk (scsi)
Disk /dev/sdc: 550GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
As you can see, there are no partitions, so I can't use resizepart command.
lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"
sda 1:0:1:0 16G
└─sda1 16G /mnt
sdb 0:0:0:0 30G
├─sdb1 29.9G /
├─sdb14 4M
└─sdb15 106M /boot/efi
sdc 3:0:0:0 512G
As you can see, there are no partitions, so I can't use resizepart
command.
You Need to format the disk sdc to create partitions using either xfs or ext4 file system & to procced further resize/expand the disk partition & file system.
Cmdlets for disk format & diskpartition using XFS file system:
sudo parted /dev/sdc --script mklabel gpt mkpart xfspart xfs 0% 100%
sudo mkfs.xfs /dev/sdc1
sudo partprobe /dev/sdc1
Here we are formatting the disk using XFS file system & using the partprobeutility to make sure the kernel is aware of the new partition and filesystem.
Reference documentation to format the disk & also you can refer this blog on How to create a ext4 file system partition in Linux.
We have tested in our local environment creating a disk partition (to newly attached disk to the linux machine running with ubuntu 20.84 image) & initializing the disk partition with xfs file system.
Below is the reference image when we created a new disk & attached it to the virtual machine. When ran lsblk you see that disk is not mounted & it has no partitions.
In the above image, post running the above mentioned disk format & file partition cmdlets you can see a new partition with sdc1 got created.

Increasing the root Filesystems disk space [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
This is probably a stupid question, but I have a centos VM which I allocated a 20GB disk to. I've since realized that is way to small for my needs. In virtualbox I've increase the size of the disk by 100GB, and I've assigned that to a new physical volume in the vm. I've added that volume to the same volume group and logical group as my root file system, but I'm not seeing any change in size available to the file system.
What do I need to do to allocate more space to the file system?
[root#localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 9.5M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 18G 17G 353M 98% /
/dev/sda1 1014M 270M 745M 27% /boot
tmpfs 1.6G 32K 1.6G 1% /run/user/1000
[root#localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size 19.04 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4875
Free PE 0
Allocated PE 4875
PV UUID OyPa3x-9gvv-wn7u-H9V4-GZUr-NvXS-rUyb29
--- Physical volume ---
PV Name /dev/sda3
VG Name centos
PV Size <110.50 GiB / not usable 3.25 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 28287
Free PE 128
Allocated PE 28159
PV UUID gP1ANK-7qVz-91bX-I5e0-Jhhj-P12c-rlyQXm
[root#localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size <129.54 GiB
PE Size 4.00 MiB
Total PE 33162
Alloc PE / Size 33034 / <129.04 GiB
Free PE / Size 128 / 512.00 MiB
VG UUID w3y0SR-KCrW-njIZ-i1yU-Wx9A-c6jJ-iLSqtM
[root#localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID DNZWst-UWUa-pAw5-PJQ1-8UNl-AjfV-zsjTRv
LV Write Access read/write
LV Creation host, time localhost, 2020-09-01 16:00:13 +0100
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 513
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID Yz0o0j-B164-JNi3-y5jd-Q9oo-EFe6-ecMgaM
LV Write Access read/write
LV Creation host, time localhost, 2020-09-01 16:00:14 +0100
LV Status available
# open 1
LV Size <127.04 GiB
Current LE 32521
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
It seems you already resized the logical volume, so the last step is to resize the file system to match. Most current filesystems can be grown on-line while the system is running and the filesystem is mounted. Each has its own tool.
For example for ext* you would run resize2fs /dev/mapper/centos-root .
This needs no more arguments, by default it grows to the size of the partition/volume it's in.
The current default filesystem for centos is xfs, the command for that is xfs_growfs .
First tell the kernel about the new partitions using partprobe:
partprobe
we need to resize our filesystem on /dev/sda(your root volume).You can first start with checking the filesystem on the partition using the e2fsck command and then resize it.
e2fsck -f /dev/(your root volume)
resize2fs /dev/(your root volume)

Ubuntu wrongly shows low disk space [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I installed Ubuntu 14.0 on virtual box. Initially I had allocated 10 GB for the .vdi. I increased it to 25 GB. When I check the size in the settings in virtual box, its showing correctly as 25GB. See below:
But I am frequently getting error warnings on Ubuntu for Low Disk Space.
I checked in System Monitor > File Systems and see that its not picking up allocated disk space and showing only the old 6.2 GB. See below :
What should I do to solve this? Please help.
I encountered the same problem...
Used the following to solve the problem:
vboxmanage modifyhd "/path/to/virtualdrive.vdi" --resize <NewSize>
open the virtual machine and resize the partition (easily done using gparted). The drive was resized to 100G
Then:
# df -h /home/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root 24G 22G 1.1G 96% /
# lvextend -L +100G /dev/mapper/ubuntu--vg-root
Size of logical volume ubuntu-vg/root changed from 24.00 GiB (6145
extents) to 124.00 GiB (31745 extents).
Logical volume ubuntu-vg/root successfully resized.
# resize2fs /dev/mapper/ubuntu--vg-root
The filesystem on /dev/mapper/ubuntu--vg-root is now 32506880 (4k)
blocks long.
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 1.4M 797M 1% /run
/dev/mapper/ubuntu--vg-root 122G 22G 96G 19% /
df -h or your GUI system monitor app shows the actual FS characteristics, not the Volume size.
You should first check /dev/sda device, then ensure you can update /dev/sda1 volume size (fdisk or other software could be used for this purpose). And after that you should increase FS size using resize2fs utils.
Then you'll be able to use whole disk.
U should try "df -h" in terminal and see the big partitions and it's phat. After you use the "du -csh /phat/bing/" to see what file is so big and process it.

upgrade from Centos 6.7 to 7 without compromise the data in a LVM [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
7 Server with 4 Discs and I have this configuration:
"/" In a LVM (Physical disk 1)
"/data" In LVM (Physical disk 1 + fake raid 0 of disks 2 and 3)
"/data1" Ext4 (Physical disk 4)
The server is a supermicro (motherboard model X8DTL) with 8gb of ram.
I need to upgrade to centos 7 because the dependencies in the newer software are only in this distro but I have afraid of fuck UP With the data in "/data"
How I can upgrade safely without screw with "/data"?
PS:
I can't make a backup, the information is more than 5TB.
"/data" and "/data1" there are only standalone files (Text, spreadsheet files, multimedia files). The programs and associations are only in "/"
Edit:
Here it is how the disks are arranged:
# lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME FSTYPE SIZE MOUNTPOINT LABEL
sda linux_raid_member 931,5G GLaDOS:0
└─md0 LVM2_member 1,8T
└─vg_glados_media-lv_data (dm-3) ext4 3,6T /data
sdc linux_raid_member 931,5G GLaDOS:0
└─md0 LVM2_member 1,8T
└─vg_glados_media-lv_data (dm-3) ext4 3,6T /data
sdb 1,8T
├─sdb1 ext4 500M /boot
├─sdb2 LVM2_member 97,7G
│ ├─vg_glados-lv_root (dm-0) ext4 50G /
│ ├─vg_glados-lv_swap (dm-1) swap 7,8G [SWAP]
│ └─vg_glados-lv_home (dm-2) ext4 39,9G /home
└─sdb3 LVM2_member 1,7T
└─vg_glados_media-lv_data (dm-3) ext4 3,6T /data
sdd 931,5G
└─sdd1 ext4 931,5G /data1 /data1
sr0 1024M
# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_glados-lv_root
53G 44G 6,6G 87% /
tmpfs 4,2G 78k 4,2G 1% /dev/shm
/dev/sdb1 500M 132M 342M 28% /boot
/dev/mapper/vg_glados_media-lv_data
3,9T 3,7T 28G 100% /data
/dev/mapper/vg_glados-lv_home
42G 862M 39G 3% /home
/dev/sdd1 985G 359G 576G 39% /data1
You have two options:
1) upgrade the existing installation. You could follow this RHEL manual for for example.
2) Make a fresh install, but a) tell the anaconda that you wish to do partitioning manually and b) carefully pick the correct partitions to format and to install the OS.
The latter option is much risky than the former. Also, you will lost any history/credentials/etc and would need to configure everything again.
If you have some spare disks to make a backup of your /data partition then better do it in both cases
I think you should add a new disk to your volume group. With this new space you can create a new logical volume and there you can try new experimental installations without compromising the rest of the system.

Linux and Hadoop : Mounting a disk and increasing the cluster capacity [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
First of all, I'm a total noob at hadoop and linux.I have a cluster of five nodes , which when starts shows a each node capacity only 46.6 GB while each machine had around 500 gb space which i dont know how to allocate to these nodes.
(1) Do I have to change the datanode and namenode file size(i checked these and it shows the same space remaining as in the Datanode information tab)? if so how should i do that.
(2)Also this 500gb disk is only shown when i do $lsblk command and not when i do $df -H command. Does that mean its not mounted? These are the results of the commands. Can someone explain what does this mean..
[hadoop#hdp1 hadoop]$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 50G 0 disk
\u251c\u2500sda1 8:1 0 500M 0 part /boot
\u2514\u2500sda2 8:2 0 49.5G 0 part
\u251c\u2500VolGroup-lv_root (dm-0) 253:0 0 47.6G 0 lvm /
\u2514\u2500VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 512G 0 disk
[hadoop#hdp1 hadoop]$ sudo df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
51G 6.7G 41G 15% /
tmpfs 17G 14M 17G 1% /dev/shm
/dev/sda1 500M 163M 311M 35% /boot
Please help. Thanks in advance.
First can someone help me understand why its showing different memory disks and what it means and where does it reside ?! I seem to not able to figure it out
You are right. Your second disk (sdb) is not mounted anywhere. If you are going to dedicate the whole disk to hadoop data, here is how you should format and mount it:
Format your disk:
mkfs.ext4 -m1 -O dir_index,extent,sparse_super /dev/sdb
For mounting edit the file /etc/fstab. Add this line:
/dev/sdb /hadoop/disk0 ext4 noatime 1 2
After that, create the directory /hadoop/disk0 (it doesn't have to be named like that. you could use a directory of your choice).
mkdir -p /hadoop/disk0
Now you are ready to mount the disk:
mount -a
Finally, you should let hadoop know that you want to use this disk as hadoop storage. Your /etc/hadoop/conf/hdfs-site.xml should contain these config parameters
<property><name>dfs.name.dir</name><value>/hadoop/disk0/nn</value></property>
<property><name>dfs.data.dir</name><value>/hadoop/disk0/dn</value></property>

Resources