linux server添加硬盘,新增硬盘扩充linux ftp server空间
【背景】?原/ftp分區空間不足
【需求】新增一顆硬盤,將/ftp分區掛載點指向新硬盤.
【操作步驟】
1. 新增硬盤,并分區\格式化;
[root@bjftp01?~]#?fdisk?-lDisk?/dev/sda:?160.0?GB,?160041885696?bytes255?heads,?63?sectors/track,?19457?cylindersUnits?=?cylinders?of?16065?*?512?=?8225280?bytes???Device?Boot??????Start?????????End??????Blocks???Id??System/dev/sda1???*???????????1????????2550????20482843+??83??Linux/dev/sda2????????????2551????????2805?????2048287+??82??Linux?swap?/?Solaris/dev/sda3????????????2806???????19457???133757190???83??LinuxDisk?/dev/sdb:?500.1?GB,?500107862016?bytes255?heads,?63?sectors/track,?60801?cylindersUnits?=?cylinders?of?16065?*?512?=?8225280?bytes???Device?Boot??????Start?????????End??????Blocks???Id??System/dev/sdb1???????????????1???????60801???488384001???83??Linux
新硬盤分區:[root@bjftp01?~]# fdisk /dev/sdb
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)
Command (m for help): n
Command action
e ? extended
p ? primary partition (1-4)
p
Partition number (1-4): 1
新增一個主分區:/dev/sdb1
完成后按W保存退出
新分區格式化:
mkfs.ext3 /dev/sdb1
掛載測試:
mount /dev/sdb1 /mnt/ftpnew/
2.同步原/ftp資料到新分區
rsync -avp /ftp/?/mnt/ftpnew/
3.修改/etc/fstab
LABEL=/ ? ? ? ? ? ? ? ? ?/ ? ? ? ? ? ? ? ? ? ? ?ext3 ? defaults ? ? ? 1 1
#LABEL=/ ? ? ? ? ? ? ? ? /ftp ? ? ? ? ? ? ? ? ? ext3 ? ?defaults ? ? ?1 2
/dev/sda3 ? ? ? ? ? ? ? ?/ftpbk ? ? ? ? ? ? ? ? ext3 ? ?defaults ? ? ?1 2
/dev/sdb1 ? ? ? ? ? ? ? /ftp ? ? ? ? ? ? ? ? ? ?ext3 ? ?defaults ? ? ? 1 2
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
LABEL=SWAP-sda2 ? ? ? ? swap ? ? ? ? ? ? ? ? ? ?swap ? ?defaults ? ? ? ?0 0
修改完成需重啟系統才可以生效.
如修改有問題會無法啟動系統,進入到single模式檢查修改配置即可.
注意:single模式下系統為只讀,無法直接修改/etc/fstab文件,需先執行如下命令:
mount -o remount,rw /?????? 逗號前無空格,一定要有/這個
重新掛載為 讀寫模式。
再 vi /etc/fstab 發現已經可以修改了,修改完畢,重啟,正常。
4.系統啟動,驗證新分區和舊分區的資料.
[root@bjftp01?~]#?df?-hFilesystem????????????Size??Used?Avail?Use%?Mounted?on/dev/sda1??????????????19G???13G??5.7G??69%?//dev/sda3?????????????124G??124G?????0?100%?/ftpbk/dev/sdb1?????????????459G??125G??312G??29%?/ftptmpfs?????????????????377M?????0??377M???0%?/dev/shmnone??????????????????377M??104K??377M???1%?/var/lib/xenstored
[root@bjftp01?ftp]#?lltotal?60drwxr-xr-x??3?root?root??4096?May?14??2014?Software
[root@bjftp01?ftpbk]#?lltotal?44drwxr-xr-x??3?root?root??4096?May?14??2014?Software
5.都沒問題,finished!
總結
以上是生活随笔為你收集整理的linux server添加硬盘,新增硬盘扩充linux ftp server空间的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安逸花借钱可靠吗利息多少 安逸花靠不靠谱
- 下一篇: 使用易语言怎么实现多线程计算