用Transcend扩容卡给Macbook扩容

freebird posted @ 2015年7月06日 20:56 in DIYer with tags Mac OS X mount fstab Transcend Macbook 扩容 , 3064 阅读

如果买Macbook的时候闪存容量选小了,买个Transcend的扩容卡还算是比较有效的补救措施。Transcend扩容卡提供最高95MB/s的读取速度、60MB/s的写入速度,好歹比机械硬盘强一点,而且外观看起来还好,除了价格稍贵一点外,拿来扩容还算是不错的。买来最好的用法当然是直接用来挂HOME目录,如果要挂/Users,这篇文章讲的比较详细(注:可能要梯子)。如果只想挂自己的HOME目录而且单纯改了/etc/fstab之后就发现Apple家的什么iTunes、Photos等都打不开了,整个分区也都不可写入了,那本文接下来的内容也许能帮到你,至少我就遇到了这个问题并且这么解决了。不过你要是照我这么做却丢失了数据,虽然我自己没有丢失数据,但我并不为你的数据完整性做出任何哪怕一丁点儿的保证也不会为你可能遭遇的数据丢失承担任何意义上的责任。

另外如果是新买的Macbook就想通过扩容卡进行扩容,虽然我不推荐这么做,但是如果你坚持的话,其实可以直接在解包系统的时候通过选择将HOME目录直接挂载在扩容卡上的分区就好,并不用做本文这么多的麻烦事。

由于我本人是名程序员/键盘专业毕业生/码农/码畜,所以这篇记录不像记录、教程不像教程的文章里面会有很多命令,得在终端下运行。

首先,由于是给Mac系统扩容用的,所以我把扩容卡分为1个带日志又区分大小写的hfs+文件系统配合GUID分区表——也就是传说中的GPT。格式化好之后通常这个时候扩容卡就已经被挂载到/Volumes/Transcend(如果不是Transcend牌的扩容卡也许会叫别的名字,不过之后Transcend你都得理解成你所购买的扩容卡的品牌名称)上去了,如果你的是Untitled觉得看着不舒服的话,改改名就行了。

接着就要进行漫长的数据迁移了,通常HOME目录下除了自己的东西外,还会有一小点点owner为root的文件,总之如果用Finder拖一拖的话,可能会出问题。为了方便还有zhuangbility,在终端下输入一句就可以开始乾坤大挪移了:

$ sudo cp -RP ~ /Volumes/Transcend

这条命令会执行多久取决于HOME目录内的内容多少,正确结束应当没有输出,直接显示新的shell prompt。为了安全起见,我在这里采用的是拷贝而非移动。如果是刚买的笔记本的话,可以略过这步。另外如果很不幸的,如果你是UNIX geek,又恰好你的HOME分区内有hard link file,那么你是知道的,cp并不能帮你搞定,而且我也相信你也是知道如何搞定的。

有一定的可能性,/Volumes/Transcend的owner是root,而且作为HOME目录通常的权限是755,所以如果不是,可以用以下两条命令更正:

$ sudo chown `id -u -n`:`id -n -g` /Volumes/Transcend
$ chmod 755 /Volumes/Transcend

然后就是修改/etc/fstab使得扩容卡开机自动mount为HOME目录。

我们先要获得扩容卡的UUID,这个在OS X系统自带的磁盘工具就可以看到:选择对应的分区(而不是磁盘)并点击信息按钮,英文系统中叫UUID,中文系统中叫通用唯一标识的那一项即是。有了这个,我们就可以开始编辑/etc/fstab了。

sudo echo "UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX     /Users/XXX      hfs     dev,suid,owners,perm,rw,auto    0       0" >> /etc/fstab

UUID的那些XXX就用刚刚得到就好。/Users/XXX中的XXX应当替换为你的用户名,可以通过whoami这条命令在终端下查看。

那么,不出意外的话,你重启一下就可以享受扩容卡带来的福利了。


重启之后你会发现虽然系统整体的存储容量提升了,但原来的那块硬盘里的东西却没有减少,这是因为原来硬盘上你曾经的HOME分区里的东西还静静地躺在那里霸占着空间。不过不要着急着删掉他们,万一出问题了你就只能求助Time Machine了,而且Time Machine恢复出来的系统恐怕还得这么再重新操作一遍。

