![]() |
For this example I'm going to create an ext3 filesystem. The command I use is mke2fs, which by default creates an ext2 filesystem. Since ext3 is essentially an ext2 filesystem, with journaling, this is appropriate. Remember I'm going to create this partition to mount to /home/myusername/myfiles. So I use mke2fs like this:
# mke2fs -b 1024 -j -L /myfiles /dev/hdb1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=/home/myusername/myfiles
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
307200 inodes, 2449881 blocks
122494 blocks (5.00%) reserved for the super user
First data block=1 300 block groups 8192 blocks per group,
8192 fragments per group
1024 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553,
1024001, 1990657
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
#So the only thing left to do, is create an entry in /etc/fstab for my mount
# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/hda3 swap swap defaults 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
LABEL=/myfiles /home/myusername/myfiles/ ext3 defaults 0 0I can manually mount the filesystem, or wait until I reboot. I prefer to mount it now.
# mount /home/myusername/myfilesIf I did everything correctly the mount command will check /etc/fstab find the file type and LABEL and mount the file without a problem. I can check with the mount command.
# mount
/dev/hda1 on / type ext3 (rw)
proc on /proc type proc (rw)
/dev/hda2 on /usr type ext3 (rw)
/dev/hda4 on /var type ext3 (rw)
none on /dev/pts type devpts (rw,mode=0622)
/dev/hdb1 on /home/myusername/myfiles type ext3 (rw)
#It worked!