Can't mount drive after failed partition resize

I resized a partition through KDE Partition Manager (380GB → 350GB). The disk only had 270GB used according to KDE PM, but the resize failed, and now that partition won’t mount. It’s my main data drive, and I’m worried I may have lost data.

My system is dual-booted Manjaro + Windows 7. I haven’t tried booting the windows OS to see if the drive is fine there; I’m scared that might break something further. What should I do? How can I recover my data?

inxi --admin --verbosity=7 --filter --width:

Summary
System:
  Kernel: 5.15.94-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
    root=UUID=5cca366c-3f6c-47f2-8665-504baa926be5 rw quiet apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: KDE Plasma v: 5.26.5 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: ASUSTeK model: M5A97 R2.0 v: Rev 1.xx
    serial: <superuser required> BIOS: American Megatrends v: 2201
    date: 12/10/2013
Battery:
  Device-1: sony_controller_battery_04:76:6e:1f:01:99 model: N/A serial: N/A
    charge: N/A status: N/A
Memory:
  RAM: total: 7.66 GiB used: 3.08 GiB (40.2%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD FX-8350 bits: 64 type: MT MCP arch: Piledriver level: v2
    built: 2012-13 process: GF 32nm family: 0x15 (21) model-id: 2 stepping: 0
    microcode: 0x6000852
  Topology: cpus: 1x cores: 8 smt: enabled cache: L1: 384 KiB
    desc: d-8x16 KiB; i-4x64 KiB L2: 8 MiB desc: 4x2 MiB L3: 8 MiB desc: 1x8 MiB
  Speed (MHz): avg: 1417 high: 1475 min/max: 1400/4000 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1449 2: 1475
    3: 1403 4: 1404 5: 1404 6: 1398 7: 1404 8: 1403 bogomips: 64237
  Flags: 3dnowprefetch abm aes aperfmperf apic arat avx bmi1 clflush cmov
    cmp_legacy constant_tsc cpb cpuid cr8_legacy cx16 cx8 de decodeassists
    extapic extd_apicid f16c flushbyasid fma fma4 fpu fxsr fxsr_opt ht
    hw_pstate ibpb ibs lahf_lm lbrv lm mca mce misalignsse mmx mmxext monitor
    msr mtrr nodeid_msr nonstop_tsc nopl npt nrip_save nx osvw pae pat
    pausefilter pclmulqdq pdpe1gb perfctr_core perfctr_nb pfthreshold pge pni
    popcnt pse pse36 rdtscp rep_good sep skinit ssbd sse sse2 sse4_1 sse4_2
    sse4a ssse3 svm svm_lock syscall tbm tce topoext tsc tsc_scale vmcb_clean
    vme vmmcall wdt xop xsave
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT vulnerable
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl and seccomp
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    disabled, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GM107 [GeForce GTX 750 Ti] vendor: eVga.com. driver: nvidia
    v: 525.89.02 alternate: nouveau,nvidia_drm non-free: 525.xx+
    status: current (as of 2023-02) arch: Maxwell code: GMxxx
    process: TSMC 28nm built: 2014-19 pcie: gen: 2 speed: 5 GT/s lanes: 8
    link-max: lanes: 16 bus-ID: 01:00.0 chip-ID: 10de:1380 class-ID: 0300
  Device-2: Logitech HD Webcam C910 type: USB driver: snd-usb-audio,uvcvideo
    bus-ID: 10-2:2 chip-ID: 046d:0821 class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.7 with: Xwayland v: 22.1.8
    compositor: kwin_x11 driver: X: loaded: nvidia gpu: nvidia display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 3840x1242 s-dpi: 94 s-size: 1038x335mm (40.87x13.19")
    s-diag: 1091mm (42.94")
  Monitor-1: DVI-I-1 pos: primary,bottom-r res: 1920x1080 hz: 60 dpi: 94
    size: 521x293mm (20.51x11.54") diag: 598mm (23.53") modes: N/A
  Monitor-2: HDMI-0 pos: top-left res: 1920x1080 hz: 60 dpi: 93
    size: 527x296mm (20.75x11.65") diag: 604mm (23.8") modes: N/A
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: NVIDIA GeForce GTX 750
    Ti/PCIe/SSE2 direct-render: Yes
Audio:
  Device-1: AMD SBx00 Azalia vendor: ASUSTeK driver: snd_hda_intel v: kernel
    bus-ID: 10-2:2 bus-ID: 00:14.2 chip-ID: 046d:0821 chip-ID: 1002:4383
    class-ID: 0e02 serial: <filter> class-ID: 0403
  Device-2: NVIDIA GM107 High Definition Audio [GeForce 940MX]
    vendor: eVga.com. driver: snd_hda_intel v: kernel pcie: gen: 2 speed: 5 GT/s
    lanes: 8 link-max: lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:0fbc
    class-ID: 0403
  Device-3: Logitech HD Webcam C910 type: USB driver: snd-usb-audio,uvcvideo
  Device-4: Shure MV5 type: USB driver: hid-generic,snd-usb-audio,usbhid
    bus-ID: 5-1:2 chip-ID: 14ed:1000 class-ID: 0300
  Sound API: ALSA v: k5.15.94-1-MANJARO running: yes
  Sound Server-1: JACK v: 1.9.22 running: no
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.65 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK P8 series driver: r8169 v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: d000 bus-ID: 02:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Message: No bluetooth data found.
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 577.55 GiB used: 165.59 GiB (28.7%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 840 EVO 120GB
    size: 111.79 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: BB6Q scheme: MBR
  ID-2: /dev/sdb maj-min: 8:16 vendor: Western Digital
    model: WDS500G2B0A-00SM50 size: 465.76 GiB block-size: physical: 512 B
    logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 40WD
    scheme: MBR
  Optical-1: /dev/sr0 vendor: ASUS model: DRW-24B1ST i rev: 1.00
    dev-links: cdrom
  Features: speed: 48 multisession: yes audio: yes dvd: yes
    rw: cd-r,cd-rw,dvd-r,dvd-ram state: running
Partition:
  ID-1: / raw-size: 87.89 GiB size: 85.95 GiB (97.80%) used: 68.87 GiB (80.1%)
    fs: ext4 dev: /dev/sdb2 maj-min: 8:18 label: N/A
    uuid: 5cca366c-3f6c-47f2-8665-504baa926be5
  ID-2: /run/media/pancelor/6EF3AF59591C039D raw-size: 103.89 GiB
    size: 103.89 GiB (100.00%) used: 96.72 GiB (93.1%) fs: ntfs dev: /dev/sda1
    maj-min: 8:1 label: N/A uuid: 6EF3AF59591C039D
Swap:
  Alert: No swap data was found.
Unmounted:
  ID-1: /dev/sda2 maj-min: 8:2 size: 1 KiB fs: <superuser required> label: N/A
    uuid: N/A
  ID-2: /dev/sdb1 maj-min: 8:17 size: 348.57 GiB fs: ntfs label: data
    uuid: 462C821B2C8205E1
USB:
  Hub-1: 1-0:1 info: Full speed or root hub ports: 5 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 2-0:1 info: Full speed or root hub ports: 5 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-3: 3-0:1 info: Full speed or root hub ports: 4 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-4: 4-0:1 info: Full speed or root hub ports: 5 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 4-1:2 info: Logitech G402 Gaming Mouse type: Mouse,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 300mA
    chip-ID: 046d:c07e class-ID: 0300 serial: <filter>
  Device-2: 4-2:3 info: Razer USA BlackWidow Tournament Edition Stealth
    type: Keyboard,Mouse driver: hid-generic,usbhid interfaces: 3 rev: 2.0
    speed: 12 Mb/s power: 100mA chip-ID: 1532:011c class-ID: 0300
  Hub-5: 5-0:1 info: Full speed or root hub ports: 5 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 5-1:2 info: Shure MV5 type: Audio,HID
    driver: hid-generic,snd-usb-audio,usbhid interfaces: 4 rev: 2.0
    speed: 12 Mb/s power: 100mA chip-ID: 14ed:1000 class-ID: 0300
  Hub-6: 6-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Hub-7: 7-0:1 info: Full speed or root hub ports: 4 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Hub-8: 8-0:1 info: Hi-speed hub with single TT ports: 2 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 8-2:2 info: Sony Batoh Device / PlayStation 3 Controller
    type: HID driver: sony,usbhid interfaces: 1 rev: 2.0 speed: 12 Mb/s
    power: 500mA chip-ID: 054c:0268 class-ID: 0300
  Hub-9: 9-0:1 info: Super-speed hub ports: 2 rev: 3.0 speed: 5 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Hub-10: 10-0:1 info: Hi-speed hub with single TT ports: 2 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 10-2:2 info: Logitech HD Webcam C910 type: Audio,Video
    driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s
    power: 500mA chip-ID: 046d:0821 class-ID: 0e02 serial: <filter>
  Hub-11: 11-0:1 info: Super-speed hub ports: 2 rev: 3.0 speed: 5 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: 17.6 C mobo: N/A gpu: nvidia temp: 22 C
  Fan Speeds (RPM): N/A gpu: nvidia fan: 42%
Info:
  Processes: 233 Uptime: 45m wakeups: 1 Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7 Packages: 1457
  pm: pacman pkgs: 1433 libs: 370 tools: pamac pm: flatpak pkgs: 9 pm: snap
  pkgs: 15 Shell: Zsh v: 5.9 default: Bash v: 5.1.16 running-in: yakuake
  inxi: 3.3.25

Full story:

I’ve been having some system instability (sometimes my system freezes and I have to hold the power button to shut it down) so I decided to add more swap space to see if it would help. I did these steps in order:

  1. I opened KDE Partition Manager and unmounted /dev/sdb1 (my NTFS data partition)
  2. I removed my existing 1GB swapfile:
    2a. sudo swapoff -a
    2b. I removed the line with my swapfile from /etc/fstab
    2c. swapon -a
    2d. swapon -s – no output
    2e. free -h – shows 0 swap space
  3. I set up a job in KDE Partition Manager to shrink my data partition by 30,000MiB, and create a 11,000MiB linuxswap partition at the start of the resulting free space.
  4. I “applied” the job and it errored:
KDE Partition Manager: SMART Status Report
Date: 	2023-03-21 12:30 A.M.
Program version: 	22.12.2
Backend: 	pmsfdiskbackendplugin (1)
KDE Frameworks version: 	5.102.0
Machine: 	Linux pancelor-manjaro 5.15.94-1-MANJARO #1 SMP PREEMPT Tue Feb 14 19:45:58 UTC 2023 x86_64

Shrink partition ‘/dev/sdb1’ from 377.87 GiB to 348.57 GiB
	Job: Check file system on partition ‘/dev/sdb1’
		Command: ntfsresize --no-progress-bar --info --force --verbose /dev/sdb1
	Check file system on partition ‘/dev/sdb1’: Success
	Job: Resize file system on partition ‘/dev/sdb1’ to 731,006,976 sectors

	The file system on partition ‘/dev/sdb1’ already has the requested length of 731,006,976 sectors.


	Resize file system on partition ‘/dev/sdb1’ to 731,006,976 sectors: Success
	Job: Set geometry of partition ‘/dev/sdb1’: Start sector: 2,048, length: 731,006,976
		Command: sfdisk --force /dev/sdb -N 1
	Set geometry of partition ‘/dev/sdb1’: Start sector: 2,048, length: 731,006,976: Success
	Job: Check file system on partition ‘/dev/sdb1’
		Command: ntfsresize --no-progress-bar --info --force --verbose /dev/sdb1
	Check file system on partition ‘/dev/sdb1’: Error

	Checking partition ‘/dev/sdb1’ after resize/move failed.


Shrink partition ‘/dev/sdb1’ from 377.87 GiB to 348.57 GiB: Error
  1. The data drive won’t mount anymore; I restarted my computer and tried to access my files through Dolphin, but it errored: “An error occurred while accessing ‘data’, the system responded: The requested operation has failed: Error mounting /dev/sdb1 at /run/media/pancelor/data: Unknown error when mounting /dev/sdb1”.
  2. My data drive used to auto-mount on boot, and I forget how I set that up exactly. My past notes say I “used fstab”. I think I may have accidentally removed an extra line from /etc/fstab during step 2b above? I tried to add it back in, assuming I had accidentally removed it:
Summary

(I’ve hidden the rest of this behind a details dropdown because I expect it won’t be too relevant, but I’ve included it for completeness)

  1. I looked into Fstab - Manjaro
    7a. used sudo blkid to find my data partition (/dev/sdb1: LABEL="data" BLOCK_SIZE="512" UUID="462C821B2C8205E1" TYPE="ntfs" PARTUUID="1a1f3123-01")
    7b. I added this line to my /etc/fstab: UUID=462C821B2C8205E1 /run/media/pancelor/462C821B2C8205E1/ ntfs noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2
    7c. It still won’t mount when I click on the partition in Dolphin: “An error occurred while accessing ‘data’, the system responded: The requested operation has failed: Error creating directory `/run/media/pancelor/462C821B2C8205E1/’ to be used for mounting /dev/sdb1: Not a directory”.
    7d. I tried changing the fstab line to say “/run/media/pancelor/data” instead of “/run/media/pancelor/462C821B2C8205E1/”, but Dolphin still can’t mount it: ““An error occurred while accessing ‘data’, the system responded: The requested operation has failed: Error mounting system-managed device /dev/sdb1: Unknown error when mounting /run/media/pancelor/data””
  2. I opened KDE Partition Manager, right-clicked on /dev/sdb1/ and tried the “check and repair partition” job; it failed:
KDE Partition Manager: SMART Status Report
Date: 	2023-03-21 1:16 A.M.
Program version: 	22.12.2
Backend: 	pmsfdiskbackendplugin (1)
KDE Frameworks version: 	5.102.0
Machine: 	Linux pancelor-manjaro 5.15.94-1-MANJARO #1 SMP PREEMPT Tue Feb 14 19:45:58 UTC 2023 x86_64

Check and repair partition ‘/dev/sdb1’ (348.57 GiB, ntfs)
	Job: Check file system on partition ‘/dev/sdb1’
		Command: ntfsresize --no-progress-bar --info --force --verbose /dev/sdb1
	Check file system on partition ‘/dev/sdb1’: Error
Check and repair partition ‘/dev/sdb1’ (348.57 GiB, ntfs): Error

What should I do? Should I boot into windows and check if everything’s fine from that side?

I want to say yes, but I’m honestly not :100: sure if it’ll work.

I think download, and write the ISO to a thumb drive and boot with System Rescue:

https://www.system-rescue.org/Installing-SystemRescue-on-a-USB-memory-stick/

It says on the website:

System tools included

  • GNU Parted: creates, resizes, moves, copies partitions, and filesystems (and more).
  • GParted: GUI implementation using the GNU Parted library.
  • FSArchiver: flexible archiver that can be used as both system and data recovery software
  • ddrescue : Attempts to make a copy of a block device that has hardware errors, optionally filling corresponding bad spots in input with user defined pattern in the copy.
  • File systems tools (for Linux and Windows filesystems): format, resize, and debug an existing partition of a hard disk
  • Ntfs3g: enables read/write access to MS Windows NTFS partitions.
  • Test-disk : tool to check and undelete partition, supports reiserfs, ntfs, fat32, ext3/ext4 and many others
  • Memtest: to test the memory of your computer (first thing to test when you have a crash or unexpected problems)
  • Rsync: very-efficient and reliable program that can be used for remote backups.
  • Network tools (Samba, NFS, ping, nslookup, …): to backup your data across the network

So you can check the drive for any errors and presumably fix them with it.

Edit:

You can also use Testdisk:

I’ve used it before and it works well. Usage instructions are on the website.

1 Like

Exactly. Linux has no real file system check & repair for NTFS. Even if you can resize and do all the fun stuff on Linux. CHKDSK is only available on Windows. Linux has only ntfsfix which does not repair anything, instead it just clear dirty bits and clear bad sector list. End of story.

PS: After resizing a drity bit is set. What means it will refuse to be mounted until it is removed or chkdsk checked it and remove thereby the dirty bit.

1 Like

Thank you! I’ve recovered my data – TestDisk worked perfectly.

What I did: Yesterday I booted into windows, it couldn’t find the files and chkdsk said the disk was RAW and not NTFS, so it wouldn’t run. I went back to Manjaro and ran TestDisk; I chose “analyze” and iirc it said “invalid NTFS boot” and “Error: size boot_sector 792446976 > partition 731006976” (so… maybe when KDE Partition Manager ran ntfsresize, it resized the partition and the file system, but not the “boot sector”?) Anyway, I was able to recover the partition from there and everything’s working now.

Now I’ve made a backup (should have done that before all of this!) and I’m going to boot back into windows to resize the partition from there. Thanks again!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.