Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
2 answers
1882 views
Unable to extend LV file system in Ubuntu Server
I run a bare metal Ubuntu server with several VMs running in a KVM environment. I want to increase the size of one VM from 50GB to 100GB. [![nextcloudph-lv][1]][1] I ran the following command to increase the nextcloudph-lv VM from 50GB to 100GB: ```sudo lvextend -L+50G /dev/ubuntu-vg/nextcloudph-lv`...
I run a bare metal Ubuntu server with several VMs running in a KVM environment. I want to increase the size of one VM from 50GB to 100GB. nextcloudph-lv I ran the following command to increase the nextcloudph-lv VM from 50GB to 100GB:
lvextend -L+50G /dev/ubuntu-vg/nextcloudph-lv
The VM size increased as expected. nextcloudph after increase I then attempted to extend the LV file system using the following command:
resize2fs  /dev/ubuntu-vg/nextcloudph-lv
The output I received is: Bad magic number error message Running the lsblk command results in: lsblk And /dev/mapper contains: dev mapper list This looks like a relatively simple process so I'm not sure where I've gone wrong. This is the first time I'm trying to extend an LV and I'm stuck... Thanks in advance! EDIT: As suggested by A. Darwin, I ran the command "df -hT" which produced the following output: df -hT I can see the host VM "ubuntu--lv" with an ext4 file system but there is no reference to "nextcloudph--lv" or sda3 where all the VMs are located. I'm not sure if it makes a difference but when I set up the VMs I first allocated the space using the "lvcreate -L ##G -n lv###### ubuntu-vg" command and then pointed Virtual Machine Manager to that storage pool when building the VM. EDIT 2 Running "df hT" from within the nextcloudph-lv VM produces the following output: nextcloudph df -hT It's strange because there is a reference to a 48GB ext4 drive but it's located at "/dev/mapper/ubuntu--vg-ubuntu--lv". EDIT 3 As requested by Vojtech Trefny, attached is the output from the command "lsblk -f" lsblk -f For clarity, the 84% used refers only to the ubuntu--lv VM. There is still plenty of room left on the SSDs.
kvmhali (29 rep)
Jul 28, 2021, 06:18 PM • Last activity: Aug 5, 2025, 06:03 AM
57 votes
6 answers
183960 views
Can't resize a partition using resize2fs
I recently resized the hard drive of a VM from 150 GB to 500 GB in VMWare ESXi. After doing this, I used Gparted to effectively resize the partition of this image. Now all I have to do is to resize the file system, since it still shows the old value (as you can see from the output of `df -h`): Files...
I recently resized the hard drive of a VM from 150 GB to 500 GB in VMWare ESXi. After doing this, I used Gparted to effectively resize the partition of this image. Now all I have to do is to resize the file system, since it still shows the old value (as you can see from the output of df -h): Filesystem Size Used Avail Use% Mounted on /dev/mapper/owncloud--vg-root 157G 37G 112G 25% / udev 488M 4.0K 488M 1% /dev tmpfs 100M 240K 100M 1% /run none 5.0M 0 5.0M 0% /run/lock none 497M 0 497M 0% /run/shm /dev/sda1 236M 32M 192M 14% /boot However, running sudo resize2fs /dev/mapper/owncloud--vg-root returns this: resize2fs 1.42 (29-Nov-2011) The filesystem is already 41608192 blocks long. Nothing to do! Since Gparted says that my partition is /dev/sda5, I also tried running sudo resize2fs /dev/sda5, but in this case I got this: resize2fs 1.42 (29-Nov-2011) resize2fs: Device or resource busy while trying to open /dev/sda5 Couldn't find valid filesystem superblock. Finally, this is the output of pvs: PV VG Fmt Attr PSize PFree /dev/sda5 owncloud-vg lvm2 a- 499.76g 340.04g fdisk -l /dev/sda shows the correct amount of space. How can I resize the partition so that I can finally make the OS see 500 GB of hard drive?
user1301428 (1107 rep)
Jun 19, 2014, 06:00 PM • Last activity: Jun 9, 2025, 11:49 AM
1 votes
2 answers
2320 views
GParted doesn't recognize my newly resized vdi
Before I describe the problem, I'd like to specify that I'm not confused about the size of the partitions (they haven't been extended yet, so of course they haven't grown) but the size of the actual device GParted sees. I had a `vdi` file with ArchLinux installed. The size was 8GB. I extended this t...
Before I describe the problem, I'd like to specify that I'm not confused about the size of the partitions (they haven't been extended yet, so of course they haven't grown) but the size of the actual device GParted sees. I had a vdi file with ArchLinux installed. The size was 8GB. I extended this to 20GB, which I can confirm in the VirtualBox GUI on my host. However, after having loaded the GParted live cd into the VM and booting into it, it says that /dev/sda is an 8GB device. It won't let me resize anything because it doesn't think the drive actually got any bigger. Is there something else I should be doing?
nopcorn (9379 rep)
Dec 16, 2014, 10:40 PM • Last activity: Dec 24, 2024, 12:58 AM
1 votes
1 answers
382 views
Resize2fs shrink operation leaves free space in filesystem?
I'm trying to shrink a filesystem image down to the smallest possible size. I'm okay with resize2fs leaving reserved filesystem blocks in place, but it's leaving about 400Mb of free space in the filesystem after the shrink operation. These are the steps I'm performing: ``` aj@pop-os:~/disk_images$ s...
I'm trying to shrink a filesystem image down to the smallest possible size. I'm okay with resize2fs leaving reserved filesystem blocks in place, but it's leaving about 400Mb of free space in the filesystem after the shrink operation. These are the steps I'm performing:
aj@pop-os:~/disk_images$ sudo losetup -fP --show mcard.img 
/dev/loop0

aj@pop-os:~/disk_images$ sudo zerofree -v /dev/loop0p1
112082/2671282/3665210

aj@pop-os:~/disk_images$ sudo e2fsck -f /dev/loop0p1
e2fsck 1.46.5 (30-Dec-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop0p1: 191007/917504 files (0.3% non-contiguous), 993928/3665210 blocks

aj@pop-os:~/disk_images$ sudo resize2fs -Mp /dev/loop0p1
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/loop0p1 to 1115084 (4k) blocks.
Begin pass 2 (max = 3444)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 112)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop0p1 is now 1115084 (4k) blocks long.
Everything seems to work fine and it does shrink the filesystem down from 16Gb to 4.1Gb. However, it does leave free space on the filesystem:
aj@pop-os:~/disk_images$ sudo mount /dev/loop0p1 xmnt/
aj@pop-os:~/disk_images$ df -h xmnt/
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0p1    4.1G  3.5G  434M  90% /home/aj/disk_images/xmnt

aj@pop-os:~/disk_images$ sudo umount xmnt/
aj@pop-os:~/disk_images$ sudo dumpe2fs -h /dev/loop0p1
(Output shortened for readability)
Block count:              1115084
Reserved block count:     47712
Free blocks:              162785
Block size:               4096
As you can see, after shrinking the filesystem, both the df utility and dumpe2fs show free space remaining in the filesystem image. Why is this and how can I get resize2fs to actually reduce the filesystem size such that there is no free space aside from the reserved blocks?
Gogeta70 (534 rep)
Jan 30, 2023, 04:59 PM • Last activity: Oct 9, 2024, 09:55 PM
0 votes
1 answers
27 views
VM Centos7 Inside Proxmox Can't resize storage
i have a Centos7 VM with 100% capacity used for storage `dev/mapper/sinta--vg-root` [![df -h][1]][1] in `cfdisk`, i have free storage about 120GB, i want to make the `dev/mapper/sinta--vg-root` more bigger, but first i want to resize the `dev/sda5` into max size available, but it's error [![sudo cfd...
i have a Centos7 VM with 100% capacity used for storage dev/mapper/sinta--vg-root df -h in cfdisk, i have free storage about 120GB, i want to make the dev/mapper/sinta--vg-root more bigger, but first i want to resize the dev/sda5 into max size available, but it's error sudo cfdisk How to solve this?
Tuhan Kamu (1 rep)
Sep 18, 2024, 03:48 AM • Last activity: Sep 18, 2024, 03:54 AM
0 votes
1 answers
31 views
Unable to extend fedora Server VirtualBox Volume (lvm2)
I Im trying to resize my root volume. I already resized the virtual volume inside virtualbox and also reallocated the space with gparted: [![gparted][1]][1] But undortunately after using lvextend and resize2fs there is an error stating: `couldn't find valid filesystem superblock` [![commandline erro...
I Im trying to resize my root volume. I already resized the virtual volume inside virtualbox and also reallocated the space with gparted: gparted But undortunately after using lvextend and resize2fs there is an error stating: couldn't find valid filesystem superblock commandline error
shyney (113 rep)
Sep 3, 2024, 10:46 AM • Last activity: Sep 3, 2024, 11:02 AM
0 votes
2 answers
2162 views
Can I expand my /var partition?
I just installed Ubuntu 24.04, and I made a mistake: I put the `/var` directory on its own partition, and its size is 10 GB. After a few days it is already full. Is there a way to fix this problem without reinstalling the OS from scratch? Is it possible to resize a partition, even loosing its conten...
I just installed Ubuntu 24.04, and I made a mistake: I put the /var directory on its own partition, and its size is 10 GB. After a few days it is already full. Is there a way to fix this problem without reinstalling the OS from scratch? Is it possible to resize a partition, even loosing its contents? What is a suggested size for the /var directory? This is my partition table: Model: WD_BLACK SN850X 2000GB (nvme) Disk /dev/nvme0n1: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 8 1049kB 1075MB 1074MB fat32 boot boot, esp 1 1075MB 323GB 322GB xfs / 2 323GB 426GB 103GB linux-swap(v1) swap swap 3 426GB 437GB 10.7GB ext4 var 4 437GB 439GB 2147MB ext4 temp 6 439GB 547GB 107GB xfs 3rdp 5 547GB 1406GB 859GB ext4 home 7 1406GB 1427GB 21.5GB ext4 crypt This is the contents of my /var directory: ~> sudo bash -c 'shopt -s dotglob; du -hxs /var/*' 7.0M /var/backups 661M /var/cache 4.0K /var/crash 8.9G /var/lib 4.0K /var/local 0 /var/lock 49M /var/log 16K /var/lost+found 4.0K /var/mail 4.0K /var/metrics 4.0K /var/opt 0 /var/run 13M /var/snap 52K /var/spool 108K /var/tmp 4.0K /var/.updated Here are more details about my partitions: ~> df -h Filesystem Size Used Avail Use% Mounted on tmpfs 5.9G 2.7M 5.9G 1% /run /dev/nvme0n1p1 300G 29G 272G 10% / tmpfs 30G 180M 30G 1% /dev/shm tmpfs 5.0M 12K 5.0M 1% /run/lock efivarfs 148K 62K 81K 44% /sys/firmware/efi/efivars /dev/nvme0n1p6 100G 2.5G 98G 3% /opt /dev/nvme0n1p7 20G 24K 19G 1% /crypt /dev/nvme0n1p4 2.0G 103M 1.7G 6% /tmp /dev/nvme0n1p3 9.8G 9.6G 0 100% /var /dev/nvme0n1p5 787G 13G 734G 2% /home /dev/nvme0n1p8 1022M 41M 982M 4% /boot/efi tmpfs 5.9G 196K 5.9G 1% /run/user/1000
Pietro (663 rep)
Jun 14, 2024, 09:47 PM • Last activity: Jun 16, 2024, 12:45 PM
8 votes
1 answers
31647 views
Resize root lvm partition
I have a dedicated server with 2 TB storage. My problem is that the whole storage is allotted to the root partition. Whenever I try to resize it using `lvresize`, the root partition gets corrupted and then I have to reprovision the server. Is there any option to resize the root partition without unm...
I have a dedicated server with 2 TB storage. My problem is that the whole storage is allotted to the root partition. Whenever I try to resize it using lvresize, the root partition gets corrupted and then I have to reprovision the server. Is there any option to resize the root partition without unmounting in lvm? I am trying to reduce the root partition to 100GB. Vgs root@s93079:/home/customer# vgs VG #PV #LV #SN Attr VSize VFree s93079-vg 1 2 0 wz--n- 1.82t 0 Lvs LV VG Attr LSize Pool Origin Data% Meta % Move Log Cpy%Sync Convert root s93079-vg -wi-ao---- 1.79t swap_1 s93079-vg -wi-ao---- 32.00g Fdisk - l Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 499711 497664 243M 83 Linux /dev/sda2 501758 3907028991 3906527234 1.8T 5 Extend /dev/sda5 501760 3907028991 3906527232 1.8T 8e Linux Disk /dev/mapper/s93079--vg-root: 1.8 TiB, 1965782204416 byt es, 3839418368 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/s93079--vg-swap_1: 32 GiB, 34355544064 byte s, 67100672 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Vgdisplay --- Volume group --- VG Name s93079-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 1.82 TiB PE Size 4.00 MiB Total PE 476870 Alloc PE / Size 476870 / 1.82 TiB Free PE / Size 0 / 0 VG UUID dPrEwA-77pM-pGai-9jZB-ldMZ-iL20-HAe9 Dj lvdisplay /dev/s93079-vg/root --- Logical volume --- LV Path /dev/s93079-vg/root LV Name root VG Name s93079-vg LV UUID bpGNau-XirV-P7PA-8d6k-OCOy-TAwN-HXl FVI LV Write Access read/write LV Creation host, time s93079, 2016-08-27 09:22:05 -0500 LV Status available # open 1 LV Size 1.79 TiB Current LE 468679 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:0 Lvdisplay /dev/s93079-vg/swap_1 --- Logical volume --- LV Path /dev/s93079-vg/swap_1 LV Name swap_1 VG Name s93079-vg LV UUID j74PLZ-E9gK-9Bbb-EkKq-xRJv-TuU4-FgH gm LV Write Access read/write LV Creation host, time s93079, 2016-08-27 09:22:05 -0500 LV Status available # open 2 LV Size 32.00 GiB Current LE 8191 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:1 Df - h /dev/dm-0 1.8T 923M 1.7T 1% / udev 10M 0 10M 0% /dev tmpfs 3.2G 8.5M 3.2G 1% /run tmpfs 7.9G 0 7.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup /dev/sda1 236M 33M 191M 15% /boot
Pranav (103 rep)
Aug 28, 2016, 02:49 AM • Last activity: Feb 25, 2024, 08:39 AM
6 votes
3 answers
1531 views
filesystem on disk without partition
One may help me with this, because its confusing me: I have a 1.8T Disk (it's a VM virtual disk), here a snippet of df: ``` df -TH Filesystem Type Size Used Avail Use% Mounted on /dev/sdb ext4 1.8T 1.6T 91G 95% /af ``` Here the partition info: ``` parted /dev/sdb print Model: VMware Virtual disk (sc...
One may help me with this, because its confusing me: I have a 1.8T Disk (it's a VM virtual disk), here a snippet of df:
df -TH
Filesystem                          Type      Size  Used Avail Use% Mounted on
/dev/sdb                            ext4      1.8T  1.6T   91G  95% /af
Here the partition info:
parted /dev/sdb print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 1924GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  1924GB  1924GB  ext4
So I assume filesystem was setup w/o creating partition first. Now an expand is necessary and this will exceed the 2TB limit. I am just unsure whether this will work w/o trouble? For my undestanding it should be ok to increase the size of the virtual disk and the expand should be done with simply expand the filesystem:
-f /dev/sdb
, so am I correct with this?
MMAX (256 rep)
Feb 16, 2024, 02:49 PM • Last activity: Feb 17, 2024, 09:09 AM
0 votes
1 answers
2316 views
Partition mounting/resizing failed to read last sector?
After a failed resizing operation, mount operation is failing with: Failed to read last sector (718198764): Invalid argument The partition is not accessible with Gparted and other GUI tools. How can we fix such issue?
After a failed resizing operation, mount operation is failing with: Failed to read last sector (718198764): Invalid argument The partition is not accessible with Gparted and other GUI tools. How can we fix such issue?
intika (15066 rep)
Jul 6, 2020, 01:37 AM • Last activity: Jan 3, 2024, 03:31 AM
14 votes
1 answers
7378 views
How to stop jbd2 on unmounted filesystem
I need to `resize2fs` the root partition of an embedded device. Since it doesn't have an alternate boot option, I used an `tmpfs`, moved and restated everything until I finally was able to `umount /dev/mmcblk0p1`. But bad luck: $ umount /dev/mmcblk0p1 umount: /dev/mmcblk0p1: not mounted $ resize2fs...
I need to resize2fs the root partition of an embedded device. Since it doesn't have an alternate boot option, I used an tmpfs, moved and restated everything until I finally was able to umount /dev/mmcblk0p1. But bad luck: $ umount /dev/mmcblk0p1 umount: /dev/mmcblk0p1: not mounted $ resize2fs /dev/mmcblk0p1 resize2fs 1.42.12 (29-Aug-2014) resize2fs: Device or resource busy while trying to open /dev/mmcblk0p1 Couldn't find valid filesystem superblock. $ fsck /dev/mmcblk0p1 fsck from util-linux 2.25.2 e2fsck 1.42.12 (29-Aug-2014) /dev/mmcblk0p1 is in use. e2fsck: Cannot continue, aborting. Strange! A busy unmounted file system. It seems to me, that the journal still has it's hands on the device: root 112 0.0 0.0 0 0 ? S 14:13 0:00 [jbd2/mmcblk0p1-] Turn journaling off, you say? Here comes the hen-and-egg-game: $ tune2fs -O ^has_journal /dev/mmcblk0p1 tune2fs 1.42.12 (29-Aug-2014) The needs_recovery flag is set. Please run e2fsck before clearing the has_journal flag. So how to stop that? It's still running in rescue mode, can't be kill -9ed. How to get rid of it? (I'm on Debian Jessie)
Philippos (13680 rep)
Apr 11, 2018, 01:47 PM • Last activity: Dec 13, 2023, 08:03 AM
0 votes
0 answers
50 views
Understanding the impact of using resize2fs
I want to use `resize2fs` to resize partition on my system, will doing so delete any files that is present on the partition or will it use the free space available on the partition to resize the same?
I want to use resize2fs to resize partition on my system, will doing so delete any files that is present on the partition or will it use the free space available on the partition to resize the same?
ROSHAN RAJAGOPAL (1 rep)
Nov 28, 2023, 10:48 AM • Last activity: Nov 28, 2023, 11:04 AM
0 votes
2 answers
606 views
The filesystem is already 65010688 (4k) blocks long
Please help me , when I try to increase the partition size in LVM, but when I try it doesn’t work, I do the following: df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 0 3.9G 0% /dev tmpfs 795M 1.3M 794M 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv 244G 113G 121G 49% / sudo lvextend --resizef...
Please help me , when I try to increase the partition size in LVM, but when I try it doesn’t work, I do the following: df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 0 3.9G 0% /dev tmpfs 795M 1.3M 794M 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv 244G 113G 121G 49% / sudo lvextend --resizefs -l +100%FREE ubuntu-vg/ubuntu-lv Size of logical volume ubuntu-vg/ubuntu-lv unchanged from <248.00 GiB (63487 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. resize2fs 1.45.5 (07-Jan-2020) The filesystem is already 65010688 (4k) blocks long. Nothing to do! df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv 244G 113G 121G 49% / sudo vgs VG #PV #LV #SN Attr VSize VFree ubuntu-vg 1 1 0 wz--n- <248.00g 0 lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 63.5M 1 loop /snap/core20/1974 loop1 7:1 0 63.5M 1 loop /snap/core20/2015 loop2 7:2 0 91.9M 1 loop /snap/lxd/24061 loop3 7:3 0 40.9M 1 loop /snap/snapd/20290 loop4 7:4 0 40.9M 1 loop /snap/snapd/20092 sda 8:0 0 250G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 248G 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 248G 0 lvm / sr0 11:0 1 1024M 0 rom sudo vgdisplay --- Volume group --- VG Name ubuntu-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size <248.00 GiB PE Size 4.00 MiB Total PE 63487 Alloc PE / Size 63487 / <248.00 GiB Free PE / Size 0 / 0 VG UUID Vl06pF-MGCJ-WFC9-Vz45-UCuf-EsEI-9IFP8R Afterwards everything remains the same. I don't understand what I'm doing wrong. More precisely, I do not have a complete understanding.
Глеб Щеголев (11 rep)
Nov 8, 2023, 07:52 AM • Last activity: Nov 8, 2023, 09:09 AM
5 votes
1 answers
11750 views
Ubuntu ext4 partition is not being extended or resized as expected with growpart or resize2fs
I've previously used `growpart` and `resize2fs` to resize a mounted online ext4 paritition in a Linux system. Currently I have a Ubuntu guest running in virtualbox that I'd like to resize the partition `/dev/sda5`. I've already extended the virtual disk on the host via `vboxmanage modifyhd --resize....
I've previously used growpart and resize2fs to resize a mounted online ext4 paritition in a Linux system. Currently I have a Ubuntu guest running in virtualbox that I'd like to resize the partition /dev/sda5. I've already extended the virtual disk on the host via vboxmanage modifyhd --resize..., however after running (within the guest) growpart I don't see any change in the partition table (I assume it's the value returned from lsblk).
chris@chris-VirtualBox:~$ lsblk
...
sda      8:0    0  53.9G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  37.8G  0 part /
...
Resize:
chris@chris-VirtualBox:~$ sudo growpart /dev/sda 5
CHANGED: partition=5 start=1052672 old: size=79251456 end=80304128 new: size=111996895 end=113049567
chris@chris-VirtualBox:~$ sudo resize2fs /dev/sda5
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 9906432 (4k) blocks long.  Nothing to do!
lsblk still shows old values:
...
sda      8:0    0  53.9G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  37.8G  0 part /
...
Is this a limitation of virtualbox? Or is there a working alternative? --- Hmmm actually the /dev/sda2 partition looks quite suspicious (it's size seems too large? is it overlapping with /dev/sda5?: chris@chris-VirtualBox:~$ sudo parted /dev/sda GNU Parted 3.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p Model: ATA VBOX HARDDISK (scsi) Disk /dev/sda: 57.9GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 538MB 537MB primary fat32 boot 2 539MB 41.1GB 40.6GB extended 5 539MB 41.1GB 40.6GB logical ext4
Chris Stryczynski (6603 rep)
Jan 22, 2022, 06:57 PM • Last activity: Jun 11, 2023, 05:24 PM
0 votes
1 answers
5004 views
Adjust a disk space available for a directory in Linux
I need to adjust the disk space given for an ordinary directory such as /opt directory. I'd found that the /opt directory allocates the space **4.0G**, by using the below command: ``` sudo du -sh /opt ``` I need to increase the disk space given for /opt directory up to **5.0G**. I saw that `lvm` or...
I need to adjust the disk space given for an ordinary directory such as /opt directory. I'd found that the /opt directory allocates the space **4.0G**, by using the below command:
sudo du -sh /opt
I need to increase the disk space given for /opt directory up to **5.0G**. I saw that lvm or resizef2s could be used for the files system. Could be there an easier way to solve the issue I had? Note: My Linux instance is installed on Vbox with a 40.0G disk space. Please don't vote my question down because I am stuck in this issue for three days and I can't find a solution. Any comment might help.
Nasser_Omar (11 rep)
Sep 4, 2021, 10:48 AM • Last activity: Jun 7, 2023, 11:04 AM
1 votes
1 answers
1163 views
resize partition overlapping parted
**parted -s -a opt /dev/sda "print free"** Mod&#232;le: VMware Virtual disk (scsi) Disque /dev/sda : 268GB Taille des secteurs (logiques/physiques): 512B/512B Table de partitions : gpt Disk Flags: Num&#233;ro D&#233;but Fin Taille Syst&#232;me de fichiers Nom Fanions 17,4kB 1049kB 1031kB Espace libr...
**parted -s -a opt /dev/sda "print free"** Modèle: VMware Virtual disk (scsi) Disque /dev/sda : 268GB Taille des secteurs (logiques/physiques): 512B/512B Table de partitions : gpt Disk Flags: Numéro Début Fin Taille Système de fichiers Nom Fanions 17,4kB 1049kB 1031kB Espace libre 1 1049kB 538MB 537MB fat32 EFI System Partition démarrage, esp 2 538MB 1075MB 537MB ext4 3 1075MB 20,4GB 19,3GB lvm (gestionnaire de volumes logiques) 20,4GB 20,4GB 16,9kB Espace libre 4 20,4GB 106GB 85,9GB lvm (gestionnaire de volumes logiques) 5 106GB 133GB 26,8GB lvm (gestionnaire de volumes logiques) 6 133GB 140GB 6442MB lvm (gestionnaire de volumes logiques) 7 140GB 162GB 22,4GB lvm (gestionnaire de volumes logiques) 162GB 268GB 106GB Espace libre I just don't understand why i got this line : 20,4GB 20,4GB 16,9kB Espace libre (free space) **parted -s -a opt /dev/sda "resizepart 3 100%"** Erreur: Impossible d'avoir des partitions qui se chevauchent. This means : *Unable to have overlapping partitions* Any idea on what can i do to finaly have a success on my resizepart ?
Peutre (87 rep)
May 26, 2023, 12:41 PM • Last activity: May 29, 2023, 08:07 AM
0 votes
1 answers
496 views
Moving Pop-OS installation to a smaller drive (using GParted?)
I need to move a Pop-OS installation from a 250GB HDD to a 128GB SSD. So far I have been trying to use GParted (which worked for moving my Ubuntu installation between drives of the same size). The recovery and boot partitions copied properly, but to copy the main (root) partition I need to shrink it...
I need to move a Pop-OS installation from a 250GB HDD to a 128GB SSD. So far I have been trying to use GParted (which worked for moving my Ubuntu installation between drives of the same size). The recovery and boot partitions copied properly, but to copy the main (root) partition I need to shrink it first (there is enough space). Using GParted to try and shrink it seems to do something for a while, but then errors at the same point (judging by the progress bar) each time. (The title is not related to this problem to try and avoid A/B problem). I have tried running the e2fsck command written in the GParted details file, and rebooting the machine. None of these have made the shrink work. Without the partition shrink, I don't know how I can move the installation to the smaller drive. Below is the gparted_details.htm contents generated by the error. Any and all ideas on how I can move the OS are appreciated.
GParted 1.3.1

configuration --enable-libparted-dmraid --enable-online-resize

libparted 3.4

========================================
Device:	/dev/nvme0n1
Model:	CT1000P5PSSD8
Serial:	
Sector size:	512
Total sectors:	1953525168
 
Heads:	255
Sectors/track:	2
Cylinders:	3830441
 
Partition table:	gpt
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/nvme0n1p1	Primary	34	32767	msftres	Microsoft reserved partition	unknown		
/dev/nvme0n1p2	Primary	32768	819232767	msftdata	Basic data partition	ntfs	New Volume	

========================================
Device:	/dev/nvme1n1
Model:	RPFTJ128PDD2EWX
Serial:	
Sector size:	512
Total sectors:	250069680
 
Heads:	255
Sectors/track:	2
Cylinders:	490332
 
Partition table:	gpt
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/nvme1n1p1	Primary	2048	250068991			ext4		/

========================================
Device:	/dev/sda
Model:	ATA CT250MX500SSD1
Serial:	2013E298798B
Sector size:	512
Total sectors:	488397168
 
Heads:	255
Sectors/track:	2
Cylinders:	957641
 
Partition table:	gpt
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/sda1	Primary	2048	1050623	boot, esp	EFI System Partition	fat32		/boot/efi
/dev/sda2	Primary	1050624	1083391	msftres	Microsoft reserved partition	ext4		
/dev/sda3	Primary	1083392	487322748	msftdata	Basic data partition	ntfs		
/dev/sda4	Primary	487323648	488394751	hidden, diag		ntfs		

========================================
Device:	/dev/sdb
Model:	ATA ST31000528AS
Serial:	5VP2CLXV
Sector size:	512
Total sectors:	1953525168
 
Heads:	255
Sectors/track:	2
Cylinders:	3830441
 
Partition table:	msdos
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/sdb1	Primary	63	1953520127	boot		ntfs	ExtDisk	

========================================
Device:	/dev/sdc
Model:	ATA ST500DM002-1BD14
Serial:	Z2AXE6DG
Sector size:	512
Total sectors:	976773168
 
Heads:	255
Sectors/track:	2
Cylinders:	1915241
 
Partition table:	msdos
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/sdc1	Primary	2048	976769023			ntfs	stuff	

========================================
Device:	/dev/sdd
Model:	ATA WDC WD2500BEVT-7
Serial:	WD-WXR1A60R1236
Sector size:	512
Total sectors:	488397168
 
Heads:	255
Sectors/track:	2
Cylinders:	957641
 
Partition table:	gpt
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/sdd1	Primary	4096	2097150	boot, esp		fat32		
/dev/sdd2	Primary	2097152	10485758	msftdata	recovery	fat32		
/dev/sdd3	Primary	10485760	480004462			ext4		
/dev/sdd4	Primary	480004464	488393070	swap		linux-swap		

========================================
Device:	/dev/sde
Model:	USB DISK
Serial:	
Sector size:	512
Total sectors:	15730688
 
Heads:	255
Sectors/track:	2
Cylinders:	30844
 
Partition table:	msdos
 
Partition	Type	Start	End	Flags	Partition Name	Filesystem	Label	Mount Point
/dev/sde1	Primary	8192	15728639			ntfs	NTFS	/media/yee/NTFS
/dev/sde2	Primary	15728640	15730687	lba		fat16	UEFI_NTFS	/media/yee/UEFI_NTFS

========================================
Shrink /dev/sdd3 from 223.88 GiB to 107.42 GiB  00:11:10    ( ERROR )
     	
calibrate /dev/sdd3  00:00:02    ( SUCCESS )
     	
path: /dev/sdd3 (partition)
start: 10485760
end: 480004462
size: 469518703 (223.88 GiB)
check filesystem on /dev/sdd3 for errors and (if possible) fix them  00:00:15    ( SUCCESS )
     	
e2fsck -f -y -v -C 0 '/dev/sdd3'  00:00:15    ( SUCCESS )
     	
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

527061 inodes used (3.59%, out of 14680064)
962 non-contiguous files (0.2%)
411 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 502974/140
24348903 blocks used (41.49%, out of 58689837)
0 bad blocks
15 large files

454992 regular files
45072 directories
15 character device files
1 block device file
7 fifos
4994 links
26959 symbolic links (23910 fast symbolic links)
6 sockets
------------
532046 files
e2fsck 1.46.5 (30-Dec-2021)
shrink filesystem  00:10:53    ( ERROR )
     	
resize2fs -p '/dev/sdd3' 112640000K  00:10:53    ( ERROR )
     	
Resizing the filesystem on /dev/sdd3 to 28160000 (4k) blocks.
Begin pass 2 (max = 10272100)
Relocating blocks XXXXXXXX--------------------------------
resize2fs 1.46.5 (30-Dec-2021)
resize2fs: Attempt to read block from filesystem resulted in short read while trying to resize /dev/sdd3
Please run 'e2fsck -fy /dev/sdd3' to fix the filesystem
after the aborted resize operation.
Liftyee (3 rep)
May 14, 2023, 06:34 PM • Last activity: May 14, 2023, 07:07 PM
0 votes
1 answers
11696 views
Change the size of the partition using parted
What am I doing wrong? I have an image, I added it as a loop device: ``` losetup -P /dev/loop13 ./my_image.img ``` gparted screenshot: [![gparted screenshot][1]][1] Then I try to change the FS size for the partition first: ``` e2fsck -f /dev/loop13p1 resize2fs /dev/loop13p1 7G ``` It outputs: ``` Re...
What am I doing wrong? I have an image, I added it as a loop device:
losetup -P /dev/loop13 ./my_image.img
gparted screenshot: gparted screenshot Then I try to change the FS size for the partition first:
e2fsck -f /dev/loop13p1
resize2fs /dev/loop13p1 7G
It outputs:
Resizing the filesystem on /dev/loop13p1 to 1835008 (4k) blocks.
The filesystem on /dev/loop13p1 is now 1835008 (4k) blocks long.
Then I shrink the section itself:
parted /dev/loop13p1 resizepart 1 7G
gparted screenshot: gparted screenshot After which I perform:
resize2fs /dev/loop13p1
Output
Resizing the filesystem on /dev/loop13p1 to 3659264 (4k) blocks.
The filesystem on /dev/loop13p1 is now 3659264 (4k) blocks long.
And it rolls back to the original value... gparted screenshot: gparted screenshot **UPD** I tried to reduce the partition via sfdisk and I succeeded, but now I don't understand why even more...
resize2fs -p /dev/loop13p1 7G
echo '2048,7G' | sfdisk /dev/loop13 -N 1
resize2fs /dev/loop13p1
Output:
The filesystem is already 1835008 (4k) blocks long.  Nothing to do!
gparted screenshot: enter image description here
Keonik (173 rep)
Mar 28, 2023, 09:51 AM • Last activity: Mar 28, 2023, 11:36 AM
2 votes
2 answers
4773 views
How to check progress of an already running lvresize command?
First, filesystem was backed up and unmounted succesfully. Then, an lvresize was executed, and is already running: ``` lvresize --resizefs --size 1024G /dev/dbdrp/db ``` And shows the output: ``` fsck from util-linux-ng 2.17.2 /dev/mapper/dbdrp-db: 1718907/201326592 files (0.4% non-contiguous), 9296...
First, filesystem was backed up and unmounted succesfully. Then, an lvresize was executed, and is already running:
lvresize --resizefs --size 1024G /dev/dbdrp/db
And shows the output:
fsck from util-linux-ng 2.17.2
/dev/mapper/dbdrp-db: 1718907/201326592 files (0.4% non-contiguous), 92969270/805304320 blocks
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/dbdrp-db to 268435456 (4k) blocks.
Filesystems output was the former:
[root@generic-linux-hostname ~]# df -hP
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/dbdrp-db  3.0T  310G  2.7T  11% /usr/local/oracle
And physical volumes tables where the following:
PV         VG       Fmt  Attr PSize  PFree
  /dev/xvdc1 dbdrp    lvm2 a--   1.50t    0
  /dev/xvdd1 dbdrp    lvm2 a--   1.50t    0
After resizing finishes, one of this volumes will be pvremoved to recycle the virtual hard disk. How can I see the progress of this lvresize? It's been running an hour, and not much information been thrown out. Thanks guys :)
msK (21 rep)
Apr 11, 2020, 09:11 PM • Last activity: Mar 13, 2023, 10:00 PM
29 votes
1 answers
56260 views
How do I determine the new size for resize2fs?
I want to shrink an ext4 filesystem to make room for a new partition and came across the `resize2fs` program. The command looks like this: resize2fs -p /dev/mapper/ExistingExt4 $size How should I determine `$size` if I want to substract exactly 15 GiB from the current ext4 filesystem? Can I use the...
I want to shrink an ext4 filesystem to make room for a new partition and came across the resize2fs program. The command looks like this: resize2fs -p /dev/mapper/ExistingExt4 $size How should I determine $size if I want to substract exactly 15 GiB from the current ext4 filesystem? Can I use the output of df somehow?
Lekensteyn (21600 rep)
Jun 18, 2012, 09:15 PM • Last activity: Dec 20, 2022, 03:07 PM
Showing page 1 of 20 total questions