Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LVM resize fails: Device or resource busy
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 432
Location: UK

PostPosted: Sun Jan 26, 2025 6:51 pm    Post subject: LVM resize fails: Device or resource busy Reply with quote

I have a logical volume that I wish to reduce in size. It contains a single ext4 filesystem.
I've tried the following:
Code:

~ # lvscan
....
  ACTIVE            '/dev/vg01/rsnapshot' [700.00 GiB] inherit
...

~ # resize2fs -M /dev/vg01/rsnapshot
resize2fs 1.47.1 (20-May-2024)
Filesystem at /dev/vg01/rsnapshot is mounted on /mnt/rsnapshot; on-line resizing required
resize2fs: On-line shrinking not supported

~ # fuser -amuv /dev/vg01/rsnapshot
                     USER        PID ACCESS COMMAND
/dev/dm-4:           root     kernel mount (root)/mnt/rsnapshot

~ # umount /dev/mapper/vg01-rsnapshot

~ # fuser -amuv /dev/vg01/rsnapshot
                     USER        PID ACCESS COMMAND
/dev/dm-4:

~ # resize2fs -M /dev/vg01/rsnapshot
resize2fs 1.47.1 (20-May-2024)
resize2fs: Device or resource busy while trying to open /dev/vg01/rsnapshot
Couldn't find valid filesystem superblock.

~ # lsof -l | grep dm-4
jbd2/dm-4  3244                        0 cwd       DIR             251,10        4096          2 /
jbd2/dm-4  3244                        0 rtd       DIR             251,10        4096          2 /
jbd2/dm-4  3244                        0 txt   unknown                                           /proc/3244/exe

~ # ps -ef | grep 3244
root      3244     2  0 Jan25 ?        00:00:03 [jbd2/dm-4-8]

~ # lvchange --activate n /dev/vg01/rsnapshot
  Logical volume vg01/rsnapshot contains a filesystem in use.


With the filesystem unmounted, fuser shows no users active, but lsof shows the task 3244 active, which is [jbd2/dm-4-8]
It appears that this causes LVM and resize2fs to think that the device is in use.
(There is no active snapshot for this logical volume)

Does anyone know what this task is, and whether it can be stopped so that filesystem and logical volume can be resized?
Or, is there an option that allows resize2fs to do on-line shrinking?
Thanks
Back to top
View user's profile Send private message
sublogic
Guru
Guru


Joined: 21 Mar 2022
Posts: 305
Location: Pennsylvania, USA

PostPosted: Mon Jan 27, 2025 3:00 am    Post subject: Reply with quote

[jbd2/dm-4-8] is a kernel thread (note the enclosing [ ]). It has to do with flushing filesystem journal transactions ? I don't know more than that and I don't know how to stop it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum