2

I am running Fedora on my development Amazon EC2 instances. I recently moved from Fedora 8 to Fedora 15. I noticed that when I do a "cat /etc/fstab" I see the following on my Fedora 15:

LABEL=79d3d2d4    /         ext4    defaults         1 1
none       /dev/pts  devpts  gid=5,mode=620   0 0
none       /dev/shm  tmpfs   defaults         0 0
none       /proc     proc    defaults         0 0
none       /sys      sysfs   defaults         0 0

When I run "cat /etc/fstab" on my older Fedora 8 instance, I see the following:

/dev/sda1               /                       ext3    defaults 1 1
/dev/sda2               /mnt                     ext3    defaults 0 0
/dev/sda3               swap                    swap    defaults 0 0
none                    /dev/pts                devpts  gid=5,mode=620 0 0
none                    /dev/shm                tmpfs   defaults 0 0
none                    /proc                   proc    defaults 0 0
none                    /sys                    sysfs   defaults 0 0

From my understanding of Linux, I always thought that the root drive was always on /dev/sda1. So the Fedora 8 fstab makes sense to me.

Why is the Fedora 15 filesystem different? Why isn't /dev/sda1 mounted as root ? And where did /mnt and /swap go on Fedora 15? I am not having any problems with my Fedora 15, but just trying to understand the changes and be better educated.

0

3 Answers 3

2

The first entry likely does refer to sda1; using labels or UUIDs is now the norm because the same disk might not always be sda1 as you assume. For instance, suppose you upgrade your kernel and small changes in drivers mean that your disk controller drivers are loaded in a new order. Suddenly sda is what once was sdb and vice versa. As another example, a USB device plugged in will take the next available drive rather than the same one it used the last time it was inserted. By using UUID or label mappings you can create a mount point for a specific USB drive.

About the swap and /mnt: you don't have any swap or /mnt volume attached. If you're using Amazon EC2 images you should look at this lookup chart. It lists the ephemeral storage that comes with your instance (for free!). If the instance type you use shows swap or /mnt volumes, add them to your fstab.

/mnt is generic storage space, while swap is for memory caching. If your app performance is degraded without swap you can add a local file like so:

dd if=/dev/zero of=/swapfile bs=1024 count=`echo ${NUM_MEGS}*1024|bc`
mkswap /swapfile
echo /swapfile swap swap defaults 0 0 >> /etc/fstab
6

The root drive does not have to be /dev/sda1, it could be anything which is really what gives the unix filesystem such flexibility.

The problem with doing it the way your F8 instance has done it is that the devices are named based on their SCSI ID (or BUS order). So, say for example you have a SCSI drive, with ID 4 and that is the only drive on your system. It will get /dev/sda and everything will work. Now you want to add a new drive and it gets set with SCSI ID 3. Now that new drive gets to be /dev/sda and your old one becomes /dev/sdb, and all of your values in fstab are invalid.

Labelling the drive and mounting by label gives you the flexibility to not care what the bus order is, it will always mount no matter what the physical address is. You can do the same with UUID. You can see the values for these by doing tune2fs -l /dev/sda. It could very well be that the labeled one is still actually mounting /dev/sda1.

3

In Linux, there are different schemes for persistent naming:

  • device name: /dev/sd[abc]x
  • LABEL: label for your filesystem
  • UUID: each filesystem a unique identifier

You can check it by blkid or have a look at /dev/disk:

# blkid /dev/sda3
/dev/sda3: LABEL="/" UUID="dfe84dbf-d7fd-4038-872c-6dfc31f0be6f" TYPE="ext3" SEC_TYPE="ext2" 

# ls -lF /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 May 10 15:02 boot -> ../../sda1
lrwxrwxrwx 1 root root 10 May 10 15:02 SWAP-sda2 -> ../../sda2

# ls -lF /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 May 10 15:02 588a12e5-a032-43e7-a21c-99a1ddacd6fb -> ../../sda1
lrwxrwxrwx 1 root root 10 May 10 15:02 dfe84dbf-d7fd-4038-872c-6dfc31f0be6f -> ../../sda3

swap partition may be exist or not when installing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .