当前位置:首页 > 数码 >

怎么格式化新加入的硬盘(如何格式化一整个硬盘)

来源:原点资讯(www.yd166.com)时间:2024-04-30 07:57:12作者:YD166手机阅读>>

1.先用Fdisk -l 来查看当前状态下磁盘情况 或 lsblk

[root@linux1 ~]# fdisk -l

Disk /dev/hda: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 13 104391 83 Linux

/dev/hda2 14 652 5132767 8e Linux LVM

Disk /dev/hdb: 2147 MB, 2147483648 bytes

16 heads, 63 sectors/track, 4161 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Disk /dev/hdb doesn't contain a valid partition table

上面红色标识行可以看出,我添加了一块新硬盘/dev/hdb,大小为2G,未分区格式化状态

2.用Fdisk /dev/hdb来进行分区操作

[root@linux1 ~]# fdisk /dev/hdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

The number of cylinders for this disk is set to 4161.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n //输入N表示新建一个分区

Command action

e extended

p primary partition (1-4)

p //p 表示建立一个原始分区

Partition number (1-4): 1 //1 表示此分区编号为1.

First cylinder (1-4161, default 1): 1 //1表示使用默认起始柱面号.如果要分多个区的话,先盘算好要多大,再输入数字

Last cylinder or size or sizeM or sizeK (1-4161, default 4161): // 输入: 回车 表示使用默认结束柱面号.即此分区使用整个硬盘空间

Using default value 4161

Command (m for help): w //保存分区

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

3.再次查看当前分区状态:

[root@linux1 ~]# fdisk -l

Disk /dev/hda: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 13 104391 83 Linux

/dev/hda2 14 652 5132767 8e Linux LVM

Disk /dev/hdb: 2147 MB, 2147483648 bytes

16 heads, 63 sectors/track, 4161 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System

/dev/hdb1 1 4161 2097112 83 Linux

可以看出,已经出来了一个/dev/hdb1的新分区。下一步将其格式化,再使用

4.用mkfs.ext4格式化新分区

[root@linux1 ~]# mkfs.ext4 /dev/hdb1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

262144 inodes, 524278 blocks

26213 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=536870912

16 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912

Writing inode tables: 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.

5.挂载使用。

[root@linux1 ~]# mkdir /mnt/hdb1 //新建一个挂载点。

[root@linux1 ~]# mount -t ext4 /dev/hdb1 /mnt/hdb1 //挂载。

[root@linux1 ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

4.3G 3.6G 487M 89% /

/dev/hda1 99M 12M 82M 13% /boot

tmpfs 125M 0 125M 0% /dev/shm

/dev/hdb1 2.0G 3.0M 1.9G 1% /mnt/hdb1

6 .开机自动挂载

三.设置新硬盘开机自动挂载

#vim /etc/fstab 添加下面一行:

/dev/hdb1 /mnt/hdb1 ext4 defaults 1 2(如果还有一个分区就是1 3,以此类推)

这样,每次开机后,系统会自动将/dev/hdb1挂载到/mnt/hdb1

这里最好使用UUID进行挂载

#ls -l /dev/disk/by-uuid/ 查看该分区的UUID

lrwxrwxrwx. 1 root root 10 May 17 08:42 28cc8f0f-bd42-4ab9-b62a-c24a42cfddcb -> ../../hdb1

lrwxrwxrwx. 1 root root 10 Apr 18 05:42 5c330a93-fdfe-486f-b7a7-52b820fb6213 -> ../../sdb1

lrwxrwxrwx. 1 root root 10 Apr 18 05:41 d5700297-be02-4034-9e76-07aec5581082 -> ../../sda1

复制第一行,然后新增并粘贴刚复制的,修改UUID和最后两个参数改为0

UUID=28cc8f0f-bd42-4ab9-b62a-c24a42cfddcb /mnt/hdb1 ext4 defaults 0 0

,

栏目热文

新硬盘如何格式化(新硬盘怎么格式化使用)

新硬盘如何格式化(新硬盘怎么格式化使用)

第一步:先下载“DiskGenius”软件第二步:打开“DiskGenius”软件第三步:选择新买回来的硬盘第四步:在任...

2024-04-30 07:34:35查看全文 >>

监控硬盘格式化教程(监控硬盘如何用电脑格式化)

监控硬盘格式化教程(监控硬盘如何用电脑格式化)

一、网络摄像机老掉线1、供电不稳2、网络接触不良、网线头没做好二、网络摄像机,卡顿严重摄像机码流过大,交换机、NVR带宽...

2024-04-30 07:57:04查看全文 >>

卖房必问客户十个问题(卖房客户说不需要怎么回答)

卖房必问客户十个问题(卖房客户说不需要怎么回答)

客户十问,没几个房产销售能做到呼市房产一哥!厉害的销售,可能5分钟跟你简单交谈之后,我可能掌握你50%的有效信息。我们有...

2024-04-30 07:35:50查看全文 >>

新手怎么去做销售(新手应该怎么去做销售)

新手怎么去做销售(新手应该怎么去做销售)

商场就像战场,谁输了谁就受伤了。在激烈的竞争环境中,机会转瞬即逝。企业要不断提高员工的综合能力和服务水平,抓住机遇,保持...

2024-04-30 08:02:55查看全文 >>

日本签证办理了没去要紧吗(日本签证三个月没去怎么办)

日本签证办理了没去要紧吗(日本签证三个月没去怎么办)

日本东京浅草寺。图片来源/视觉中国樱花季来临,又一场赴日旅游热潮即将开始。近年来,各大旅游平台的预订数据都显示,日本一直...

2024-04-30 07:47:21查看全文 >>

怎样高级格式化硬盘(硬盘高级格式化步骤)

怎样高级格式化硬盘(硬盘高级格式化步骤)

在使用电脑的过程中,我们经常会遇到需要格式化硬盘的情况。无论是出于清理磁盘空间的目的,还是为了解决硬盘崩溃或数据丢失的问...

2024-04-30 07:52:53查看全文 >>

如何格式化固态硬盘(怎么完全格式化固态硬盘)

如何格式化固态硬盘(怎么完全格式化固态硬盘)

格式化硬盘是一个需要谨慎操作的过程,因为它会删除硬盘上的所有数据,无法恢复。以下是如何格式化硬盘的步骤: 一、备份数据在...

2024-04-30 07:35:02查看全文 >>

欧洲气候最好的国家排名(欧洲哪个国家的气候条件最宜居)

欧洲气候最好的国家排名(欧洲哪个国家的气候条件最宜居)

【欧洲时报清清、李朔编译】随着2024年巴黎奥运会的临近,法国首都再次成为世人瞩目的焦点。据《费加罗报》报道,4月19日...

2024-04-30 08:00:22查看全文 >>

欧洲十大主要国家(欧洲最强大的五个国家)

欧洲十大主要国家(欧洲最强大的五个国家)

欧洲十大强国,这个列表一直是各种讨论和争议的焦点。在这个排名中,德国一直稳坐榜首,其强大的经济实力和政治影响力让人们不得...

2024-04-30 08:02:04查看全文 >>

欧洲所属的国家有哪些(欧洲大部分国家属于什么国家)

欧洲所属的国家有哪些(欧洲大部分国家属于什么国家)

法国国家概况(最近更新时间:2024年1月)【国名】法兰西共和国(The French Republic,La Répu...

2024-04-30 07:37:38查看全文 >>

文档排行