- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章详解linux添加硬盘分区挂载教程由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
基本步骤:分区——格式化——挂载——写入文件 。
1、首先用fdisk -l命令查看添加的硬盘名称,可以看到sdb为新增的硬盘 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
[root@oracle ~]
# fdisk -l
Disk
/dev/sdb
: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors
/track
, 2610 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: 0x00000000
Disk
/dev/sda
: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors
/track
, 2610 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: 0x0006b59c
Device Boot Start End Blocks Id System
/dev/sda1
* 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2
39 2358 18631680 83 Linux
/dev/sda3
2358 2611 2031616 82 Linux swap / Solaris
|
2、进行分区,输入m查看提示 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
[root@oracle ~]
# 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 0x09f38795.
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system
id
u change display
/entry
units
v
verify the partition table
w write table to disk and
exit
x extra functionality (experts only)
|
分析:主要参数的解析 。
1. 输入 m 显示所有命令列示.
2. 输入 p 显示硬盘分割情形,打印分区表.
3. 输入 a 设定硬盘启动区.
4. 输入 n 创建新的硬盘分割区.
4.1. 输入 e 硬盘为[延伸]分割区(extend).
4.2. 输入 p 硬盘为[主要]分割区(primary).
5. 输入 t 改变硬盘分割区属性。 。
6. 输入 d 删除硬盘分割区属性.
7. 输入 q 结束不存入硬盘分割区属性.
8. 输入 w 结束并写入硬盘分割区属性 。
3、输入n创建新的硬盘分区——输入p创建主分区——输入1设置一个分区——回车——回车(默认全部空间) 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Command (m for help): n
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
|
4、输入p查看分区情况——输入w保存退出(一定要w保存不然无效) 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x09f38795
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
|
5、mkfs命令格式化磁盘 。
1
2
3
|
[root@oracle ~]
# mkfs.ext4 /dev/sdb
mkfs.ext4: invalid fragment size -
/dev/sdb
|
6、mount命令挂载分区 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[root@oracle ~]# mount /dev/sdb /oracle/
You have new mail in /var/spool/mail/root
[root@oracle ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 19G 11G 7.3G 60% /
tmpfs tmpfs 2.1G 74k 2.1G 1% /dev/shm
/dev/sda1 ext4 297M 29M 253M 11% /boot
/dev/sdb ext4 22G 47M 20G 1% /oracle
|
7、添加到/etc/fstab文件下保存退出否则重启后硬盘消失 。
1
|
/dev/sdb /oracle ext4 defaults,noatime 0 0
|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我.
原文链接:http://www.cnblogs.com/Dev0ps/p/8807939.html 。
最后此篇关于详解linux添加硬盘分区挂载教程的文章就讲到这里了,如果你想了解更多关于详解linux添加硬盘分区挂载教程的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我正在尝试创建1-click快捷方式,以便在上小学时玩一些90年代的旧游戏。 我正在尝试将ISO挂载到特定驱动器 运行程序 确保已卸载驱动器,以清除下一个要清除的游戏 我是脚本新手,所以我不确定从哪里
我正在运行 docker compose 命令以在 docker 中运行应用程序。但是,yml 中定义的卷是空的。如果我挂载一个文件,它就可以工作。但是,当我从 Windows 挂载目录时,我可以看到
我有一个双向滚动的无限滚动列表。该列表显示每行 5 个项目的网格,表示一周 7 天中的 5 个工作日。日子是按月剥离的斑马线(甚至月份的颜色略深)。我想将月份标题放在网格左侧的一列中,从该月的第一天或
我在按照 qemu/linaro 教程尝试执行 qemu, https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Vir
我正在尝试挂载 cephfs,密码没问题: mount -t ceph ceph-mon:6789:/docker/mnt/cephfs -o name=admin,secret=admin-pass
我可以将 HDFS 目录(在 Ubuntu 中配置)挂载到 Windows 服务器的驱动器吗? 映射后,例如 H:\--->\home\user1\HDFSCreatedDir ,想使用普通的 Jav
我有一个由 500 个 linux 机器组成的集群,现在需要使用带有绑定(bind)选项的挂载资源(参见 man 8 mount)来支持 chroot jail 。安装点需要在引导后强制执行和维护。我
我在一些代码片段和 Requests documentation 中看到过类似的事情。 : import requests sess = requests.Session() adapter = re
嗨,我正在编写一个安装cgroup的应用程序,如下所示 mount("cgroup", "/sys/fs/cgroup", "tmpfs",0,NULL); 我可以执行此操作,但是我想添加一个检查以了
我希望使用 Powershell 获取 VHD 安装的驱动器号。我可以使用以下 cmdlet 挂载 VHD: Mount-VHD -Path d:/tmp.vhdx 安装工作正常,但是当我尝试获取驱动
我正在编写一个脚本来创建坐骑。我使用的系统命令是: sudo /bin/mount -soft -t smbfs -o username='{username}',password='{passwor
我正在尝试在多个用户之间共享 NFS 安装。我无法让它工作,因为我总是被拒绝访问。我可以挂载共享,但看不到文件。 导出是通过Heartbeat+Pacemaker进行的。我认为这没有什么区别,但这是导
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 已关闭 9 年前。 此问题似乎与 a specific programming problem, a sof
我最近全新安装了elementary OS,与Windows 8.1双启动。安装完成后,我编辑了eOS的fstab文件,使其自动在/mnt/Windows地址挂载一个ntfs分区。后来我关闭了笔记本电
我正在尝试在装有 Android 2.1 的模拟器上分析 Android 恶意软件。我想在执行可疑应用程序后分析文件权限和指纹。我知道,我可以使用 adb shell 来获取此信息,但我认为在执行例如
在使用 Webpack 和 Vue 编译项目后,当我打开一个使用 Vue 组件的页面时,我得到: [Vue warn]: Failed to mount component: template or
我正在使用 Linux Inotify 来检测程序上的 FS 事件。 当设备挂载到监控目录时如何通知我? 最佳答案 我不认为你可以用 inotify 来做到这一点。这是方法: 阅读uevents fr
有几篇文章对理解 Docker 的卷和数据管理非常有帮助。这两个尤其出色: http://container-solutions.com/understanding-volumes-docker/ h
我正在使用 mount -o bind /some/directory/here /foo/bar 我想用 bash 脚本检查 /foo/bar,看看它是否已经挂载?如果不是,则调用上面的 mount
我是一名优秀的程序员,十分优秀!