How can I make linux kernel recognize my filesystems without rebooting? I have started…
- User
How can I make linux kernel recognize my filesystems without rebooting? I have started linux without usb and my pc will have no operating system to boot if i reboot so i am stuck here is terminal output of what I have tried
linux@linux:
partprobe linux@linux:sudo partprobe Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. linux@linux:blockdev blockdev: not enough arguments Try 'blockdev --help' for more information. linux@linux:$ blockdev --helpUsage: blockdev [-v|-q] commands devices blockdev --report [devices] blockdev -h|-V
Call block device ioctls from the command line.
Options: -q quiet mode -v verbose mode --report print report for specified (or all) devices
-h, --help display this help -V, --version display version
Available commands: --getsz get size in 512-byte sectors --setro set read-only --setrw set read-write --getro get read-only --getdiscardzeroes get discard zeroes support status --getss get logical block (sector) size --getpbsz get physical block (sector) size --getiomin get minimum I/O size --getioopt get optimal I/O size --getalignoff get alignment offset in bytes --getmaxsect get max sectors per request --getbsz get blocksize --setbsz set blocksize on file descriptor opening the block device --getsize get 32-bit sector count (deprecated, use --getsz) --getsize64 get size in bytes --setra set readahead --getra get readahead --setfra set filesystem readahead --getfra get filesystem readahead --getdiskseq get disk sequence number --flushbufs flush buffers --rereadpt reread partition table
For more details see blockdev(8). linux@linux:
sudo blockdev --rereadpt /dev/nvme0n1 blockdev: ioctl error on BLKRRPART: Device or resource busy linux@linux:udevadm Command verb required. linux@linux:~$ udevadm --help udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]Send control commands or test the device manager.
Commands: info Query sysfs or the udev database trigger Request events from the kernel settle Wait for pending udev events control Control the udev daemon monitor Listen to kernel and udev events test Test an event run test-builtin Test a built-in command verify Verify udev rules files wait Wait for device or device symlink lock Lock a block device
See the udevadm(8) man page for details. linux@linux:
df -h Filesystem Size Used Avail Use% Mounted on tmpfs 1.2G 1.7M 1.2G 1% /run efivarfs 128K 80K 44K 66% /sys/firmware/efi/efivars /dev/shm 3.0G 2.8G 141M 96% /cdrom /cow 5.8G 394M 5.4G 7% / tmpfs 5.8G 4.0K 5.8G 1% /dev/shm tmpfs 5.0M 12K 5.0M 1% /run/lock tmpfs 5.8G 4.0K 5.8G 1% /tmp tmpfs 1.2G 2.6M 1.2G 1% /run/user/1000 linux@linux:sudo partprobe Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. linux@linux:sudo systemctl restart systemd-udev* linux@linux:udevadm trigger --subsystem-match=block; udevadm settle nvme0n1: Failed to write 'change' to '/sys/devices/pci0000:00/0000:00:1d.4/0000:02:00.0/nvme/nvme0/nvme0n1/uevent': Permission denied nvme0n1p1: Failed to write 'change' to '/sys/devices/pci0000:00/0000:00:1d.4/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/uevent': Permission denied nvme0n1p2: Failed to write 'change' to '/sys/devices/pci0000:00/0000:00:1d.4/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/uevent': Permission denied loop0: Failed to write 'change' to '/sys/devices/virtual/block/loop0/uevent': Permission denied loop1: Failed to write 'change' to '/sys/devices/virtual/block/loop1/uevent': Permission denied loop2: Failed to write 'change' to '/sys/devices/virtual/block/loop2/uevent': Permission denied loop3: Failed to write 'change' to '/sys/devices/virtual/block/loop3/uevent': Permission denied loop4: Failed to write 'change' to '/sys/devices/virtual/block/loop4/uevent': Permission denied loop5: Failed to write 'change' to '/sys/devices/virtual/block/loop5/uevent': Permission denied loop6: Failed to write 'change' to '/sys/devices/virtual/block/loop6/uevent': Permission denied loop7: Failed to write 'change' to '/sys/devices/virtual/block/loop7/uevent': Permission denied linux@linux:~$ sudo bash root@linux:/home/linux# udevadm trigger --subsystem-match=block; udevadm settle root@linux:/home/linux# partprobe Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. root@linux:/home/linux# fdisk /dev/nvme0n1Welcome to fdisk (util-linux 2.39.3). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap partitions on this disk.
Command (m for help): q
root@linux:/home/linux# lsblk -f /dev/nvme0n1 NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS nvme0n1
├─nvme0n1p1 │ vfat FAT32 604E-4BBB
└─nvme0n1p2 ext4 1.0 01323b41-ecdc-4ba2-a564-41b8267871c3
root@linux:/home/linux# lsblk -f /dev/nvme0n1 NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS nvme0n1
├─nvme0n1p1 vfat FAT32 604E-4BBB
└─nvme0n1p2 ext4 1.0 01323b41-ecdc-4ba2-a564-41b8267871c3
root@linux:/home/linux# ex't^C root@linux:/home/linux# ^C root@linux:/home/linux# exit exit linux@linux:~ lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS loop0 iso966 Jolie Linux Mint 22.1 Cinnamon 64-bit 2025-01-10-16-16-21-00
loop1 squash 4.0 0 100% /rofs nvme0n1├─nvme0n1p1 │ vfat FAT32 604E-4BBB
└─nvme0n1p2 ext4 1.0 01323b41-ecdc-4ba2-a564-41b8267871c3
linux@linux:sudo dmsetup ls --target stripe No devices found linux@linux:sudo partprobe /dev/nvme0n1 Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. linux@linux:~ sudo bash root@linux:/home/linux# sudo lsof /dev/nvme0n1 sudo lsof /dev/nvme0n1p1 sudo lsof /dev/nvme^C1p2root@linux:/home/linux# lsof /dev/nvme0n1 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc Output information may be incomplete. root@linux:/home/linux# lsof /dev/nvme0n1p1 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc Output information may be incomplete. root@linux:/home/linux# lsof /dev/nvme0n1p2 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc Output information may be incomplete. root@linux:/home/linux# ex't
^C root@linux:/home/linux# exit exit linux@linux:~$ sudo partprobe Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
- Assistant
You are running a live Linux system (probably from a USB or DVD), and you want the kernel to recognize new or changed partitions on your internal NVMe drive without rebooting. You are getting errors like:
Error: Partition(s) 2 on /dev/nvme0n1 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.Let's break down what's happening and what you can do.
What's Happening?
- The kernel cannot re-read the partition table because the device is in use.
- This is common when:
- Partitions are mounted (even read-only).
- Swap is active on the device.
- The device is being used by a process (including the live system itself, if it is using persistence or swap on the internal drive).
What You Tried
partprobe,blockdev --rereadpt,kpartx,udevadm trigger, etc.- Checked with
lsoffor open files (but didn't see anything obvious). lsblkshows the partitions and filesystems.
What To Do Next
1. Check if the device is in use
You already ran
lsof, but let's be thorough:sudo lsof | grep nvme0n1 sudo fuser -vm /dev/nvme0n1*If you see any processes, stop/kill them if possible.
2. Check for active swap
Run:
swapon --summaryIf you see
/dev/nvme0n1p2or similar, turn it off:sudo swapoff /dev/nvme0n1p2
3. Check for mounted partitions
Run:
mount | grep nvme0n1If anything is mounted, unmount it:
sudo umount /dev/nvme0n1p1 sudo umount /dev/nvme0n1p2
4. Try again
Now try:
sudo partprobe # or sudo blockdev --rereadpt /dev/nvme0n1
5. If still stuck
- If the device is not in use (not mounted, not swap, not open by any process), and you still get "device busy", it may be a limitation of the live environment or a kernel bug.
- Sometimes, the live system itself (especially with persistence) may use the internal drive for overlay or swap, making it impossible to re-read the partition table.
Alternative: Manual Mount
If your goal is to mount and access the filesystems (not repartition), you don't need to re-read the partition table if the partitions are already visible in
lsblkandlsblk -f(as in your output).You can just mount them:
sudo mkdir /mnt/myroot sudo mount /dev/nvme0n1p2 /mnt/myrootAnd for EFI:
sudo mkdir /mnt/efi sudo mount /dev/nvme0n1p1 /mnt/efi
Summary Table
Step Command Example Purpose Check open files `sudo lsof grep nvme0n1` Check swap swapon --summarySee if swap is active Turn off swap sudo swapoff /dev/nvme0n1p2Free the device Check mounts `mount grep nvme0n1` Unmount sudo umount /dev/nvme0n1p1Free the device Re-read partitions sudo partprobeorsudo blockdev --rereadptInform kernel of changes Mount manually sudo mount /dev/nvme0n1p2 /mnt/myrootAccess filesystems
If All Else Fails
- If you cannot free the device (because the live system is using it), you must reboot with a live USB that does not use the internal drive for persistence or swap.
- Or, use a different live USB (e.g., Ubuntu, Mint, etc.) and disable persistence.
TL;DR
- Unmount and swapoff all partitions on
/dev/nvme0n1. - Check for open files with
lsofandfuser. - Try
partprobeorblockdev --rereadptagain. - If partitions are already visible, just mount them.
- If you can't free the device, reboot with a different live USB.
If you post the output of
swapon --summary,mount | grep nvme0n1, andsudo fuser -vm /dev/nvme0n1*, I can help you further!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.