添加新磁盘5G /dev/sdb
[root@localhost:~/Desktop] # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
20G 3.8G 15G 21% /
tmpfs 1000M 100K 1000M 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/sr0 3.2G 3.2G 0 100% /mnt
[root@localhost:~/Desktop] # ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sdb
[root@localhost:~/Desktop] # 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 0xa2a51c3e.
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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost:~/Desktop] # partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@localhost:~/Desktop] # mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1309289 blocks
65464 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost:~/Desktop] # blkid
/dev/sda1: UUID="7ecaf3b6-0c3d-4513-9a4f-53985a29c3ce" TYPE="ext4"
/dev/sda2: UUID="s0rAen-envt-EC8c-1gLS-DHRE-k0LF-GmIBPM" TYPE="LVM2_member"
/dev/mapper/vg_test01-lv_root: UUID="9945e0de-553b-44d8-bc62-9ed34cab635d" TYPE="ext4"
/dev/mapper/vg_test01-lv_swap: UUID="5abfcee6-754b-4901-a05b-429cda74960e" TYPE="swap"
/dev/sda4: UUID="aae08456-9cb2-4a36-b384-8bc711925116" TYPE="ext4"
/dev/sda3: UUID="m4ZUS4-ZqIm-ldlW-O7lM-1N2z-E6OT-rkCdCk" TYPE="LVM2_member"
/dev/sdb1: UUID="c1f1f8b7-89f7-4732-b589-abfe3380950b" TYPE="ext4" //格式化后的文件系统
[root@localhost:~/Desktop] # vim /etc/fstab
UUID="c1f1f8b7-89f7-4732-b589-abfe3380950b" /mnt ext4 defaults 0 0
//测试并设置开机自动挂载
[root@localhost:~/Desktop] # mount -a
对比
[root@localhost:~/Desktop] # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
20G 3.8G 15G 21% /
tmpfs 1000M 100K 1000M 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/sr0 3.2G 3.2G 0 100% /mnt
[root@localhost:~/Desktop] # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
20G 3.8G 15G 21% /
tmpfs 1000M 260K 1000M 1% /dev/shm
/dev/sda1 485M 30M 430M 7% /boot
/dev/sr0 5.0G 138M 4.6G 3% /mnt
/dev/sdb1 5.0G 138M 4.6G 3% /mnt
不用时umount /mnt