Before operations:
Code: Select all
root@ubuntu:/home/ubuntu# parted /dev/sda print
Model: ATA ST1000LM035-1RK1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 106MB 105MB fat32 EFI system partition boot, esp
2 106MB 123MB 16.8MB Microsoft reserved partition msftres
3 123MB 999GB 999GB ntfs Basic data partition msftdata
4 999GB 1000GB 1074MB ntfs Basic data partition diag
Commands issued for resize of the filesystem and partitions as follows:
Code: Select all
root@ubuntu:/home/ubuntu# ntfsresize -s 148G /dev/sda3
[code]
Output of NTFSRESIZE:
[code]
Current volume size: 999007711744 bytes (999008 MB)
Current device size: 999007715328 bytes (999008 MB)
New volume size : 147999998464 bytes (148000 MB)
.....
Space in use : 85624 MB (8.6%)
Collecting resizing constraints ...
Needed relocations : 185404 (760 MB)
.....
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda3'.
Code: Select all
root@ubuntu:/home/ubuntu# parted /dev/sda
Code: Select all
(parted)
Unit? [compact]? kb
(parted) print
...
Number Start End Size File system Name Flags
1 1049kB 105906kB 104858kB fat32 EFI system partition boot, esp
2 105906kB 122683kB 16777kB Microsoft reserved partition msftres
3 122683kB 999130399kB 999007715kB ntfs Basic data partition msftdata
4 999130399kB 1000204141kB 1073742kB ntfs Basic data partition diag
(parted) resizepart 3 148000008
....
(parted) quit
Information: You may need to update /etc/fstab.
And As it says in the confirmation of ntfsresize I can use testdisk if I made a mistake, (thats why I found testdisk )
Code: Select all
IMPORTANT: When recreating the partition, make sure that you
1) create it at the same disk sector (use sector as the unit!)
2) create it with the same partition type (usually 7, HPFS/NTFS)
3) do not make it smaller than the new NTFS filesystem size
4) set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.
Here are the key facts:
- partition ends at 289062515 (verified by testdisk/fdisk/parted)
Parted gives partition size 288822900
Testdisk gives size boot_sector 289062497 > partition 288822900
Last sector according to `mount /dev/sda3 /mnt/windows` is 289062495
So is it is the problem with my NTFS boot sector has been destroyed and i need to recreate it? Any help is gladly appreciated.
I feel like there is some hope in getting my files back since maybe only the MFT or boot sector has been destroyed but my files are still there?
Testdisk output:
Code: Select all
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
Current partition structure:
Partition Start End Size in sectors
1 P EFI System 2048 206847 204800 [EFI system partition]
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
2 P MS Reserved 206848 239615 32768 [Microsoft reserved partition]
2 P MS Reserved 206848 239615 32768 [Microsoft reserved partition]
Error: size boot_sector 289062497 > partition 288822900
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
3 P MS Data 239616 289062515 288822900 [Basic data partition]
3 P MS Data 239616 289062515 288822900 [Basic data partition]
4 P Unknown 1951426560 1953523711 2097152 [Basic data partition]
When I try to mount here's what happens:
Code: Select all
root@ubuntu:/home/ubuntu# mount /dev/sda3 /mnt/windows
Failed to read last sector (289062495): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sda3': Invalid argument
The device '/dev/sda3' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
Code: Select all
Code: Select all
root@ubuntu:/home/ubuntu# ntfsresize --info /dev/sda3
ntfsresize v2017.3.23AR.3 (libntfs-3g)
Failed to read last sector (289062495): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
ERROR(22): Opening '/dev/sda3' as NTFS failed: Invalid argument
The device '/dev/sda3' doesn't have a valid NTFS.
Maybe you selected the wrong partition? Or the whole disk instead of a
partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur
if the disk was incorrectly repartitioned (see the ntfsresize FAQ).