我正在使用一个新硬盘(非 SSD,普通旧硬盘),它已经是 ext4 格式,并按照以下步骤安装在 /media/mynewdrive 上。文章
但我想将其安装在 /opt 上,因为大多数软件都安装在那里。目前我需要手动将内容移动到 /media/mynewdrive 及其下方...位置不太方便记住....我该怎么办?我的旧驱动器中已经有 /opt 和子目录,我想保留它们。这是我当前的 mount 命令输出:
root@ashu-700-430qe:/home/ashu# mount
/dev/sda7 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sdb3 on /media/mynewdrive type ext4 (rw)
/dev/sda2 on /boot/efi type vfat (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=ashu)
/dev/sr0 on /media/ashu/CD0001 type iso9660 (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
root@ashu-700-430qe:/home/ashu#
它是 Windows 10 的双启动系统,我不想影响任何其他东西。
root@ashu-700-430qe:/home/ashu# blkid
/dev/sda1: LABEL="Windows RE tools" UUID="10E664BBE664A2A8" TYPE="ntfs"
/dev/sda2: LABEL="SYSTEM" UUID="E467-1A3B" TYPE="vfat"
/dev/sda4: LABEL="Windows" UUID="C0726845726841F0" TYPE="ntfs"
/dev/sda5: UUID="CC8C4A768C4A5ADA" TYPE="ntfs"
/dev/sda6: UUID="74a0518b-2eed-404a-aaa1-a302dbf9f18c" TYPE="swap"
/dev/sda7: UUID="54458154-6f44-44c9-be44-f91d093d63e6" TYPE="ext4"
/dev/sda8: LABEL="Recovery Image" UUID="90686954686939DC" TYPE="ntfs"
/dev/sdb2: LABEL="Windows_F" UUID="380C233F0C22F790" TYPE="ntfs"
/dev/sdb3: UUID="f44ccbce-3388-475e-9d41-5228b388f282" TYPE="ext4"
/dev/sr0: LABEL="CD0001" TYPE="iso9660"
root@ashu-700-430qe:/home/ashu# cat /etc/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>
# / was on /dev/sda7 during installation
UUID=54458154-6f44-44c9-be44-f91d093d63e6 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=E467-1A3B /boot/efi vfat defaults 0 1
# swap was on /dev/sda6 during installation
UUID=74a0518b-2eed-404a-aaa1-a302dbf9f18c none swap sw 0 0
/dev/sdb3 /media/mynewdrive ext4 defaults 0 2
(rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
答案1
在与我认识的一些 Linux 专家交谈后,我发现了一些可能的选择:
- 我可以使用 LVM,它允许将新的物理磁盘和物理卷(分区)添加到逻辑卷(已挂载的分区),现有的逻辑卷(比如
/opt
)可以使用新物理卷提供的额外空间进行扩展。 - 另一个选择是我的
/
和/media/mynewdrive
都是类型ext4
我可以将所有内容复制到新分区(安装为的分区/media/mynewdrive
),然后将其安装为/opt
寻找一些选项并将选择最能满足我需求的选项。