linux 下mount linux硬盘

 

Mounting Linux Partitions in Ubuntu

If you plug in an external hard drive with a Linux filesystem, it will automount and show up on your desktop, just like any external media.

But what if you have an internal hard drive or partition with a Linux filesystem? Well, that's what this tutorial is about.

First you have to determine what the partition is called and what filesystem it is. One quick way to do it if you know what filesystem you formatted the drive as (Ext3, for example) is to just type the terminal command

sudo fdisk -l

Here's how it could come out:

 

Disk /dev/hda: 20.0 GB, 20020396544 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1275 10241406 83 Linux
/dev/hda2 1276 2434 9309667+ 5 Extended
/dev/hda5 1276 2388 8940141 83 Linux
/dev/hda6 2389 2434 369463+ 82 Linux swap / Solaris

As you can see, I'm able to locate that /dev/hda5 is my Linux partition, but in System, I don't find out if it's Ext3 or Reiserfs or what it is. If I happen to know it's Ext3, cool.

But let's say I didn't know. Well, one way to find out for sure is to install GParted and find out:

 

sudo aptitude update
sudo aptitude install gparted gksu
gksudo gparted

Ah, now I can definitely see it's Ext3 for sure. Under Partition I see it's /dev/hda5, and under Filesystem, I see it's Ext3.

If you have a second physical hard drive (not just another partition), you might have to click on the top-right corner to focus on the second hard drive.

So now I'll create a mount point for that partition:

sudo mkdir /storage

Then I'll edit my /etc/fstab file:

sudo cp /etc/fstab /etc/fstab_backup
sudo nano /etc/fstab

Once in there, I should add in this line:

/dev/hda5 /storage ext3 defaults 0 0

Then I can save (Control-X), confirm (Y), and exit (Enter).

Since we've made changes to the /etc/fstab file, we need to have Ubuntu acknowledge those changes:

sudo mount -a

Now I need to give it the proper permissions. Let's just assume, for this example, that my username is marie.

sudo chown -R marie:marie /storage
sudo chmod -R 755 /storage

Now the partition is mounted in the /storage folder and is ready for use!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值