[root@localhost ~]# fdisk /dev/sda
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): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (13119-15665, default 13119):
Using default value 13119
Last cylinder, +cylinders or +size{K,M,G} (13119-15665, default 15665): +10G
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.
[root@localhost ~]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x0008d864
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 13119 104857600 8e Linux LVM
/dev/sda3 13119 15665 20458488+ 5 Extended
/dev/sda5 13119 14424 10490124+ 83 Linux
[root@localhost ~]# partx -a /dev/sda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@localhost ~]# partx -a /dev/sda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
BLKPG: Device or resource busy
error adding partition 5
[root@localhost ~]# cat /proc/partitions
major minor #blocks name
8 0 125829120 sda
8 1 512000 sda1
8 2 104857600 sda2
8 3 31 sda3
8 5 10490124 sda5
253 0 52428800 dm-0
253 1 4194304 dm-1
253 2 48230400 dm-2
[root@localhost ~]# mke2fs -t ext4 -b 2048 -m 20 -L MYDATA /dev/sda5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=MYDATA
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
657408 inodes, 5245062 blocks
1049012 blocks (20.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=543162368
321 block groups
16384 blocks per group, 16384 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104,
2048000, 3981312
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# blkid /dev/sda5
/dev/sda5: LABEL="MYDATA" UUID="20620667-1182-4321-80a8-de671e2f5534" TYPE="ext4"
2)挂载至/mydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳。
[root@localhost ~]# mount -o noatime,noexec /dev/sda5 /mydata