如何在 ubuntu 16.04 中添加新硬盘

如何在 ubuntu 16.04 中添加新硬盘

如何为我的 Ubuntu 16.04 添加第二块硬盘

这是我的 FSTAB

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/wagedata--vg-root /   ext4    errors=remount-ro 0      1

# /boot was on /dev/sdb2 during installation
UUID=2fabd94d-0e1c-4f78-bed5-64fc35b711ea /boot   ext2   defaults   0   2

# /boot/efi was on /dev/sdb1 during installation
UUID=BC1B-47F9  /boot/efi       vfat    umask=0077    0      1
/dev/mapper/wagedata--vg-swap_1 none   swap    sw     0      0

当我运行时 sudo blkid,我看到下面的代码

root@wagedata:/home/rabbani# sudo blkid
/dev/sdb1: UUID="BC1B-47F9" TYPE="vfat" PARTUUID="3e2c33a8-6b21-421c-88ae-c02b45832f25"
/dev/sdb2: UUID="2fabd94d-0e1c-4f78-bed5-64fc35b711ea" TYPE="ext2" PARTUUID="1791ed17-9592-491f-98d7-59200354e0d7"
/dev/sdb3: UUID="94LT0V-Wrye-Rl9A-QLnr-uYT9-ngoF-Ae92vU" TYPE="LVM2_member" PARTUUID="58282528-5179-4157-a789-e5b63e23d94d"
/dev/mapper/wagedata--vg-root: UUID="dc8296fa-0527-4c17-acc6-14e38472acab" TYPE="ext4"
/dev/mapper/wagedata--vg-swap_1: UUID="9175a4d8-8fe5-4ef2-803e-e7648dd40898" TYPE="swap"
/dev/sda: PTUUID="514c954f" PTTYPE="dos"

/dev/sda: PTUUID="514c954f" PTTYPE="dos"可能是我的新硬盘

结果如下fdisk -l

root@wagedata:/home/rabbani# sudo fdisk -l
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x514c954f

Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 424B06DE-0537-4C74-9BEB-AC001CEFD96F

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1050623   1048576   512M EFI System
/dev/sdb2  1050624   2050047    999424   488M Linux filesystem
/dev/sdb3  2050048 976771071 974721024 464.8G Linux LVM

Disk /dev/mapper/wagedata--vg-root: 85.2 GiB, 91486158848 bytes, 178683904 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/wagedata--vg-swap_1: 7.9 GiB, 8510242816 bytes, 16621568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

我的新磁盘是(1TB),那么如何创建目录并添加此硬盘

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x514c954f

答案1

这取决于你打算如何使用它。我有一个额外的硬盘驱动器,数据分区,我将自己的数据保存在此分区(而不是主目录中)。这样可以非常直接地将系统备份与我自己的数据(文档、自己的程序代码、图片、音乐、视频剪辑等)备份分开。

这个分区不必放在 fstab 中,但我把它放在了那里,因为这样很方便。它将始终被挂载(除非我卸载它)。以前我使用 Windows 双启动,所以我有 NTFS 文件系统,但现在我几年前就有一个 ext 文件系统。它有一个 ext3 文件系统,但如果我现在要创建它,我会使用ext4文件系统。这是 fstab 中的相应行:

UUID=d3f3e5a3-3deb-4e43-8e1a-c2f0de792f90 /media/multimed-2     ext3    defaults 0       2

人们建议在 /mnt 目录中创建一个挂载点,例如

/mnt/数据(而不是 /media/multimed-2,我因为历史原因使用它)。

-o-

使用第二个驱动器的另一种常见方式是创建分区,将您的主目录的内容复制(移动)到其中并将其挂载为 /home(在 fstab 中)。

-o-

编辑:我建议你使用分区创建一个或多个具有合适文件系统的分区。

答案2

尝试这个:

打开终端,

Ctrl++AltT

运行:

exec sudo -i
apt-get update
apt-get dist-upgrade
apt-get install --reinstall gparted

在 gparted 中选择驱动器Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors

创建一个新的 msdos 分区表。

在未分配的空间中,创建一个 ext4 文件系统分区。

应用更改并关闭 gparted 以继续运行:

blkid /dev/sda1

此命令将给出类似如下的输出:

/dev/sda1: UUID="1532e85b-0337-412d-9644-ef6ad282efdb" TYPE="ext4" PARTUUID="ab6eab6e-01"

记下 UUID,然后继续运行:

mkdir /media/data  *--- Change this directory as you wish*
nano etc/fstab

在打开的文件中添加以下行:

# /media/data was on /dev/sda1
UUID=1532e85b-0337-412d-9644-ef6ad282efdb /boot           ext4    defaults        0       2

Ctrl+O保存文件

Ctrl+X关闭纳米

继续运行:

mount -a
chmod -Rf 777 /media/data
exit

就这样。您的磁盘应该已安装并可供使用。

记得根据需要更改/media/data

相关内容