Ubuntu14.04 升级 SSD 产生的疑问

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#31

帖子 poloshiao » 2014-09-03 14:49

所以我只需要把机械硬盘分区中的数据copy到ssd中就可以呀
你使用什麼指令 copy ?
我认为 fsarchiver 只是有一个复制功能的程序。支不支持gpt又有什么关系呢
fsarchiver 的功能遠超過 复制功能 :
http://www.fsarchiver.org/Main_Page
Implemented features
The following features have already been implemented in the current version:
Support for basic file attributes (permissions, ownership, ...)
Support for multiple file-systems per archive
Support for extended attributes (they are used by SELinux)
Support the basic file-system attributes (label, uuid, block-size) for all linux file-systems
Experimental support for ntfs filesystems (ability to create flexible clones of windows partitions)
Checksumming of everything which is written in the archive (headers, data blocks, whole files)
Ability to restore an archive which is corrupt (it will just skip the current file)
Multi-threaded lzo, gzip, bzip2, lzma/xz compression: if you have a dual-core / quad-core it will use all the power of your cpu
Lzma/xz compression (slow but very efficient algorithm) to make your archive smaller.
Support for splitting large archives into several files with a fixed maximum size
Encryption of the archive using a password. Based on blowfish from libgcrypt.
sudo grub-install /dev/sda
Could not find device for /boot: Not found or not a block device.
看提示信息说没有找到/dev/sda的boot分区,
我是不是需要把/dev/sda1 挂载到 /boot呢?
這個問題要知道你是使用什麼指令 copy 才能回答
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#32

帖子 admin_xyz » 2014-09-03 16:34

poloshiao 写了:
所以我只需要把机械硬盘分区中的数据copy到ssd中就可以呀
你使用什麼指令 copy ?
我认为 fsarchiver 只是有一个复制功能的程序。支不支持gpt又有什么关系呢
fsarchiver 的功能遠超過 复制功能 :
http://www.fsarchiver.org/Main_Page
Implemented features
The following features have already been implemented in the current version:
Support for basic file attributes (permissions, ownership, ...)
Support for multiple file-systems per archive
Support for extended attributes (they are used by SELinux)
Support the basic file-system attributes (label, uuid, block-size) for all linux file-systems
Experimental support for ntfs filesystems (ability to create flexible clones of windows partitions)
Checksumming of everything which is written in the archive (headers, data blocks, whole files)
Ability to restore an archive which is corrupt (it will just skip the current file)
Multi-threaded lzo, gzip, bzip2, lzma/xz compression: if you have a dual-core / quad-core it will use all the power of your cpu
Lzma/xz compression (slow but very efficient algorithm) to make your archive smaller.
Support for splitting large archives into several files with a fixed maximum size
Encryption of the archive using a password. Based on blowfish from libgcrypt.
sudo grub-install /dev/sda
Could not find device for /boot: Not found or not a block device.
看提示信息说没有找到/dev/sda的boot分区,
我是不是需要把/dev/sda1 挂载到 /boot呢?
這個問題要知道你是使用什麼指令 copy 才能回答
恩,大神说的对,我现在的问题是

代码: 全选

ubuntu@ubuntu:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic
grep: /boot/config-3.13.0-24-generic: No such file or directory
cryptsetup: WARNING: failed to detect canonical device of overlayfs
cryptsetup: WARNING: could not determine root device from /etc/fstab
ubuntu@ubuntu:~$ 

sudo mount /dev/sda1 /boot
sudo grub-install
sudo update-grub
这3条命令可以执行成功.
sudo update-initramfs -u -k all
这句不行
重启进不去系统。。。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#33

帖子 poloshiao » 2014-09-03 18:41

cryptsetup: WARNING: failed to detect canonical device of overlayfs
cryptsetup: WARNING: could not determine root device from /etc/fstab
你是不是 有加密 哪個分割區 或 目錄 ?
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#34

