LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating New Logical Partitions (http://www.linuxquestions.org/questions/linux-newbie-8/creating-new-logical-partitions-909039/)

Steven09 10-19-2011 03:37 PM

Creating New Logical Partitions
 
I'm currently working on a lab for a linux based course and the question asked me:
"Create a new logical partition (NOT a logical volume!)- minimum 5G, leaving at least 10G free space in the extended partition."

So, what I have done:

$ su

# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1e16c543

Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 313236 83 Linux
/dev/sda2 40 60801 488070765 5 Extended
/dev/sda5 40 78 313236 83 Linux
/dev/sda6 79 3266 25600000 8e Linux LVM
/dev/sda7 3266 6453 25600000 8e Linux LVM
/dev/sda8 6453 9640 25600000 8e Linux LVM
/dev/sda9 9640 12827 25600000 8e Linux LVM

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (12827-60801, default 12827):
Using default value 12827
Last cylinder, +cylinders or +size{K,M,G} (12827-60801, default 60801): +5G

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1e16c543

Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 313236 83 Linux
/dev/sda2 40 60801 488070765 5 Extended
/dev/sda5 40 78 313236 83 Linux
/dev/sda6 79 3266 25600000 8e Linux LVM
/dev/sda7 3266 6453 25600000 8e Linux LVM
/dev/sda8 6453 9640 25600000 8e Linux LVM
/dev/sda9 9640 12827 25600000 8e Linux LVM
/dev/sda10 12827 13480 5247284+ 83 Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@f13host dev]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@f13host dev]# partprobe -s
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.



The next step wants me to add that partition as a PV (physical volume) into the the existing VG (volume group). However since the kernel isn't reflecting the changes I am unable to do this step.

If you want to see the lab for yourself it is on-line for anyone to see at: <http://zenit.senecac.on.ca/wiki/index.php/OPS235_Lab_4>

I'm not asking for anyone to do my homework for me (this isn't the first time I have asked for help nor would it be the first that I am kicked from a forum for asking a similarly structured question..) I just need a push in the right direction. Any help is greatly appreciated.

-Steven

spankbot 10-19-2011 07:02 PM

Looks like the steps you did are correct, however in your example you're attempting to modify a drive that has been setup using LVM, in which case fdisk will not work.

syg00 10-19-2011 07:13 PM

Rubbish - fdisk will (and has in this case) work fine.

Reboot will fix this issue.

themande 10-19-2011 08:57 PM

Yes, solution is rebooting your machine.

Code:

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot
or after you run partprobe(8) or kpartx(8)
Syncing disks
.

All partitions of your hard drive are mounted that is why after writing changes using fdisk utility ( w option ) you are getting Device or resource busy error message. Partprobe is also not working for the same reason. Last option left for you is rebooting your machine.


All times are GMT -5. The time now is 06:07 PM.