如果你已经这么用过时间了,觉得扩容完美成功没有任何问题,那么现在是时候删除掉原来的那些东西了。

最简单的方式,就是进入单用户模式,然后在终端中输入:

mount -uw /
rm -fr /Users/XXX/{*,.*}

这样最简单粗暴,不过如果不想进入单用户模式,就要先将/etc/fstab中那一行注释掉(在行首插入一个#即可)并重启,然后另外注册一个临时的管理员账户(比如说YYY),注销当前账户并登陆到临时账户运行:

sudo rm -fr /Users/XXX/{*,.*}

注意是之前那个用户的名字而不是现在这个临时账户的名字。

完了之后去掉在/etc/fstab中加入的#并重启,再删除这个临时账号就大功告成了。

cleaning companies 说:
2019年9月18日 15:56

Any nearby house maintaining services suppliers charge different; it mostly ıs dependent upon your conditions. So, when you're doing “deep maintaining, ” they offer a large sum amount for your job, and when you're living at a studio, they were able to charge one from 300 to 299 AED that can go close to 1, 500 AED for one 5-bedroom property.

bank ruptcy law merc 说:
2019年11月15日 00:57

When you're in the relationship, you'll be spending additional time together compared to you did whenever you were simply dating. This means you have to make time for every other inside your weekly schedule to help you enjoy your relationship.

clean tech laws 说:
2020年3月24日 19:50

Regulations of Gravity is among a General Law. So could be the Law regarding Conservation of energy, that will be, energy can not be created or perhaps destroyed, only transformed from form to a new. However, as opposed to human regulations, which may differ from region to region, Universal Regulations are steady and unchanging. You interact with these regulations with each breath an individual take. They will govern the existence.

bank ruptcy law merc 说:
2020年3月24日 19:50

Regulations of Gravity is among a General Law. So could be the Law regarding Conservation of energy, that will be, energy can not be created or perhaps destroyed, only transformed from form to a new. However, as opposed to human regulations, which may differ from region to region, Universal Regulations are steady and unchanging. You interact with these regulations with each breath an individual take. They will govern the existence.

dui lawyer montreal 说:
2020年3月24日 19:51

Many people are subject to be able to these identical natural Laws with the Universe, irrespective of race, coloring, creed or perhaps gender. The particular laws put in their effect without our own consent or perhaps awareness. Once we choose the particular behaviour, we select the consequences. Curiously, the those people who are frustrated inside life consistently make an effort to defy the particular natural regulations. And, unsurprisingly, successful people are now living in harmony with all the natural Laws with the Universe.

wendy wood law 说:
2020年3月24日 19:51

I spent my youth in the particular 1980s any time it looked that every person wanted to become lawyer just like the ones about LA Legislation. The 1980s, 1990s, and 2000s (until 2007) has been the time of Huge Law if the promise of your $100, 000 to be able to $160, 000 wage was, that seemed, extended to be able to anyone graduating from your top 20 school also to many folks graduating from your top 50 legislation school together with great marks and clerkships.

star lite shopping m 说:
2020年3月24日 19:52

On the web shopping could be the perfect solution for your home certain and for many who find shopping an arduous task. Online purchasing has became a boon for many who live inside rural locations too. Whether you might be buying directly from your business on the web retailer, someone online purchasing site, or perhaps an World wide web auction web site, shopping online may be fun, basic, time conserving and cost-effective.

maid service dubai 说:
2020年4月29日 18:16

This kind of piece is obviously a favorite within my Halloween attire collection. Some other trends may well come and also go, but going being a sexy People from france Maid can be a costume staple that may make you be noticeable from virtually any Halloween masses. Don't take the time bringing the purse together with you when an individual wear this kind of seductive collection, because guys will probably be falling above themselves inside their attempts to get you a drink!

house painting servi 说:
2020年4月29日 18:16

painter is absolutely vital in terms of decision creating. By applying this, you can simply have any glimpse regarding what your property or garden look like. The shades and components used in to the program are those who resemble those who are out there. You may well mix and also or select a color which is already premixed inside the program.

home cleaning dubai 说:
2021年6月07日 14:43

Avoid using cell phones, tablets, televisions with regard to televisions whilst cleaning the home. Because this may slow lower the pace from the work. Furthermore, you find yourself having much less energy to keep the cleansing process. Therefore, put aside these interruptions to accelerate the whole process.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter