[ubuntu] 外挂硬盘
1. 查看磁盘信息
fdisk -l
这里我需要对sda进行分区,所以要进到sda中
2. 进到欲分区磁盘中
$ sudo fdisk /dev/sda Welcome to fdisk (util-linux 2.27.).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
3. 按照提示查看信息:
Command (m for help): m Help: DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition Misc
m print this menu
u change display/entry units
x extra functionality (experts only) Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file Save & Exit
w write table to disk and exit
q quit without saving changes Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table Command (m for help): p
Disk /dev/sda: 238.5 GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0x3370b165 Device Boot Start End Sectors Size Id Type
/dev/sda1 * 100G HPFS/NTFS/exFAT
4. 分区
可以看到,在我的sda中,4096到209723391部分已经分给了sda1,剩余空间可以进行分区,剩余空间的起止:209723392到500118191.
Command (m for help): n
Partition type
p primary ( primary, extended, free)
e extended (container for logical partitions)
Select (default p): e
Partition number (-, default ):
First sector (-, default ):
Last sector, +sectors or +size{K,M,G,T,P} (-, default ): Created a new partition of type 'Extended' and of size 138.5 GiB.
5. 分区完成,查看分区情况
Command (m for help): p
Disk /dev/sda: 238.5 GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0x3370b165 Device Boot Start End Sectors Size Id Type
/dev/sda1 * 100G HPFS/NTFS/exFAT
/dev/sda2 .5G Extended
6. 保存退出
注意,以上部分是更新的分区表,并未真正进行物理的分区,需要 键入 “w” 保存退出后才正式生效。
7. 修改格式为 ext4:
报错:
$ sudo mkfs -t ext4 /dev/sda2
mke2fs 1.42. (-May-)
Found a dos partition table in /dev/sda2
Proceed anyway? (y,n) y
mkfs.ext4: inode_size () * inodes_count () too big for a
filesystem with blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
原因:原类型为extend,需要改为Linux。
change type:
$ sudo fdisk /dev/sda Welcome to fdisk (util-linux 2.27.).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): p
Disk /dev/sda: 238.5 GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0x3370b165 Device Boot Start End Sectors Size Id Type
/dev/sda1 * 100G HPFS/NTFS/exFAT
/dev/sda2 .5G Extended Command (m for help): t
Partition number (,, default ):
Partition type (type L to list all types): Changed type of partition 'Extended' to 'Linux'. Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
之后可以格式化为 ext4
$ sudo mkfs -t ext4 /dev/sda2
mke2fs 1.42. (-May-)
Found a dos partition table in /dev/sda2
Proceed anyway? (y,n) y
Discarding device blocks: done
Creating filesystem with 4k blocks and inodes
Filesystem UUID: bc630198-ae61-45af-a0c2-75e8e97cb5bd
Superblock backups stored on blocks:
, , , , , , , , ,
, , , , Allocating group tables: done
Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information: done
8. 检查新文件系统
$ sudo fsck -f /dev/sda2
fsck from util-linux 2.27.
e2fsck 1.42. (-May-)
Pass : Checking inodes, blocks, and sizes
Pass : Checking directory structure
Pass : Checking directory connectivity
Pass : Checking reference counts
Pass : Checking group summary information
/dev/sda2: / files (0.0% non-contiguous), / blocks
9. 挂载
自己可以新建一个文件作为挂载点,我在自己的home下 mkdir了new这个文件夹,将这块分区挂载在这里。
$sudo mount /dev/sda2 /home/lsy/new
如果觉得挂载错了,想重新挂载,可以用
$ umount /dev/sda2
之后再用之前的mount命令重新挂载即可。虽然挂载点变了,但是sda2中已经保存的内容不会改变的。
[ubuntu] 外挂硬盘的更多相关文章
- 在win7下装ubuntu(硬盘版安装)及遇到的问题
都怪自己弄什么Ubuntu下的Android Studio,因为GFW,gradle总下载不了,用命令行下载一半关机了,然后Ubuntu就这样被我搞残废了.又张罗着重装. 其实就是参照网上的帖子,算是 ...
- Ubuntu更换硬盘
0x00 背景: 目前ubuntu用的是一个80g的硬盘( 一开始没买硬盘,直接拆了一个老老老老的机子来用),系统16.04, 只有一个/分区 ( /dev/sdb1 ) . 新的硬盘是一块256G的 ...
- 增加虚拟机ubuntu的硬盘
20150526更新验证日记: (1)首先在虚拟机中增加ubuntu的硬盘大小. (2)在ubuntu中使用Gparted软件对新的空间进行分配(傻瓜式) (3)不能直接将磁盘挂载到home下,只能先 ...
- Ubuntu挂载硬盘,修改卷标
Ubuntu挂载硬盘,修改卷标转载2016-03-06 17:03:21标签:ubuntu Ubuntu不像windows,硬盘插入电脑不会自动读取硬盘 数据,需要把硬盘挂载到文件夹上,然后才能访问硬 ...
- 扩大ubuntu虚拟机硬盘空间
一.背景: 出于测试的需要,在ubuntu 14.04系统中通过virtualbox虚拟机安装了额ubuntu 14.04系统(guest os).安装过程采用ubuntu 14.04的默认分区方法. ...
- Ubuntu 固态硬盘 4K对齐及启用 Trim,及其验证方法
因为之前一个移动硬盘因为坏道蔓延导致没办法继续使用,我略冲动地跑去买了一块 120GB 的三星840 固态硬盘回来.为了使用起来更方便,还去弄了个光驱位硬盘托架,把固态硬盘接在了光驱位与原本的笔记本硬 ...
- 怎样在win7下装ubuntu(硬盘版安装)
1)首先还是分区,在计算机上右键--管理--磁盘管理 装Ubuntu分配的硬盘大小最好是(20G以上)不要太小,这里请注意,ubuntu和windows文件系统全然不同,所以我们划好要给ubuntu的 ...
- Debian/Ubuntu清理硬盘空间的8个技巧
1. 删除残余的配置文件 通常Debian/Ubuntu删除软件包可以用两条命令 sudo apt-get remove <package-name> sudo apt-get purge ...
- VirtualBox如何扩展虚拟机Ubuntu的硬盘容量-转
https://blog.csdn.net/ouyang_peng/article/details/53261599 摘录要点: 扩展 VBoxManage modifyhd YOUR_HARD_DI ...
随机推荐
- SSM(Spring+SpringMVC+MyBatis)高并发优化思路
SSM(Spring+SpringMVC+MyBatis)框架集由Spring.MyBatis两个开源框架整合而成(SpringMVC是Spring中的部分内容).常作为数据源较简单的web项目的框架 ...
- thymeleaf 模板使用 之 解决因HTML标签未闭合引起的错误
一.修改thymeleaf属性配置 spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring ...
- Spring 配置文件注入
一.Spring配置文件注入 package com.zxguan.demo; public class Person { private String name; private int age; ...
- 如何配置数据库镜像<一>
一.简介 “数据库镜像”是Sql Server 2005推出的一个主要用于提高数据库可用率的软件解决方案.镜像是基于每个数据库执行的,仅适用于使用完整恢复模式的数据库.简单恢复模式和大容量日志恢复模式 ...
- C#:Guid.NewGuid()和DateTime.Now该选择哪个???
直接上代码: namespace ConsoleApp1 { class Program { static void Main(string[] args) { Console.WriteLine(& ...
- mac下JDK的安装路径
苹果系统已经包含完整的J2SE,其中就有JDK和JVM(苹果叫VM).当然如果要升级JDK,那当然要自己下载安装了. 在MAC系统中,jdk的安装路径与windows不同,默认目录是:/System/ ...
- 入坑django2
数据模型 关于时间的字段设置 add_date = models.DateTimeField('保存日期',default = timezone.now) mod_date = models.Date ...
- NLP/CL 顶会收录
全文转载自知乎@刘知远老师:初学者如何查阅自然语言处理学术资料(2016修订版). 1. 国际学术组织.学术会议与学术论文 自然语言处理(natural language processing,NLP ...
- java虚拟机的基本结构如图
1 java虚拟机的基本结构如图: 1)类加载子系统负责从文件系统或者网络中加载Class信息,加载的类信息存放于一块称为方法区的内存空间.除了类的信息外,方法区中可能还会存放运行时常量池信息,包括字 ...
- maven项目pom.xml中parent标签的使用(转)
原文地址:https://blog.csdn.net/qq_41254677/article/details/81011681 使用maven是为了更好的帮项目管理包依赖,maven的核心就是pom. ...