linux 硬盘初始化

0 阅读2分钟

root@bh:opt> fdisk -l |grep Disk |grep "/dev/"

Disk /dev/vda: 21.5 GB, 21474836480 bytes

Disk /dev/vdb: 107.4 GB, 107374182400 bytes

root@bh:opt> fdisk /dev/vdb

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): 1

First cylinder (1-208050, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-208050, default 208050):

Using default value 208050

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

root@bh:opt> mkfs.ext4 /dev/vdb1

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

6553600 inodes, 26214292 blocks

1310714 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

800 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, 1605632, 2654208,

    4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

root@bh:opt> mkdir -p /data

root@bh:opt> mount /dev/vdb1 /data/

sed -i 's/vda1 //vda1\t\t\t\t//' /etc/fstab

sed -i '/vda1/ a\/dev/vdb1\t\t\t\t/data\t\t\t\t\text4\tdefaults\t\t1 1' /etc/fstab

rm lost+found/ -fr ————————————————

                        版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                    

原文链接:blog.csdn.net/qq_24700495…