帖子 admin_xyz » 2014-09-05 9:18

poloshiao 写了:
cryptsetup: WARNING: failed to detect canonical device of overlayfs
cryptsetup: WARNING: could not determine root device from /etc/fstab
你是不是 有加密 哪個分割區 或 目錄 ?

这个真的没有 :em21

我说下我现在的想法。
sda (ssd)
/etc/fstab肯定没问题
安装完grub后,
开机引导提示文件未找到
所以我判断一定是/boot引导的问题
于是我就改了menu.lst但是问题来了...

问题0.
这是menu.lst的一段
但是开机后提示找不到文件... 我的内核文件就是放在/boot的。

133 title Ubuntu 14.04 LTS, kernel 3.13.0-34-g eneric.efi.signed
134 root (hd0,0)
135 kernel /boot/vmlinuz-3.13.0-34-generic.efi.signed root=/root/overlayfs ro quiet splash

代码: 全选

root@ubuntu:/boot# ls
abi-3.13.0-34-generic
config-3.13.0-34-generic
grub
initrd.img-3.13.0-34-generic
lost+found
memtest86+.bin
memtest86+.elf
memtest86+_multiboot.bin
System.map-3.13.0-34-generic
vmlinuz-3.13.0-34-generic
vmlinuz-3.13.0-34-generic.efi.signed


问题1.
我重新安装了grub-install ,boot目录中出现了 vmlinuz-3.13.0-34-generic.efi.signed

在bios里我没有启用EFI呀
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#35

帖子 poloshiao » 2014-09-05 10:41

问题0.
这是menu.lst的一段
menu.lst 是 legacy grub (grub 第一代) 套件 grub 裡的 開機選單
grub.cfg 是 grub 2 (grub 第二代) 套件 grub-pc 裡的 開機選單
grub 第一代 與 grub 第二代 互不相容
Ubuntu 自 9.10 開始 即預裝 grub 2
你為何有 menu.lst
问题1.
sudo dpkg -l | grep linux-image
把結果複製貼上來
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#36

帖子 admin_xyz » 2014-09-05 10:52

poloshiao 写了:
问题0.
这是menu.lst的一段
menu.lst 是 legacy grub (grub 第一代) 套件 grub 裡的 開機選單
grub.cfg 是 grub 2 (grub 第二代) 套件 grub-pc 裡的 開機選單
grub 第一代 與 grub 第二代 互不相容
Ubuntu 自 9.10 開始 即預裝 grub 2
你為何有 menu.lst
问题1.
sudo dpkg -l | grep linux-image
把結果複製貼上來
root@ubuntu:~# sudo dpkg -l | grep linux-image
ii linux-image-3.13.0-24-generic 3.13.0-24.46 amd64 Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii linux-image-extra-3.13.0-24-generic 3.13.0-24.46 amd64 Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii linux-image-generic 3.13.0.24.28 amd64 Generic Linux kernel image
root@ubuntu:~#


u盘启动盘里没有grub
所以我用apt-get install grub 装了一个... 难道默认不是装的grub2啊......
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#37

帖子 poloshiao » 2014-09-05 13:16

補一個
sudo dpkg -l | grep linux-signed-image
u盘启动盘里没有grub
所以我用apt-get install grub 装了一个... 难道默认不是装的grub2啊......
grub 是 第一代 安裝時 會把 grub 2 移除
把 grub 2 安裝回來 試試
sudo apt-get install grub-pc
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#38

帖子 admin_xyz » 2014-09-05 21:33

poloshiao 写了:補一個
sudo dpkg -l | grep linux-signed-image
u盘启动盘里没有grub
所以我用apt-get install grub 装了一个... 难道默认不是装的grub2啊......
grub 是 第一代 安裝時 會把 grub 2 移除
把 grub 2 安裝回來 試試
sudo apt-get install grub-pc

