环境:
模拟新加一块磁盘,并分区,挂载,永久挂载,然后写入数据,然后对分区扩容,测试扩容后分区里面的内容是否丢失。
查看所有分区:
[root@backup
~]#fdisk
-l
Disk
/dev/sda: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541
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: 0x00040b96
Device Boot Start End Blocks Id System
/dev/sda1
* 1 26 204800 83 Linux
Partition
1 does not end on cylinder boundary.
/dev/sda2
26 1070 8388608 82 Linux swap / Solaris
/dev/sda3
1070 13055 96263168 83 Linux
Disk
/dev/sdb: 1073.7 GB, 1073741824000 bytes
255
heads, 63 sectors/track, 130541 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: 0x00000000
开始分区:
[root@backup
~]#fdisk
/dev/sdb
Device
contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel with disk identifier 0xc6e44e94.
Changes
will remain in memory only, until you decide to write them.
After
that, of course, the previous content won't be recoverable.
Warning:
invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING:
DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command
(m for help): p
#p是打印当前磁盘所有分区Disk /dev/sdb: 1073.7 GB, 1073741824000 bytes
255
heads, 63 sectors/track, 130541 cylinders
Units
= cylinders of 16065 * 512 = 8225280 bytes
Sector
size (logical/physical): 512 bytes / 512 bytes
I/O
size (minimum/optimal): 512 bytes / 512 by