18,parted 的分割槽,格式化,掛載
阿新 • • 發佈:2020-11-04
分割槽: fdisk 不能大於2T 的檔案系統分割槽。如果大於2T就用parted(他是萬能的,多大的都可以用它分割槽) 1,首先得轉換為gpt格式 [root@moban ~]# parted /dev/sdb GNU Parted 2.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) help align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system move NUMBER START END move partition NUMBER name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) mkpart paimary 0 500 Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? yes parted: invalid token: yes Ignore/Cancel? Ignore (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 1074MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 17.4kB 500MB 500MB paimary (parted) quit Information: You may need to update /etc/fstab. [root@moban ~]# ll /dev/sd* brw-rw----. 1 root disk 8, 0 Jun 16 12:20 /dev/sda brw-rw----. 1 root disk 8, 1 Jun 16 12:20 /dev/sda1 brw-rw----. 1 root disk 8, 2 Jun 16 12:20 /dev/sda2 brw-rw----. 1 root disk 8, 3 Jun 16 12:20 /dev/sda3 brw-rw----. 1 root disk 8, 16 Jun 16 13:45 /dev/sdb brw-rw----. 1 root disk 8, 17 Jun 16 13:44 /dev/sdb1 [root@moban ~]# mkfs -t ext4 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 122400 inodes, 488264 blocks 24413 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67633152 60 block groups 8192 blocks per group, 8192 fragments per group 2040 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 20 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@moban ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 9.1G 1.8G 6.9G 21% / tmpfs 932M 0 932M 0% /dev/shm /dev/sda1 190M 40M 141M 23% /boot [root@moban ~]# mount /dev/sdb1 /tmp [root@moban ~]# [root@moban ~]# [root@moban ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 9.1G 1.8G 6.9G 21% / tmpfs 932M 0 932M 0% /dev/shm /dev/sda1 190M 40M 141M 23% /boot /dev/sdb1 454M 2.3M 428M 1% /tmp [root@moban ~]# 要想開機重啟能自動掛載還需要如下:新增UUID [root@moban ~]# blkid /dev/sdb1 /dev/sdb1: UUID="73f46c61-7715-4370-bd64-70a652bce9f7" TYPE="ext4" [root@moban ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Sun May 6 14:17:24 2018 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=a8575ea7-961f-4fcd-8e78-bee787e8ea6f / ext4 defaults 1 1 UUID=956daa2e-dce7-4662-a44b-42bb2247152c /boot ext4 defaults 1 2 UUID=989a48da-a9fd-4dc2-8b13-29f88a328167 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 UUID="73f46c61-7715-4370-bd64-70a652bce9f7" /tmp ext4 defaults 0 0 [root@moban ~]#