Archive

Posts Tagged ‘fdisk’

Prepare New Partition Linux

February 12, 2012 Leave a comment

I just got a new HD on my server so, I will use it to backup data, so lets get it ready:

First let’s check the status:

fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Ok, I can see the disk so let’s create a primary partition of 144Gb (454656 Mb), I’m using this size because its the size of my current / partition and I might use this later on. So:

fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):<enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801): +454656M

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 55276 444004438+ 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Ok, the partition is ready to be formated:

mkfs.ext3 /dev/sdb1

Add the label: ‘/primarybackup’ to my just created partition and create the directory:

tune2fs -L/primarybackup /dev/sdb1

mkdir /primarybackup

Now add this line to /etc/fstab:

LABEL=/primarybackup    /primarybackup          ext3    defaults        0 0

Not lets mount it:

mount /primarybackup

Done, now you can write on /primarybackup

Advertisements
Categories: backup, filesystem Tags: , ,