嗯,安装上了。
现在我把 sda2 挂载到/mnt目录,挂载了sda1 sda3 sda4 /dev到/mnt下得对应目录下
然后chroot /mnt
安装grub的时候提示找不到设备节点。。。
我现在真的不知道该怎么办了
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#39

帖子 admin_xyz » 2014-09-05 21:42

代码: 全选

root@ubuntu:/boot# dpkg -l | grep linux-signed-image
ii  linux-signed-image-3.13.0-24-generic                  3.13.0-24.47                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-27-generic                  3.13.0-27.50                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-29-generic                  3.13.0-29.53                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-30-generic                  3.13.0-30.55                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-32-generic                  3.13.0-32.57                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-33-generic                  3.13.0-33.58                                        amd64        Signed kernel image generic
ii  linux-signed-image-3.13.0-34-generic                  3.13.0-34.60                                        amd64        Signed kernel image generic
ii  linux-signed-image-generic                            3.13.0.34.40                                        amd64        Signed Generic Linux kernel image
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#40

帖子 poloshiao » 2014-09-05 21:43

安装grub的时候提示找不到设备节点。。。
還是那一句話
viewtopic.php?p=3103249#p3103249
要知道你是使用什麼指令 copy 才能回答

補充說明
分割區裡面的數據資訊
並不是 只以 檔案型態存在
有些是以 block 型態存在
單純使用 檔案的複製/貼上 指令 會遺漏這部份的數據資訊
分割區的 uuid 等等數據 就是其中之一
這些數據存放在每個分割區的 superblock
问题1.
我重新安装了grub-install ,boot目录中出现了 vmlinuz-3.13.0-34-generic.efi.signed
在bios里我没有启用EFI呀
dpkg -l | grep linux-signed-image
ii linux-signed-image-3.13.0-24-generic 3.13.0-24.47
ii linux-signed-image-3.13.0-27-generic 3.13.0-27.50
ii linux-signed-image-3.13.0-29-generic 3.13.0-29.53
ii linux-signed-image-3.13.0-30-generic 3.13.0-30.55
ii linux-signed-image-3.13.0-32-generic 3.13.0-32.57
ii linux-signed-image-3.13.0-33-generic 3.13.0-33.58
ii linux-signed-image-3.13.0-34-generic 3.13.0-34.60
ii linux-signed-image-generic 3.13.0.34.40
http://packages.ubuntu.com/trusty-updat ... c/filelist
/boot/vmlinuz-3.13.0-34-generic.efi.signed
來自
linux-signed-image-3.13.0-34-generic 3.13.0-34.60
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#41

帖子 admin_xyz » 2014-09-06 11:07

poloshiao 写了:
安装grub的时候提示找不到设备节点。。。
還是那一句話
viewtopic.php?p=3103249#p3103249
要知道你是使用什麼指令 copy 才能回答

補充說明
分割區裡面的數據資訊
並不是 只以 檔案型態存在
有些是以 block 型態存在
單純使用 檔案的複製/貼上 指令 會遺漏這部份的數據資訊
分割區的 uuid 等等數據 就是其中之一
這些數據存放在每個分割區的 superblock
问题1.
我重新安装了grub-install ,boot目录中出现了 vmlinuz-3.13.0-34-generic.efi.signed
在bios里我没有启用EFI呀
dpkg -l | grep linux-signed-image
ii linux-signed-image-3.13.0-24-generic 3.13.0-24.47
ii linux-signed-image-3.13.0-27-generic 3.13.0-27.50
ii linux-signed-image-3.13.0-29-generic 3.13.0-29.53
ii linux-signed-image-3.13.0-30-generic 3.13.0-30.55
ii linux-signed-image-3.13.0-32-generic 3.13.0-32.57
ii linux-signed-image-3.13.0-33-generic 3.13.0-33.58
ii linux-signed-image-3.13.0-34-generic 3.13.0-34.60
ii linux-signed-image-generic 3.13.0.34.40
http://packages.ubuntu.com/trusty-updat ... c/filelist
/boot/vmlinuz-3.13.0-34-generic.efi.signed
來自
linux-signed-image-3.13.0-34-generic 3.13.0-34.60





