久久99国产精品片久久99蜜桃_久久精品99国产精品蜜桃_久久久亚洲AV成人网站_欧美精品色婷婷五月综合_亚洲精品乱码久久久久久蜜桃图片_夜夜高潮夜夜爽国产伦精品_69无人区乱码一二三四区别_日产一码二码三码区别_大香区一二三四区2021_国产精品爱久久久久久久,日本高清视频成人网www,国产亚洲一二三区精品免费视频观看,久久久精品国产SM调教网站

歡迎訪問分類目錄網(wǎng)
快審聯(lián)系QQ:158925126當(dāng)前位置:分類目錄網(wǎng) » 站長資訊 » 技術(shù)教程 » 文章詳細(xì) 訂閱RssFeed

linux下btrfs文件系統(tǒng)擴(kuò)容實(shí)錄

來源:本站原創(chuàng) 瀏覽:846次 時(shí)間:2016-10-08

  對(duì)于許多l(xiāng)inux用戶來說,ext3,ext4文件系統(tǒng)可能會(huì)比較熟悉,,但是btrfs還真有不少人不知道,,其實(shí)Btrfs 被稱為是下一代 Linux 文件系統(tǒng),據(jù)說它采用了很多先進(jìn)的文件系統(tǒng)設(shè)計(jì),,不僅解決了 ext2/3 的擴(kuò)展性問題,還讓人們看到了下一代文件系統(tǒng)所具有的許多其他特性,。而因?yàn)橛袀€(gè)應(yīng)用, 之前分配磁盤空間不夠用了(只分了1TB), 現(xiàn)在找管理員分多2TB, 加起來就是3TB可用空間. 后端用的是CEPH文件系統(tǒng), 所以在我的系統(tǒng)中, 看到的分區(qū)是這樣的

  Model: Virtio Block Device (virtblk)

  Disk /dev/vdd: 3299GB

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

  Partition Table: msdos Number Start End Size Type File system Flags 1 1049kB 1100GB 1100GB primary btrf

  可以看到, 我的vdd第一個(gè)分區(qū)vdd1, 就是我原來的分區(qū)(1TB), 現(xiàn)在vdd已經(jīng)從原來的1TB擴(kuò)容到3TB, 如何把3TB的空間都移給vdd1?

  不能直接 btrfs resize

  幸好我用的是btrfs文件系統(tǒng), 它的擴(kuò)展性有目共睹, 用網(wǎng)上說明的方法來試下

  root@hostname:/home/igi# btrfs filesystem resize +1024G /home/data/ Resize '/home/data/' of '+1024G' ERROR: unable to resize '/home/data/' - File too large

  我先試了加多1TB, 不過直接報(bào)錯(cuò), 提示過大, 無論如何也無法調(diào)高, 但可以在目前1TB的大小內(nèi)調(diào)整

  root@hostname:/home/igi# btrfs filesystem resize -10G /home/data/ Resize '/home/data/' of '-10G' root@hostname:/home/igi# df -h | grep data /dev/vdd1 1014G 725G 288G 72% /home/data root@hostname:/home/igi# btrfs filesystem resize +10G /home/data/ Resize '/home/data/' of '+10G' root@hostname:/home/igi# df -h | grep data /dev/vdd1 1.0T 725G 298G 71% /home/data

  在與網(wǎng)友的交流中, nerd有句話提醒了我' 文件系統(tǒng)是在分區(qū)之內(nèi)的東東 ', 嗯, btrfs是構(gòu)建在分區(qū)之上的文件系統(tǒng), 它應(yīng)該不能修改分區(qū)的大小

  而后nerd給了個(gè)鏈接, 里面提到了使用fdisk和resize2fs來調(diào)整ext文件系統(tǒng)的大小, 總體思路是: 刪除分區(qū)->使用新大小新建分區(qū)->做fsck->resize2fs->最后就可以重新掛載并且數(shù)據(jù)一般不會(huì)丟失!

  參考鏈接: resize-filesystem-fdisk-resize2fs

  這種思路在btrfs應(yīng)該也行! 來試試

  先fdick調(diào)整分區(qū)大小, 再btrfs resize, 關(guān)鍵是fsck!

  root@hostname:/home/igi# umount /home/data/

  root@hostname:/home/igi# fdisk /dev/vdd

  WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).

  DOS partition table format can not be used on drives for volumes

  larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID

  partition table format (GPT).

  Command (m for help): d (刪除分區(qū))

  Selected partition 1

  Command (m for help): p

  Disk /dev/vdd: 3298.5 GB, 3298534883328 bytes

  3 heads, 2 sectors/track, 1073741824 cylinders, total 6442450944 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: 0x5cd07a6b Device Boot Start End Blocks Id System

  Command (m for help): w (保存分區(qū))

  The partition table has been altered!

  Calling ioctl() to re-read partition table.

  Syncing disks.

  root@hostname:/home/igi# fdisk /dev/vdd

  WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).

  DOS partition table format can not be used on drives for volumes

  larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID

  partition table format (GPT).

  Command (m for help): n (新建分區(qū))

  Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p (新建主分區(qū), 后續(xù)步驟一路默認(rèn)值, 回車)

  Partition number (1-4, default 1): 1 First sector (2048-4294967295, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): Using default value 4294967294 Command (m for help): p

  Disk /dev/vdd: 3298.5 GB, 3298534883328 bytes 16 heads, 63 sectors/track, 6391320 cylinders, total 6442450944 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: 0x5cd07a6b Device Boot Start End Blocks Id System

  /dev/vdd1 2048 4294967294 2147482623+ 83 Linux

  Command (m for help): w (保存分區(qū))

  The partition table has been altered!

  Calling ioctl() to re-read partition table.

  Syncing disks.

  root@hostname:/home# btrfsck /dev/vdd1 #一定要做fsck!

  checking extents

  checking fs roots

  checking root refs found 923277586432 bytes used err is 0 total csum bytes: 898793244 total tree bytes: 2683535360 total fs tree bytes: 1454723072 btree space waste bytes: 514669023 file data blocks allocated: 920594051072 referenced 920594051072 Btrfs Btrfs v0.19 root@hostname:/home/igi# resize2fs /dev/vdd1 #這里證實(shí)resize2fs不支持btrfs

  resize2fs 1.42.5 (29-Jul-2012)

  resize2fs: Bad magic number in super-block while trying to open /dev/vdd1

  Couldn't find valid filesystem superblock.

  root@hostname:/home/igi# mount -a #重新掛載修改后的分區(qū)

  root@hostname:/home/igi# df -h | grep data #可以看到還是1TB!!!

  /dev/vdd1 1.0T 863G 160G 85% /home/data

  root@hostname:/home# btrfs filesystem resize max /home/data #調(diào)整大小

  Resize '/home/data' of 'max'

  root@hostname:/home# df -h | grep data

  /dev/vdd1 2.0T 863G 1.2T 43% /home/data

  看到最后的大小了么, 不是3T, 而是2T, 我也納悶, 用默認(rèn)值來新建, 應(yīng)該是最大的3T, 后來想到MBR分區(qū)的問題(MBR分區(qū)只能最大2.2TB), 嗯, 我用的fdisk不支持GPT分區(qū), 得改用parted工具來重新弄了

  MBR和GPT參考文檔: MBR和GPT分區(qū)格式

  用parted再來一次

  root@hostname:/home# parted /dev/vdd

  GNU Parted 2.3

  Using /dev/vdd

  Welcome to GNU Parted! Type 'help' to view a list of commands.

  (parted) print

  Model: Virtio Block Device (virtblk)

  Disk /dev/vdd: 3299GB

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

  Partition Table: msdos Number Start End Size Type File system Flags 1 1049kB 2199GB 2199GB primary btrfs

  (parted) rm 1 (重新刪除分區(qū))

  (parted) print

  Model: Virtio Block Device (virtblk)

  Disk /dev/vdd: 3299GB

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

  Partition Table: msdos Number Start End Size Type File system Flags

  (parted) mklabel gpt (轉(zhuǎn)為GPT分區(qū), 會(huì)提醒數(shù)據(jù)丟失! 勇敢的續(xù)續(xù)吧)

  Warning: The existing disk label on /dev/vdd will be destroyed and all data on this disk will be lost. Do you want to continue?

  Yes/No? Yes

  (parted) mkpart primary (新建分區(qū))

  File system type? [ext2]? btrfs Start? 1049kB End? 3299GB

  (parted) print

  Model: Virtio Block Device (virtblk)

  Disk /dev/vdd: 3299GB

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

  Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 3299GB 3299GB btrfs primary (parted) quit

  Information: You may need to update /etc/fstab.

  root@hostname:/home# btrfsck /dev/vdd1 #一定要記得fsck!

  checking extents

  checking fs roots

  checking root refs found 923277582336 bytes used err is 0 total csum bytes: 898793244 total tree bytes: 2683531264 total fs tree bytes: 1454723072 btree space waste bytes: 514665137 file data blocks allocated: 920594051072 referenced 920594051072 Btrfs Btrfs v0.19 root@hostname:/home/igi# mount -a #重新掛載修改后的分區(qū)

  root@hostname:/home# btrfs filesystem resize max /home/data

  Resize '/home/data' of 'max' root@hostname:/home# df -h | grep data

  /dev/vdd1 3.0T 863G 2.2T 29% /home/data

  終于3TB了, 而且一切數(shù)據(jù)還在, 勝利!

  后話: 數(shù)據(jù)有風(fēng)險(xiǎn), 操作需謹(jǐn)慎, 請做好備份, 任何一步出錯(cuò), 都可能丟失數(shù)據(jù)! 同時(shí)也感謝nerd!

  原文 http://www.igigo.net/post/xiao-za-sui/diao-zheng-btrfsfen-qu-da-xiao


