我正在使用 Ubuntu 14.04 双启动 Windows 10。我有一个硬盘,现在我又加了一个。我为 Ubuntu 分配了大约 840GB。过去,我能够将此驱动器安装到
/media/mynewdrive
但现在我的需求发生了变化。我需要在第一个驱动器 (sda) 中留出更多空间,并希望为 /usr、/var、/opt 和 /tmp 创建单独的分区。我有几个问题:
- 我想在 /dev/sdb3 中创建物理卷和卷组。在此之前,我需要挂载它,但我收到错误消息,提示 /dev/sdb3 无法挂载,因为它很忙。我找到正在运行的进程,然后终止它们。一个卷组对我来说足够了,然后在该逻辑卷中我想放置 - /usr、/opt、/var 和 /tmp
- 当我创建它们时,由于 /usr 已经存在于 / 中,会发生什么?我想我需要将所有 /usr 内容移动到一个新的(逻辑卷的 /usr)中,对吗?
以下是一些附加信息。这是 /dev/sdb 驱动器, 和这是 /dev/sda 驱动器。
我的 LVM 用户界面没什么用,但是这里无论如何都是。我看到的大多数帖子都是关于人们在安装时使用 LVM,而不是在安装后使用 LVM,这对我没有帮助。在这网站。我在这方面取得了一些成功,但并不是我想要的 100% 成功。我想搬出去:
/home 11G
/opt 9G
/usr 7G
/var 3G
/tmp 1.1G
到我的第二块硬盘,这样我的 Ubuntu 将来就可以毫无问题地发展。我以前从未使用过 LVM,所以我从这些来源学到了:
我面临的问题是,许多人在安装时使用了 LVM,但后来没有使用,我的情况就是如此。我按照以下步骤执行:
1st- 在 /dev/sdb3 上创建物理卷
2nd- 卷组 3rd- 逻辑卷 (home, var, opt, usr 和 tmp)
然后我执行:
mkfs -t ext4 /dev/vgall/opt
cp -r -R /opt/* /temp-opt
mount -t ext4 /dev/vgall/opt /temp-opt
然后我在 /etc/fstab 中输入以下内容:
#this is volume-opt
UUID=b3d302be-68f6-4804-abb1-ab806326b5a4 /opt ext4 defaults 0 2
之后我重启了。我的 /etc/fstab 是这样的:(在 LVM 更改之前)
# /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)
后来就变成这样了:
# /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/vgall/tmp /tmp ext4 defaults 0 2
#this is volume-opt
UUID=b3d302be-68f6-4804-abb1-ab806326b5a4 /opt ext4 defaults 0 2
#/dev/mapper/vgall-var
#UUID=35d84c0b-d29b-4677-bc0f-26ef945d1ebf /var ext4 defaults 0 1
#/dev/mapper/vgall-usr
#UUID=e67910d0-09c9-4249-ba20-c4e471b30e63 /usr ext4 defaults 0 2
#/dev/vgall/home
#UUID=5d610ba0-5ed4-4d08-99dd-946fed50ddd0 /home ext4 defaults 0 2
我一次尝试了一个 LV (/opt),但对我来说,只有 /opt 可以使用 LVM。其他的 (home、tmp、usr 和 var) 对我来说都无法工作,我不知道为什么。对于其他的 (home、tmp、usr 和 var),要么我无法登录 (登录循环),要么我的侧边栏消失了,Ubuntu 崩溃了。其他的无法工作的原因可能是什么?我还点击了以下链接:
这是 lvdisplay 命令的输出:
root@ashu-700-430qe:/home/ashu# lvdisplay
--- Logical volume ---
LV Path /dev/vgall/tmp
LV Name tmp
VG Name vgall
LV UUID gXLwJk-afuW-PXd3-c32p-IhnF-mlpm-zj8WrZ
LV Write Access read/write
LV Creation host, time ashu-700-430qe, 2016-02-05 19:56:26 -0700
LV Status available
# open 0
LV Size 60.00 GiB
Current LE 15360
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/vgall/var
LV Name var
VG Name vgall
LV UUID iifcKK-2wmd-2XIy-wPOj-cwot-yltu-xtyPP3
LV Write Access read/write
LV Creation host, time ashu-700-430qe, 2016-02-05 19:57:50 -0700
LV Status available
# open 0
LV Size 150.00 GiB
Current LE 38400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
--- Logical volume ---
LV Path /dev/vgall/usr
LV Name usr
VG Name vgall
LV UUID BDJfs6-beZl-aXjU-YbgC-loep-cJHw-Nn624e
LV Write Access read/write
LV Creation host, time ashu-700-430qe, 2016-02-05 20:02:11 -0700
LV Status available
# open 0
LV Size 210.00 GiB
Current LE 53760
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Logical volume ---
LV Path /dev/vgall/opt
LV Name opt
VG Name vgall
LV UUID K2Nq7v-sleg-ZUeN-vjyf-uuOh-NRjk-ezGydd
LV Write Access read/write
LV Creation host, time ashu-700-430qe, 2016-02-05 20:02:26 -0700
LV Status available
# open 1
LV Size 210.27 GiB
Current LE 53828
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3
--- Logical volume ---
LV Path /dev/vgall/home
LV Name home
VG Name vgall
LV UUID Egm5cB-9k2N-LTw4-xyav-nl24-ed3K-ay5yOD
LV Write Access read/write
LV Creation host, time ashu-700-430qe, 2016-02-05 20:08:07 -0700
LV Status available
# open 0
LV Size 211.00 GiB
Current LE 54016
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:4
root@ashu-700-430qe:/home/ashu#
以下是 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/mapper/vgall-opt on /opt 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)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
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)
我最终也在 /etc/fstab 中尝试了这种组合:
/dev/mapper/vgall-home /home ext4 defaults 0 2
然后我就跑了
sudo update-initramfs -u
为了使设备映射在启动期间可用,但没有修复...只有 /opt 工作正常,但其他都不能。我应该如何解决这个问题。