如何在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). # #       /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)所以如何创建目录并添加此HDD

 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 

试试这个:

打开一个终端,

Ctrl + Alt + T.

运行:

 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关闭nano

继续运行:

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

这是所有的了。 您的磁盘应该已安装并可以使用。

请记住按照您的意愿更改/媒体/数据

这取决于你打算如何使用它。 我有一个带有数据分区的额外硬盘驱动器,我保留自己的数据(而不是主目录)。 这使得将系统备份与我自己的数据备份(文档,自己的程序代码,图片,音乐,video剪辑等)分开非常简单。

没有必要在fstab中有这个分区,但我有它,因为它很方便。 它将始终安装(除非我卸载它)。 之前我用Windows双启动,所以我有NTFS文件系统,但现在我有一个ext文件系统,因为几年。 它有一个ext3文件系统,但如果我现在就做,我会使用ext4文件系统。 这是fstab中的对应行:

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

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

/ mnt / data (而不是/ media / multimed-2,我出于历史原因使用它)。

-O-

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

-O-

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