分区后不用重新启动,通知内核磁盘分区表发生变化
在正在使用的磁盘上面,使用fdisk创建分区之后,需要重新启动linux, 以重读分区表信息,才能在新的分区上面建立文件系统, 为了不重新启动系统,可以使用partprobe ,来通知内核磁盘分区表 发生变化,之后就可以使用mke2fs创建文件系统了,这个是创建lvm时的一个片段:
Command (m for help): p
Disk /dev/hda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 5099 40957686 83 Linux
/dev/hda2 5100 5349 2008125 82 Linux swap
/dev/hda3 5350 14593 74252430 5 Extended
/dev/hda5 5350 8997 29302528+ 8e Linux LVM
/dev/hda6 8998 12645 29302528+ 83 Linux
/dev/hda7 12646 14593 15647278+ 83 Linux
Command (m for help): t
Partition number (1-7): 6
Hex code (type L to list codes): 8e
Changed system type of partition 6 to 8e (Linux LVM)
Command (m for help): t Partition number (1-7): 7 Hex code (type L to list codes): 8e Changed system type of partition 7 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/hda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 5099 40957686 83 Linux /dev/hda2 5100 5349 2008125 82 Linux swap /dev/hda3 5350 14593 74252430 5 Extended /dev/hda5 5350 8997 29302528+ 8e Linux LVM /dev/hda6 8998 12645 29302528+ 8e Linux LVM /dev/hda7 12646 14593 15647278+ 8e Linux LVM
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. Syncing disks.
[root@Korea ~]# partprobe -s -d
/dev/hda: msdos partitions 1 2 3
[root@Korea ~]# partprobe -s
/dev/hda: msdos partitions 1 2 3
[root@Korea ~]# ll /dev/hda*
hda hda1 hda2 hda5 hda6 hda7
[root@Korea ~]# fdisk -l
Disk /dev/hda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593
cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 5099 40957686 83 Linux
/dev/hda2 5100 5349 2008125 82 Linux swap
/dev/hda3 5350 14593 74252430 5 Extended
/dev/hda5 5350 8997 29302528+ 8e Linux LVM
/dev/hda6 8998 12645 29302528+ 8e Linux LVM
/dev/hda7 12646 14593 15647278+ 8e Linux LVM
