是否应该删除未使用的分区?

是否应该删除未使用的分区?

我下载了 jessie raspbian 映像,它显示了两个分区。

[Michael@devserver ~]$ fdisk -l 2017-07-05-raspbian-jessie-lite.img
You must set cylinders.
You can do this from the extra functions menu.

Disk 2017-07-05-raspbian-jessie-lite.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa8790229

                              Device Boot      Start         End      Blocks   Id  System
2017-07-05-raspbian-jessie-lite.img1               1           6       42702+   c  W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
2017-07-05-raspbian-jessie-lite.img2               6         210     1638081   83  Linux
Partition 2 does not end on cylinder boundary.
[Michael@devserver ~]$

fdisk我将图像复制到以前使用过的 SD(抱歉,复制图像之前我没有输出):

[Michael@devserver ~]$ sudo dd bs=4M if=2017-07-05-raspbian-jessie-lite.img of=/dev/sdf
411+1 records in
411+1 records out
1725629563 bytes (1.7 GB) copied, 149.961 s, 11.5 MB/s
[Michael@devserver ~]$

检查设备现在显示以下内容:

[Michael@devserver ~]$ sudo fdisk -l /dev/sdf

Disk /dev/sdf: 31.9 GB, 31914983424 bytes
64 heads, 32 sectors/track, 30436 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa8790229

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               5          46       42702+   c  W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
/dev/sdf2              47        1646     1638081   83  Linux
Partition 2 does not end on cylinder boundary.

[Michael@devserver ~]$ lsblk -f /dev/sdf
NAME   FSTYPE LABEL UUID MOUNTPOINT
sdf
├─sdf1
├─sdf2
├─sdf5
├─sdf6
└─sdf7
[Michael@devserver ~]$ cat /proc/partitions | grep sdf
   8       80   31166976 sdf
   8       81    1243951 sdf1
   8       82          1 sdf2
   8       85      32767 sdf5
   8       86      67584 sdf6
   8       87   29815296 sdf7
[Michael@devserver ~]$ sudo blkid /dev/sdf*
/dev/sdf1: LABEL="boot" UUID="109A-9113" TYPE="vfat"
[Michael@devserver ~]$

为什么分区sdf5sdf6、 和sdf7仍然存在?是否应该将其删除?如果是,如何删除?

答案1

复制映像后,您是否运行partprobe /dev/sdf或弹出并重新插入卡?如果不这样做,内核可能仍在使用该卡的旧分区表。

当您覆盖整个磁盘/SD 卡时,您需要告诉内核它应该重新读取分区表。partprobe是最简单的命令。

相关内容