Linux empty hard disk from partition to mount

[root@CentOS6 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 0x4ef8fb05.
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 //Create a new partition
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):
Using default value 2610

Command (m for help): w //Save and exit
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@CentOS6 desktop]# mkdir /newpar //Create a mounted folder
[root@CentOS6 desktop]# mkfs.ext4 /dev/sdb1 //ext4 format
mke2fs 1.41.12 (17-May-2010)
filesystem label=
Operating System: Linux
block size=4096 (log=2)
chunk size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
first data block = 0
Maximum filesystem blocks=4294967296
160 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

Writing to inode table: done                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@CentOS6 desktop]# mount /dev/sdb1 /newpar //Mount the partition
[root@CentOS6 desktop]# df -h //View mount status
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6-lv_root
                       50G 3.7G 43G 8% /
tmpfs                 932M  228K  932M   1% /dev/shm
/dev/sda1             477M   40M  412M   9% /boot
/dev/mapper/vg_centos6-lv_home
                       45G   52M   43G   1% /home
/dev/sdb1              20G   44M   19G   1% /newpar

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324435831&siteId=291194637