硬盘及硬盘分区:


sda ==> SSD, GPT
sdb ==> 机械硬盘, GPT
sdc ==> u盘启动盘, MBR

sda1 /boot (迁移后)
sda2 / (迁移后)
sda3 /usr (迁移后)
sda4 /var (迁移后)
sda5 other


sdb1 /boot
sdb2 /
sdb3 /home
sdb4 /usr
sdb5 /var
sdb6 swap

我的两个思路:
1. 用u盘启动盘引导系统, 将sda1 挂载到 /boot, 重新安装grub
2. 用u盘启动盘引导系统, 将sda2挂载到 /mnt,
sda1挂载到/mnt/boot
sda3挂载到/mnt/usr
sda4挂载到/mnt/var
/dev挂载到/mnt/dev
/proc挂载到/mnt/proc
,然后重新安装grub。



命令:


root@ubuntu:~# mount /dev/sda2 /mnt
root@ubuntu:~# mount /dev/sda1 /mnt/boot/
root@ubuntu:~# mount /dev/sda3 /mnt/usr/
root@ubuntu:~# mount /dev/sda4 /mnt/var/
root@ubuntu:~# mount -o bind /dev/ /mnt/dev/
root@ubuntu:~# mount -t proc /proc/ /mnt/proc/
root@ubuntu:~# chroot /mnt
root@ubuntu:/#

问题.
想重新装一个grub-pc
但是却没有网络.
退出后可以ping通


root@ubuntu:/# ping baidu.com
ping: unknown host baidu.com
root@ubuntu:/# exit
exit
root@ubuntu:~# ping baidu.com
PING baidu.com (220.181.111.85) 56(84) bytes of data.
64 bytes from 220.181.111.85: icmp_seq=1 ttl=46 time=66.6 ms
64 bytes from 220.181.111.85: icmp_seq=2 ttl=46 time=145 ms
64 bytes from 220.181.111.85: icmp_seq=3 ttl=46 time=75.3 ms
^C
--- baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2189ms
rtt min/avg/max/mdev = 66.611/95.903/145.722/35.410 ms
root@ubuntu:~#





我的fstab(ssd 中的sda1, 也就是/boot)



1 # /etc/fstab: static file system information.
2 #
3 # Use 'blkid' to print the universally unique identifier for a
4 # device; this may be used with UUID= as a more robust way to name devices
5 # that works even if disks are added and removed. See fstab(5).
6 #
7 # <file system> <mount point> <type> <options> <dump> <pass>
8 # / was on /dev/sda2 during installation
9 UUID=99e72f05-c4a4-46f3-92f3-ee202324257a / ext4 errors=remount-ro 0 1
10 # /boot was on /dev/sda1 during installation
11 UUID=b32ef854-33b1-4f15-ad4e-6d8afa21bc8f /boot ext4 defaults 0 2
12 # /home was on /dev/sda3 during installation
13 UUID=285baa7e-579a-402d-88ac-601d152e75f9 /home ext4 defaults 0 2
14 # /usr was on /dev/sda4 during installation
15 UUID=1a236509-1ef9-4c10-bd33-6576e71ea4ec /usr ext4 defaults 0 2
16 # /var was on /dev/sda5 during installation
17 UUID=52ea6ab8-027d-474f-b6b0-96a0d3fd5104 /var ext4 defaults 0 2
18
19
20 # swap was on /dev/sda6 during installation
21 #UUID=f3e080e0-4cdc-4a48-aa01-75f20fb3595c none swap sw 0 0


