[lug] help: creating partitions

Will will.sterling at gmail.com
Fri Dec 8 17:05:06 MST 2017


It is normal to need to run partprobe after updating the partition table on
a drive before it can be formatted and used.  If you are using the logical
volume manager to SOP would be to make one large partition on the drive,
make that a PV and then divide it up into logical volumes as needed.

Here is a talk I gave on it a few years ago.
http://sterling.codes/presentations/2012/05/02/linux-fest-north-west-2012-lvm-advanced-topics/

On Wed, Dec 6, 2017 at 6:34 PM, Robert Racansky <robert.racansky at gmail.com>
wrote:

> operating system = CentOS 7.4.1708 (Core) in VirtualBox
>
>
> I want to create a 3 GB partition, /dev/sdb3
>
> This is the video I’m using to learn this :  “Understanding Linux
> Logical Volumes”  at  https://www.youtube.com/watch?v=Eu1WrVjzRy8 .
>
> The first time I did this exercise, there was no issue.
>
> But the second time I did it, it required a reboot after “write table
> to disk”, after which I continued and finished with no problem.
>
> I’m running into the same “the kernel still uses the old table”
> message the third time : * see the very end of this e-mail for the
> whole message *.
>
> I’m sure a reboot will work again.  And I’m looking up “partprobe” and
> “kpartx” right now, but
>
>
> QUESTION:  is this normal, since I did not have to reboot the first
> time?  And is there a way to avoid this?  Or am I going to have to run
> “partprobe” or “kpartx” or reboot every time I do this?
>
> Thanks.
>
>
>
> Setup is as below (note that I am omitting some the output for sake of
> simplicity and formatting and saving myself some typing):
>
>
> # df -h
>
> FILESYSTEM = /dev/mapper/centos-root SIZE = 9.2G USED = 1.5G AVAIL = 7.7G
>
>
> # cat /proc/partitions
>
> 8 00 08,388,608 sda [ 8 GB ]
> 8 01 01,048,576 sda1 [ 1 GB partition ]
> 8 02 07,339,008 sda2 [ 7 GB partition ]
> 8 16 20,971,520 sdb [ 20 GB ]
> 8 17 00,976,896 sdb1 [ 1 GB partition , 1st time I did this exercise ]
> 8 18 02,097,152 sdb2 [ 2 GB partition , 2nd time I did this exercise ]
>
>
>
> # parted /dev/sda print
>
> Model: ATA VBOX HARDDISK (scsi)
> Disk /dev/sda: 8,590MB
> Partition Table: msdos
>
> 1 1,075 MB primary xfs boot
> 2 7,515 MB primary ___ lvm
>
> Model: ATA VBOX HARDDISK (scsi)
> Disk /dev/sdb: 21.5GB
> Partition Table: msdos
>
> 1 1,000 MB primary ___ lvm
> 2 2,147 MB primary ___ lvm
>
>
>
> # lvs
>
> LV = root VG = centos 9.12g
> LV = swap VG = centos 820m
>
>
>
> # vgs
>
> VG = centos #PV = 3 #LV = 2 VSize = 9.92 GB
>
>
>
> # pvs
>
> PV = /dev/sda2 VG = centos FMT = lvm2 PSize = < 7.00 g
> PV = /dev/sdb1 VG = centos FMT = lvm2 PSize = 952 m
> PV = /dev/sdb2 VG = centos FMT = lvm2 PSize = < 2.00 g
>
>
> # fdisk /dev/sdb
>
> Command (m for help): n [ add a new partition ]
>
> Partition Type:
> p primary (2 primary, 0 extended, 2 free)
> e extended
> Select (default p): p
>
> Partition number (3,4, default 3): 3
>
> First sector (default 6150144): [ default ]
>
> Last sector, +sectors or +size{K,M,G]: +3G [ for a 3 GB partition ]
> Partition 3 of type Linux and of size 3 GiB is set
>
> Command (m for help): t [ change a partition’s system id ]
>
> Partition number (1-3, default 3): 3
>
> Hex code: 8e [ Linux LVM ]
> Changed type of partition ‘Linux” to ‘Linux LVM’
>
> Command (m for help): w [ write table to disk and exit ]
> The partition table has been altered!
> Calling ioctl() to re-read partition table.
> WARING: Re-reading this 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.
>
> #
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20171208/694faeed/attachment.html>


More information about the LUG mailing list