公司企業(yè)大全

推薦站點(diǎn)

  • 納米AI搜索 納米AI搜索

    納米AI搜索開創(chuàng)全新問答方式,,沒有套路,,直接給答案,讓搜索變得簡單直觀,!拍照問,、語音搜、聽

    www.n.cn
  • 一號(hào)屋手賺庫 一號(hào)屋手賺庫

    一號(hào)屋手賺庫致力于分享最新且免費(fèi)的手機(jī)賺錢軟件,,在這里,,你可以找到各種類型的賺錢app,獲

    www.yihaowu.com
  • 事業(yè)編招聘網(wǎng) 事業(yè)編招聘網(wǎng)

    事業(yè)編招聘網(wǎng)(sybzp.cn)事業(yè)單位招聘信息基考試資料原創(chuàng)內(nèi)容網(wǎng)站,,主打快速,、全面、優(yōu)

    www.sybzp.cn
  • 4K高清電影下載 4K高清電影下載

    4Kfilm視界是專業(yè)的4K電影下載站,本網(wǎng)站頁面簡潔,提供4K盤HDR杜比視界電影,、美劇

    www.4kfilm.cn
  • 百評(píng)客 百評(píng)客

    百評(píng)客深度評(píng)測各種賺錢游戲,、手機(jī)賺錢app,提供客觀且真實(shí)的評(píng)測分析,,在這里,,你可以更了解

    m.baike5.com
  • 優(yōu)質(zhì)設(shè)計(jì)素材 優(yōu)質(zhì)設(shè)計(jì)素材

    顏格視覺專注海外創(chuàng)意廣告設(shè)計(jì)圖片素材下載的網(wǎng)站!提供包括樣機(jī)素材,平面素材,UI設(shè)計(jì),ic

    www.youngem.com
  • 國家智慧教育平臺(tái) 國家智慧教育平臺(tái)

    國家智慧教育平臺(tái),,全稱國家智慧教育公共服務(wù)平臺(tái),,是由中華人民共和國教育部指導(dǎo),教育部教育技

    www.smartedu.cn
  • 鳥說游戲 鳥說游戲

    鳥說是一個(gè)聚焦電競產(chǎn)業(yè)的網(wǎng)站,,旨在分享不一樣的電競樂趣,。我們致力于提供最新的電競資訊、熱門

    www.niaoshuo.com
  • 游軟盟 游軟盟

    游軟盟是一個(gè)免費(fèi)的應(yīng)用下載網(wǎng)站,,為用戶提供好玩的手機(jī)游戲,、實(shí)用的手機(jī)軟件下載,我們也會(huì)及時(shí)

    app.ufolm.com