折雨的天空

博客介绍:本博客当前共有文章【968】篇,总阅读量【5,177,010】次,第一篇博客发表于【2011年04月06日 10时34分】,距今已【4990】天,感谢您的使用!

您的位置:折雨的天空 >其他技术> 国产VPS不能挂在磁盘的一种办法

国产VPS不能挂在磁盘的一种办法

挂载磁盘报错:


No free sectors available


甚至这些主机商后台的步骤都是报这样的错。


解决办法:


原文地址:http://www.c3389.com/post/329.html



复制过来


[root@cloud ~]# df -hal
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/vg_cloud-lv_root
                      7.5G  7.5G     0 100% /
proc                     0     0     0   -  /proc
sysfs                    0     0     0   -  /sys
devpts                   0     0     0   -  /dev/pts
tmpfs                 494M     0  494M   0% /dev/shm
/dev/sda1             485M   33M  427M   8% /boot
none                     0     0     0   -  /proc/sys/fs/binfmt_misc
sunrpc                   0     0     0   -  /var/lib/nfs/rpc_pipefs


[root@cloud wwwroot]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00051f5f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1306     9972736   8e  Linux LVM

Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_cloud-lv_root: 8128 MB, 8128561152 bytes
255 heads, 63 sectors/track, 988 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_cloud-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000




[root@cloud ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklable                                                                      
Building a new DOS disklabel with disk identifier 0x3c59d1a9.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): t
No partition is defined yet!

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527):
Using default value 6527

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@cloud ~]# reboot

======================================================
重启中
======================================================

 
[root@cloud ~]# vgs
  VG       #PV #LV #SN Attr   VSize VFree
  vg_cloud   1   2   0 wz--n- 9.51g    0

[root@cloud ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

[root@cloud ~]# vgextend vg_cloud /dev/sdb1
  Volume group "vg_cloud" successfully extended

[root@cloud ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_cloud
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               59.50 GiB
  PE Size               4.00 MiB
  Total PE              15233
  Alloc PE / Size       2434 / 9.51 GiB
  Free  PE / Size       12799 / 50.00 GiB
  VG UUID               I5k6GO-mjni-7dO0-O4TF-RUxH-RNcI-bnWFY3



[root@cloud ~]# lvresize -L +49.900G /dev/vg_cloud/lv_root

  Rounding size to boundary between physical extents: 49.90 GiB
  Extending logical volume lv_root to 57.47 GiB
  Logical volume lv_root successfully resized



[root@cloud ~]# resize2fs /dev/vg_cloud/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_cloud/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/vg_cloud/lv_root to 15066112 (4k) blocks.
The filesystem on /dev/vg_cloud/lv_root is now 15066112 blocks long.

 

[root@cloud ~]# df -hal
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/vg_cloud-lv_root
                       57G  7.5G   47G  14% /
proc                     0     0     0   -  /proc
sysfs                    0     0     0   -  /sys
devpts                   0     0     0   -  /dev/pts
tmpfs                 494M     0  494M   0% /dev/shm
/dev/sda1             485M   33M  427M   8% /boot
none                     0     0     0   -  /proc/sys/fs/binfmt_misc
sunrpc                   0     0     0   -  /var/lib/nfs/rpc_pipefs

 
======================================================
扩展成功
======================================================

这里面的每一步都只需要复制命令就好了,磁盘大小都是一样的。

------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------

转载请注明本文标题和链接:《国产VPS不能挂在磁盘的一种办法

奖励一下

取消

分享不易,烦请有多多打赏,如您也困难,点击右边关闭即可!

扫码支持
扫码打赏,5元,10元,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

-秒后自动关闭,如已打赏,或者不愿打赏,请点击右上角关闭图标。

发表评论

路人甲 表情
看不清楚?点图切换