今天上了个Oracle存储数据备份还原挂载存储新硬盘,装完系统后让机房技术把旧硬盘挂上去,我们这边远程操作拷贝数据到新的硬盘上面,在mount /dev/sda2 /mnt的时候,提示“mount: /dev/sda2 already mounted or /mnt busy ” 查证/dev/sda2没有被挂载/mnt也没有在使用
#fdisk -l /dev/sda
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38913 312464250 8e Linux LVM
是lvm分区,这种不能直接被挂载。
正确挂载流程:
#fdisk -lu /dev/sda
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 63 208844 104391 83 Linux
/dev/sda2 208845 625137344 312464250 8e Linux LVM
//从上看出lvm分区起始于208845扇区,把这个地址处的分区mount为loop设备:
#losetup -f -o $[208845*512] /dev/sda2
#losetup -a
/dev/loop0: [0011]:1050 (/dev/sda2), offset 106928640
# lvm pvscan //扫描lvm volumns:
PV /dev/sda2 VG VolGroup00 lvm2 [297.97 GB / 0 free]
Total: 1 [297.97 GB] / in use: 1 [297.97 GB] / in no VG: 0 [0 ]
# lvm vgchange -ay //激活lvm volumn
2 logical volume(s) in volume group "VolGroup00" now active
# ls /dev/mapper/ //查看激活后的分区名称
control VolGroup00-LogVol00 VolGroup00-LogVol01
# lvm lvs 查看大小
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-a- 296.03G
LogVol01 VolGroup00 -wi-a- 1.94G
# mount /dev/mapper/VolGroup00-LogVol00 /mnt
这样就挂载上去了