linux分區,掛盤,LVM

來源:互聯網
上載者:User

標籤:physical   linux   minimum   虛擬機器   掛盤   

1. 虛擬機器可以添加sisc硬碟,添加了要重啟虛擬機器才會生效

重啟後用fdisk -l可以查看到新添的盤,/dev/sdb是新加的第二塊硬碟

[[email protected] ~]# fdisk -lDisk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sda: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00096eec   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          26      204800   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              26          91      524288   82  Linux swap / SolarisPartition 2 does not end on cylinder boundary./dev/sda3              91        1045     7658496   83  Linux

2. 磁碟分割

命令fdisk /dev/sdb

[[email protected]~]# fdisk /dev/sdb

Device containsneither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a newDOS disklabel with disk identifier 0x29a761e1.

Changes willremain in memory only, until you decide to write them.

After that, ofcourse, the previous content won‘t be recoverable.

 

Warning: invalidflag 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‘) andchange display units to

         sectors (command ‘u‘).

 

Command (m forhelp):

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)

Command (m forhelp): p

 

Disk /dev/sdb:106 MB, 106954752 bytes

64 heads, 32sectors/track, 102 cylinders

Units = cylindersof 2048 * 512 = 1048576 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Disk identifier:0x29a761e1

 

   Device Boot      Start         End      Blocks  Id  System

 

Command (m forhelp): n

Command action

   e  extended

   p  primary partition (1-4)

p

Partition number(1-4): 1

First cylinder(1-102, default 1):

Using defaultvalue 1

Last cylinder,+cylinders or +size{K,M,G} (1-102, default 102): +10m

Unsupportedsuffix: ‘m‘.

Supported: 10^N:KB (KiloByte), MB (MegaByte), GB (GigaByte)

            2^N: K  (KibiByte), M (MebiByte), G  (GibiByte)

Last cylinder,+cylinders or +size{K,M,G} (1-102, default 102): +10M

 

Command (m forhelp): p

 

Disk /dev/sdb:106 MB, 106954752 bytes

64 heads, 32sectors/track, 102 cylinders

Units =cylinders of 2048 * 512 = 1048576 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Disk identifier:0x29a761e1

 

   Device Boot      Start         End     Blocks   Id System

/dev/sdb1               1          11       11248  83  Linux

l查看分區類型

Command (m forhelp): l

 

 0 Empty           24  NEC DOS         81 Minix / old Lin bf  Solaris       

 1 FAT12           39  Plan 9          82  Linux swap /So c1  DRDOS/sec (FAT-

 2  XENIXroot      3c  PartitionMagic  83  Linux           c4 DRDOS/sec (FAT-

 3  XENIXusr       40  Venix 80286     84 OS/2 hidden C:  c6  DRDOS/sec (FAT-

 4  FAT16<32M      41  PPC PReP Boot   85 Linux extended  c7  Syrinx        

 5 Extended        42  SFS             86 NTFS volume set da  Non-FSdata   

 6 FAT16           4d  QNX4.x          87 NTFS volume set db  CP/M / CTOS /.

 7 HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility  

 8 AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df BootIt        

 9  AIXbootable    50  OnTrack DM      93 Amoeba          e1  DOS access   

#如果要修改分區類型,用t

Command (m forhelp): t

Partition number(1-8): 8

Hex code (type Lto list codes): 8e

Changed systemtype of partition 8 to 8e (Linux LVM)

#然後就可以看到Id變成了8e,即現在是lVM類型的分區了

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  8e  Linux LVM

3. 格式化分區

[[email protected]~]# mkfs.ext4 -b 4096 -i 1024 /dev/sdb1 #格式化指定檔案系統,inode和block,實際是預設的,不用指定[[email protected]~]#mkfs.ext4 -T largerfile /dev/sdb1

-t: 檔案系統

-T 快速格式化

4. 掛載

[[email protected]~]# mount /dev/sdb1 /mnt   問題排錯:如果出現如下錯誤:[[email protected]~]# mount /dev/sdb1 /mnt  #未格式化,無法掛載mount: you mustspecify the filesystem type

5. 查看掛載結果

df -hT


linux分區,掛盤,LVM

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.