ubuntu@ubuntu:~$ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/loop1: UUID="b66db3ec-a98b-0f4b-b31c-352af3ae1f92" TYPE="ext2"
/dev/sda1: UUID="b32ef854-33b1-4f15-ad4e-6d8afa21bc8f" TYPE="ext4"
/dev/sda2: UUID="99e72f05-c4a4-46f3-92f3-ee202324257a" TYPE="ext4"
/dev/sda3: UUID="1a236509-1ef9-4c10-bd33-6576e71ea4ec" TYPE="ext4"
/dev/sda4: UUID="52ea6ab8-027d-474f-b6b0-96a0d3fd5104" TYPE="ext4"
/dev/sda5: UUID="722dfe00-7fd8-4b76-b537-7f42fdc7c5ea" TYPE="ext4"
/dev/sdb1: UUID="b32ef854-33b1-4f15-ad4e-6d8afa21bc8f" TYPE="ext4"
/dev/sdb2: UUID="9d2df340-560a-44b2-bb6e-37d097f97c5a" TYPE="ext4"
/dev/sdb3: UUID="285baa7e-579a-402d-88ac-601d152e75f9" TYPE="ext4"
/dev/sdb4: UUID="d26fdd56-5647-4476-936c-eac6f78bbc99" TYPE="ext4"
/dev/sdb5: UUID="711a65dd-9af6-45c8-a1d0-da1d4e4e1ecd" TYPE="ext4"
/dev/sdb6: UUID="f3e080e0-4cdc-4a48-aa01-75f20fb3595c" TYPE="swap"
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#42

帖子 admin_xyz » 2014-09-06 11:27

a.png
1.png
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#43

帖子 admin_xyz » 2014-09-06 11:33

poloshiao 大大,我要报告一个线索.

用fsarchiver 回存的时候 /boot 并没有提示回存成功, 只有一个错误号16和umount /tmp/...

我去翻下命令啊...

310 fsarchiver -v restfs /mnt/xyz/boot.fsa id=0,dest=/dev/sda1

这是原命令

显示出来的进度也到了%100, 但是没有提示successful.
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: Ubuntu14.04 升级 SSD 产生的疑问

#44

帖子 poloshiao » 2014-09-06 13:02

sda1 /boot (迁移后)
sda2 / (迁移后)
sda3 /usr (迁移后)
sda4 /var (迁移后)
sda5 other
sdb1 /boot
sdb2 /
sdb3 /home
sdb4 /usr
sdb5 /var
sdb6 swap
/home 如何處理 ?
我的两个思路:
... 以下省略
想重新装一个grub-pc
在進行這個程序之前
要先確定
sda1 /boot (迁移后)
sda2 / (迁移后)
sda3 /usr (迁移后)
sda4 /var (迁移后)
以及 /home
已經成功遷移
否則 可能出現失敗訊息而中止
310 fsarchiver -v restfs /mnt/xyz/boot.fsa id=0,dest=/dev/sda1
無論備存或回存
都需要 root 權限
意思是 非 root 使用者
都需加 sudo
備存
sudo fsarchiver -v savefs .... 省略
sudo fsarchiver -v restfs .... 省略
參見
http://apexu.com/apexu/tw/modules/publi ... ?itemid=11
http://apexu.com/apexu/tw/modules/publi ... ?itemid=17
310 fsarchiver -v restfs /mnt/xyz/boot.fsa id=0,dest=/dev/sda1
雖然沒有規定
但是 一次性同時備存所有的分割區 一次性回存所有的分割區
比較省時 而且比較容易成功 相容性較好
參見
http://apexu.com/apexu/tw/modules/publi ... ?itemid=11
http://apexu.com/apexu/tw/modules/publi ... ?itemid=17
头像
admin_xyz
帖子: 199
注册时间: 2012-05-26 8:33
系统: Ubuntu 12.04

Re: Ubuntu14.04 升级 SSD 产生的疑问

#45

帖子 admin_xyz » 2014-09-06 19:48

/home 数据较多,准备就放在机械硬盘中,sdb3.

我执行fsarchiver都是在su 切换到root后执行的命令

不管是一次存储回存,还是一个一个存储回存结果都是那样
回复