Which command updates /dev/mapper entries after partition deletion?

Heinz Mauelshagen heinzm at redhat.com
Fri Mar 6 12:15:58 UTC 2009


Am Samstag, den 28.02.2009, 10:54 -0700 schrieb Curtis Gedak:
> When a new partition is created, the "dmraid -ay" command can be used to 
> create the missing entry in /dev/mapper.  The opposite situation does 
> not appear to work wherein I delete a partition.
> 
> Which command should be used to remove and/or update the /dev/mapper 
> entries when a partition is deleted?

Use "dmsetup remove /dev/mapper/..." on the respective partition device.

Heinz

> 
> Attached is a log of my session where I used parted to delete a 
> partition, and then tried to delete all the /dev/mapper entries with 
> "dmraid -an".
> 
> Regards,
> Curtis Gedak
> Maintainer of GParted
> 
> einfaches Textdokument-Anlage (dmraid-delete-partition.txt)
> *****
> ***** Print dmraid version information
> *****
> 
> gedakc at quad:/dev/mapper$ sudo dmraid --version
> dmraid version:		1.0.0.rc14 (2006.11.08) 
> dmraid library version:	1.0.0.rc14 (2006.11.08)
> device-mapper version:	4.12.0
> gedakc at quad:/dev/mapper$ 
> 
> 
> *****
> ***** Original listing of /dev/mapper directory after bootup.
> *****
> 
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     140 2009-02-28 09:04 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 09:05 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 09:04 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  1 2009-02-28 09:04 isw_cjdcbiheed_TestRaid1
> brw-rw----  1 root disk 254,  2 2009-02-28 09:04 isw_cjdcbiheed_TestRaid5
> brw-rw----  1 root disk 254,  3 2009-02-28 09:04 isw_cjdcbiheed_TestRaid6
> 
> 
> *****
> ***** Delete partition number 5 using parted
> ***** NOTE:  The error messages are related to parted failing to inform
> *****        the kernel of the partition layout change.  I believe this
> *****        is because /dev/mapper devices do not use a kernel ioctl call
> *****        to reread the partition table
> ***** 
> 
> gedakc at quad:/dev/mapper$ sudo parted /dev/mapper/isw_cjdcbiheed_TestRaid
> GNU Parted 1.8.8.1.115-d53a
> Using /dev/mapper/isw_cjdcbiheed_TestRaid
> Welcome to GNU Parted! Type 'help' to view a list of commands.
> (parted) unit s                                                           
> unit s
> (parted) print                                                            
> print
> Model: Unknown (unknown)
> Disk /dev/mapper/isw_cjdcbiheed_TestRaid: 312494080s
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> 
> Number  Start       End         Size        Type      File system  Flags
>  1      63s         224909s     224847s     primary   ext2              
>  2      224910s     312480314s  312255405s  extended                    
>  6      15872283s   43889579s   28017297s   logical   reiserfs          
>  5      307741203s  312480314s  4739112s    logical   ntfs              
> 
> (parted) rm 5                                                             
> rm 5
> Error: Error informing the kernel about modifications to partition        
> /dev/mapper/isw_cjdcbiheed_TestRaid1 -- Invalid argument.  This means Linux
> won't know about any changes you made to /dev/mapper/isw_cjdcbiheed_TestRaid1
> until you reboot -- so you shouldn't mount it or use it in any way before
> rebooting.
> Ignore/Cancel? ignore                                                     
> ignore
> Error: Error informing the kernel about modifications to partition        
> /dev/mapper/isw_cjdcbiheed_TestRaid2 -- Invalid argument.  This means Linux
> won't know about any changes you made to /dev/mapper/isw_cjdcbiheed_TestRaid2
> until you reboot -- so you shouldn't mount it or use it in any way before
> rebooting.
> Ignore/Cancel? Ignore                                                     
> Ignore
> Error: Error informing the kernel about modifications to partition        
> /dev/mapper/isw_cjdcbiheed_TestRaid5 -- Invalid argument.  This means Linux
> won't know about any changes you made to /dev/mapper/isw_cjdcbiheed_TestRaid5
> until you reboot -- so you shouldn't mount it or use it in any way before
> rebooting.
> Ignore/Cancel? Ignore                                                     
> Ignore
> (parted) print                                                            
> print
> Model: Unknown (unknown)
> Disk /dev/mapper/isw_cjdcbiheed_TestRaid: 312494080s
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> 
> Number  Start      End         Size        Type      File system  Flags
>  1      63s        224909s     224847s     primary   ext2              
>  2      224910s    312480314s  312255405s  extended                    
>  5      15872283s  43889579s   28017297s   logical   reiserfs          
> 
> (parted) quit                                                             
> quit
> Information: You may need to update /etc/fstab.                           
> 
> 
> *****
> ***** List the /dev/mapper entries again.
> ***** NOTE:  No dmraid commands have been executed
> *****
> 
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     140 2009-02-28 09:04 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 09:05 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 10:28 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  1 2009-02-28 09:04 isw_cjdcbiheed_TestRaid1
> brw-rw----  1 root disk 254,  2 2009-02-28 09:04 isw_cjdcbiheed_TestRaid5
> brw-rw----  1 root disk 254,  3 2009-02-28 09:04 isw_cjdcbiheed_TestRaid6
> 
> 
> *****
> ***** Try to remove the /dev/mapper entires using dmraid command
> *****
> 
> gedakc at quad:/dev/mapper$ sudo dmraid -an
> 
> 
> *****
> ***** NOTE:  Two entries remain.  My guess is that the
> *****        isw_cjdcbiheed_TestRaid6 exists because it was in a logical
> *****        partition of an MSDOS partition table.
> *****        
> 
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     100 2009-02-28 10:29 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 09:05 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 10:28 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  3 2009-02-28 09:04 isw_cjdcbiheed_TestRaid6
> 
> 
> *****
> ***** Try to recreate the /dev/mapper entries
> *****
> 
> gedakc at quad:/dev/mapper$ sudo dmraid -ay
> RAID set "isw_cjdcbiheed_TestRaid" already active
> 
> 
> *****
> ***** Directory listing again
> *****
> 
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     140 2009-02-28 10:29 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 10:29 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 10:28 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  1 2009-02-28 10:29 isw_cjdcbiheed_TestRaid1
> brw-rw----  1 root disk 254,  2 2009-02-28 10:29 isw_cjdcbiheed_TestRaid5
> brw-rw----  1 root disk 254,  3 2009-02-28 09:04 isw_cjdcbiheed_TestRaid6
> 
> 
> *****
> ***** NOTE:
> ***** If I remove all /dev/mapper entries (excluding control of course :-),
> ***** then I can use "dmraid -ay" to create the proper /dev/mapper entries.
> *****
> 
> gedakc at quad:/dev/mapper$ sudo dmraid -an
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     100 2009-02-28 10:49 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 10:29 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 10:28 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  3 2009-02-28 09:04 isw_cjdcbiheed_TestRaid6
> gedakc at quad:/dev/mapper$ sudo dmsetup remove /dev/mapper/isw_cjdcbiheed_TestRaid6
> gedakc at quad:/dev/mapper$ sudo dmraid -an
> RAID set "isw_cjdcbiheed_TestRaid1" is not active
> RAID set "isw_cjdcbiheed_TestRaid5" is not active
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     60 2009-02-28 10:49 ./
> drwxr-xr-x 13 root root  14520 2009-02-28 10:29 ../
> crw-rw----  1 root root 10, 63 2009-02-28 09:04 control
> gedakc at quad:/dev/mapper$ sudo dmraid -ay
> gedakc at quad:/dev/mapper$ ll
> total 0
> drwxr-xr-x  2 root root     120 2009-02-28 10:49 ./
> drwxr-xr-x 13 root root   14520 2009-02-28 10:49 ../
> crw-rw----  1 root root  10, 63 2009-02-28 09:04 control
> brw-rw----  1 root disk 254,  0 2009-02-28 10:49 isw_cjdcbiheed_TestRaid
> brw-rw----  1 root disk 254,  1 2009-02-28 10:49 isw_cjdcbiheed_TestRaid1
> brw-rw----  1 root disk 254,  2 2009-02-28 10:49 isw_cjdcbiheed_TestRaid5
> gedakc at quad:/dev/mapper$ 
> 
> _______________________________________________
> Ataraid-list mailing list
> Ataraid-list at redhat.com
> https://www.redhat.com/mailman/listinfo/ataraid-list




More information about the Ataraid-list mailing list