間違ったドライブでfdiskを実行しています。どうやって回復できますか?

間違ったドライブでfdiskを実行しています。どうやって回復できますか?

私は走ったディスクドライブ間違ったHDにあります。デフォルトでは、「次へ」をクリックしてパーティション表を消去しました。勝つそれからfdiskを終了し、それが私の主要なハードドライブであることに気づきました。

次のメッセージが表示されます。

警告:エラー16のため、パーティションテーブルの再読み込みに失敗しました。デバイスまたはリソースが使用中です。カーネルはまだ古いテーブルを使用しています。新しいテーブルは、次回再起動するとき、またはpartprobe(8)またはkpartx(8)を実行してディスクを同期した後に使用されます。

/sys/class/block/sdb/sdb* 起動ファイルとサイズファイルを見ました。再起動するまで、以前のパーティションオフセットとサイズを維持するカーネルであることがわかります。これがテーブルの再構築です。

name  |  startsector  | size, sectors  | type?                
------------------------------------------------------------     
sdb1  |  2048         | 2048           |   
sdb2  |  195510270    | 2              |   
sdb3  |  4096         | 195504128      | /  
sdb5  |  195510272    | 761716736      | /home  
sdb6  |  957229056    | 19542016       | swap partition   

パーティションタイプのテストは次のとおりです。

cr1tter@cr1tterhost:~$ sudo file -s /dev/sdb{1,2,3,5,6}
/dev/sdb1: data
/dev/sdb2: x86 boot sector; partition 1: ID=0x83, starthead 254, startsector 2, 761716736 sectors; partition 2: ID=0x5, starthead 254, startsector 761716738, 19544064 sectors, code offset 0x97
/dev/sdb3: Linux rev 1.0 ext4 filesystem data, UUID=b6d939b9-c197-4513-a1fe-9c614574afb0 (needs journal recovery) (extents) (large files) (huge files)
/dev/sdb5: Linux rev 1.0 ext4 filesystem data, UUID=96f97705-f292-49db-b31d-249fab87d3d7 (needs journal recovery) (extents) (large files) (huge files)
/dev/sdb6: Linux/i386 swap file (new style), version 1 (4K pages), size 2442751 pages, no label, UUID=a5744b72-248c-4ceb-8009-db6351cdc231

私は何かが混乱していると思います。sdb1そしてsdb2それは何ですか?正直なところ、それが何であるか覚えていません... OSをインストールするとき - /homeまたはroot:/のようなパスを指定する必要がありました。 - fdiskはこれを許可していないようです...

PS>解決しました。ジムパリスに感謝!これは私がしたことの記録です。再起動したらシステムがうまくいきますね…!

sudo fdisk /dev/sdb
Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0x000cd649

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-976773167, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-976773167, default 976773167): +1M

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0x000cd649

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048        4095        1024   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2): 3
First sector (4096-976773167, default 4096): 
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-976773167, default 976773167): +95461M

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 83

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): e
Partition number (1-4, default 2): 
Using default value 2
First sector (195508224-976773167, default 195508224): 
Using default value 195508224
Last sector, +sectors or +size{K,M,G} (195508224-976773167, default 976773167): 
Using default value 976773167

Command (m for help): n
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (195510272-976773167, default 195510272): 
Using default value 195510272
Last sector, +sectors or +size{K,M,G} (195510272-976773167, default 976773167): +371932M

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 83

Command (m for help): n
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 6
First sector (957229056-976773167, default 957229056): 
Using default value 957229056
Last sector, +sectors or +size{K,M,G} (957229056-976773167, default 976773167): +9542M

Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix      
Hex code (type L to list codes): 82 
Changed system type of partition 6 to 82 (Linux swap / Solaris)


Command (m for help): a
Partition number (1-6): 1


Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0x000cd649

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048        4095        1024   83  Linux
/dev/sdb2       195508224   976773167   390632472    5  Extended
/dev/sdb3            4096   195508223    97752064   83  Linux
/dev/sdb5       195510272   957227007   380858368   83  Linux
/dev/sdb6       957229056   976771071     9771008   82  Linux swap / Solaris

Partition table entries are not in disk order

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

ベストアンサー1

fdiskパーティション分割を実行すると、他のもの(カーネルコマンドラインやコンテンツなど)がどのように使用されるかが/etc/fstab決まります。たとえば、/dev/sdb5使用するものをインストーラに知らせると、/homeこれを達成するために多くのことが行われます(パーティションテーブル設定、パーティションフォーマット、サイズ変更fstabなど)。

特定の質問に答えるには:

  • sdb1これはブートパーティションのように見え、grubBIOS呼び出しを使用して検索できる場所にカーネルを保持するために使用されます。可能ext2ですが、それを使用してfile -s /dev/sdb1形式を把握できます。

  • sdb2拡張パーティションのように見えます。一般的なMS-DOSタイプパーティションテーブルには、1から4まで番号が付けられた4つのプライマリパーティションしかありません。 0x05タイプのデフォルトパーティションの1つを作成する場合は、より高い数の論理パーティションを作成できます。

  • sdb3ルートパーティションのように見えます。

sdb3とsdb2が失敗するのは少し奇妙ですが、可能です。私の考えでは、fdiskで次のことを行う必要があるようです。

  • 新しいパーティションテーブル
  • 新しいプライマリパーティション1、スタート2048、サイズ+2047
  • パーティション1のIDを0x83(Linux)に変更します。
  • 195504128サイズ(最大)で始まる新しい拡張パーティション2を作成します。
  • 4096で始まり、サイズ+ 195504127の新しいデフォルトパーティション3を作成します。
  • パーティション3のIDを0x83(Linux)に変更します。
  • 195510272から始まり、サイズ+ 761716735の新しい論理区画5を作成します。
  • パーティション5のIDを0x83(Linux)に変更します。
  • 957229056から始まり、サイズ+19542015の新しい論理区画6を作成します。
  • パーティション6のIDを0x82に変更する(Linuxスワップ)

おすすめ記事