LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Remote HDD Partitioning+Formatting. (https://www.linuxquestions.org/questions/linux-enterprise-47/remote-hdd-partitioning-formatting-571600/)

CoMMy 07-23-2007 07:57 AM

Remote HDD Partitioning+Formatting.
 
Hello,

As a fairly noob in Linux i have a noob question for you (probably the easiest thing for you experts :D).

Well basically i have a new HDD installed on my remote server and im using the bash prompt on RHEL 4. The HDD has no partitions and i have no idea how to make one... The fdisk utility help does not specify how to make one!

Here is the output of sfdisk:

Code:

Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/sda1  *      0+    24      25-    200781  83  Linux
/dev/sda2        25    5437    5413  43479922+  83  Linux
/dev/sda3      5438    6790    1353  10867972+  83  Linux
/dev/sda4      6791    9728    2938  23599485    5  Extended
/dev/sda5      6791+  8143    1353-  10867941  83  Linux
/dev/sda6      8144+  9496    1353-  10867941  83  Linux
/dev/sda7      9497+  9627    131-  1052226  83  Linux
/dev/sda8      9628+  9728    101-    811251  82  Linux swap

Disk /dev/sdb: 19457 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition
No partitions found


As you see the second SATA HDD because its new, has no partitions...

Any idea how to create one using a terminal:Pengy:

Many thanks and sry for my :newbie: !

rtspitz 07-23-2007 08:46 AM

fdisk /dev/sdb

then type m (for help)

n: create partition (maximum of 4 primary partitions, extended is more flexible unless you need to boot from it)

CoMMy 07-23-2007 09:13 AM

Quote:

Originally Posted by rtspitz
fdisk /dev/sdb

then type m (for help)

n: create partition (maximum of 4 primary partitions, extended is more flexible unless you need to boot from it)

Thanks for this :eek: !

I tryied making a partition.. I made an extended one in the slot 1 i think.....
Code:

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1      19457  156288321    5  Extended

Command (m for help): v
312581806 unallocated sectors

Basically if you can guide me as to do what i need if its not too much trouble...

This HDD is a secondary slave.. Im guessing it should be extended. So my question is how can i make this disk fully operational and ready to write on (even how to mount it..)

Many thanks ;)

rtspitz 07-23-2007 02:27 PM

ok.

fdisk /dev/sdb

Command (m for help):

--> n

Command action
l logical (5 or over)
p primary partition (1-4)


--> l

First cylinder (1-32768, default 1): 1

Last cylinder or +size or +sizeM or +sizeK (1-32768, default 32768):

--> +30000M (just an example for 30G)

repeat for every amount of logical partition(s) you like until all space is full.

--> w (write partitions to disk)

--> fdisk -l (shows all partitions found)

then create a filesystem on the partition(s) you've just set up.

--> mkfs.ext3 /dev/sdb5 (just an example, you can also use mkfs.reiserfs and others you like/need)

create an entry in /etc/fstab like:

/dev/sdb5 /MY-DATA-DISK ext3 acl,user_xattr 0 1

- if you don't want it to mount at boot you can add "noauto" to the options "acl,...."
- if it should be mountable by ordinary users add "user"
- the first digit (0) is called "dump flag", can be ignored, google for it if needed.
- the 2nd digit (1) is used for file system checks during boot if something has gone bad. 1 = first partition to check, 2 = second ....
- make sure /MY-DATA-DISK actually exists.

now decide which file permissions should be set on that directory

- set appropriate permissions on the mount-point with "chown" / "chmod". if you need access control lists (somewhat like in windoze) have a look at "setfacl" and "getfacl"

easy example:

owner: root (can do ANYTHING)
group: users (should be able to read, write, execute = change into directory)
others: nada

--> chown root.users /MY-DATA-DISK
--> chmod u+rwx,g+rwx,o-rwx /MY-DATA-DISK
--> ls -lsd /MY-DATA-DISK

drwxrwx--- 2 root users 4096 2007-07-23 21:39 MY-DATA-DISK/


for more detailled access control you need to use ACLs (access control lists).

some info here: http://www.suse.de/~agruen/acl/chapter/fs_acl-en.pdf


All times are GMT -5. The time now is 07:29 AM.