Pages

29 March 2009

Enabling new harddrive for linux with ext3 filesystem

After adding a new harddisk, Debian will detect it and may automatically mount it, especially it is an USB device and has a filesystem. Today I going to prepare my USB external harddisk to re-partition and reformat with Ext3 filesystem.

Disk Partitioning with GParted (GUI)

System > Administration > Partition Editor, if it is not available, the we need to install "GParted" using command "aptitude install gparted".

Command line partitioning

fdisk -l
Command to see the list of attached disks & partitions. Here we need to identify the logical name of the disk. I would use /edv/sdc (to refer the single disk for the fdisk command)

umount /dev/sdc1
Need to unmount the /dev/sdc1 partition, if any, otherwise we may not able to create and format a new partition onto device /dev/sdc

fdisk /dev/sdc
To create or modify partition table for device /dev/sdc
When a disk has more than 1024 cyclinders (most harddisk are exceed that), so a warning message will be prompted about inaccessible by some older boot loader and partitioning software. That is nothing wrong with the message, press "m" to display the menu. "p" to print/display the existing partition table. "d" to delete partition, "n" to create partition, "w" to confirm to alter the partition table.

mkfs.ext3 /dev/sdc1
To format and create an Ext3 filesystem onto sdc1 partition.

mkdir /media/mynewdisk
Once it is done, we need to create a mount point (with any name) for this new drive.

mount /dev/sdc1 /media/mynewdisk
To manually mount it.

If we wish to allow normal user to be able to create files on this new disk, we can EITHER give this user permission.

chown -R USERNAME:USERNAME /media/mynewdisk

- OR -
practically, if we have more users, we can allow the users in the plugdev group (usually referring to user group that able to mount removable disks, desktop users) to create files and sub-directories on the disk:

sudo chgrp plugdev /media/mynewdrive
sudo chmod g+w /media/mynewdrive

sudo chmod +t /media/mynewdrive

The last "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).

http://www.linux-usb.org/

No comments:

Post a Comment