Linux

如何使用預裝 Linux 上的所有磁碟空間

  • October 8, 2013

我訂購了預裝了“Paralles Plesk Panel”的 Linux Debian Wheezy 專用伺服器。提供商說我有 2x1TB 驅動器。

然而我的可用磁碟空間只有 100GB。我缺少分區嗎?我不知道如何解釋df -k只有 69 GB 用作du -ch /節目的 79% 的使用率。

我有所有可用空間嗎?如果沒有怎麼設置?

$ sudo parted -l
Model: ATA ST1000NM0011 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
1      1049kB  100GB  100GB  primary  ext3         boot


Error: /dev/sdb: unrecognised disk label 

$ sudo fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
34 heads, 38 sectors/track, 1512016 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00091ca1

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   195352516    97675234+  83  Linux

$ sudo df -k
Filesystem                                             1K-blocks     Used Available Use% Mounted on
rootfs                                                  96141036 71813500  19443776  79% /
udev                                                       10240        0     10240   0% /dev
tmpfs                                                    1644412      184   1644228   1% /run
/dev/disk/by-uuid/2b0af891-91af-448e-a5d3-8cba9de4ce5d  96141036 71813500  19443776  79% /
tmpfs                                                       5120        0      5120   0% /run/lock
tmpfs

$ sudo du -ch / | grep total
69G     total

您只需要使用磁碟上的剩餘空間創建新分區。如果您正在執行raid,那麼您需要創建一對完全相同大小的分區並將它們添加到raid。這是選項列表fdisk(8)

$ sudo fdisk /dev/sda

Command (m for help): m
Command action
  a   toggle a bootable flag
  b   edit bsd disklabel
  c   toggle the dos compatibility flag
  d   delete a partition
  l   list known partition types
  m   print this menu
  n   add a new partition
  o   create a new empty DOS partition table
  p   print the partition table
  q   quit without saving changes
  s   create a new empty Sun disklabel
  t   change a partition's system id
  u   change display/entry units
  v   verify the partition table
  w   write table to disk and exit
  x   extra functionality (experts only)

使用n-action 創建一個新分區並按照螢幕上的說明進行操作。如果您只想使用剩餘空間創建一個分區,則預設值fdisk可能會這樣做,但請確保安全,以免破壞第一個/目前分區。完成後,使用w-action 將表寫入磁碟並退出。您現在可以將磁碟添加到 raid 或創建文件系統。

引用自:https://serverfault.com/questions/544499